Skip to content

Agent frameworks

@tuppence/agent-tools gives an agent framework the same tools as the MCP server, in that framework’s shape. It fetches them with your key, so the agent sees only what the key allows.

Your agentOpenAI · LangChain · Claude@tuppence/agent-toolsTUPPENCE_SECRET_KEYMCP serverapi.tuppence.ai/mcptoolsBearer rk_…
Terminal window
npm install @tuppence/agent-tools
export TUPPENCE_SECRET_KEY=rk_test_…

Use a restricted key with only the scopes the agent needs: for example, payment_links:read and payment_links:write for an agent that sells with links. TUPPENCE_API_KEY also works, or pass apiKey.

import { Agent, run } from "@openai/agents";
import { tuppenceTools } from "@tuppence/agent-tools/openai-agents";
const { tools, close } = await tuppenceTools();
const agent = new Agent({
name: "Billing assistant",
instructions: "Amounts are integers in the currency's minor unit (pence, cents). When you create a payment link, reply with its URL.",
tools,
});
const result = await run(agent, "Make a £15 payment link for a deep research report.");
console.log(result.finalOutput);
await close();
import { Agent, run } from "@openai/agents";
import { tuppenceTools } from "@tuppence/agent-tools/openai-agents";
const { tools, close } = await tuppenceTools();
const agent = new Agent({
name: "Billing assistant",
instructions: "Amounts are integers in the currency's minor unit (pence, cents). When you create a payment link, reply with its URL.",
tools,
});
const result = await run(agent, "Make a $15 payment link for a deep research report.");
console.log(result.finalOutput);
await close();
import { Agent, run } from "@openai/agents";
import { tuppenceTools } from "@tuppence/agent-tools/openai-agents";
const { tools, close } = await tuppenceTools();
const agent = new Agent({
name: "Billing assistant",
instructions: "Amounts are integers in the currency's minor unit (pence, cents). When you create a payment link, reply with its URL.",
tools,
});
const result = await run(agent, "Make a €15 payment link for a deep research report.");
console.log(result.finalOutput);
await close();

Each example runs in CI against the real API, with a scripted model in place of the LLM. The agent creates a real link and gets its URL back.

A refused callThe tool returns the API’s error (code, message, param) instead of crashing, so the agent can read it and correct the call.
RetriesMoney-moving tools require an idempotency_key. A retry sends the same one, so the money moves once.

A platform’s agent can work for one of its connected accounts. Pass account when connecting and every tool acts as that account (its payments, links and bookings) using your key. The platform’s own Connect tools are then hidden.

Framework
OpenAI Agents SDK, LangChaintuppenceTools({ account: "acct_…" })
Claude Agent SDKtuppenceMcpServer({ account: "acct_…" })
@tuppence/mcpTUPPENCE_ACCOUNT=acct_…

Without it, a single tool call can act as an account through its own account argument (MCP server).

Docs assistant

Open as a page
Loading the assistant…