@tame-ai/sdk
v0.3.1
Published
TypeScript SDK for protecting AI agent tool calls with TAME runtime policies.
Readme
@tame-ai/sdk
TypeScript SDK for protecting AI agent tool calls with TAME runtime policies.
Install
pnpm add @tame-ai/sdkConfigure
TAME_BASE_URL=https://tameapp.vercel.app
TAME_API_KEY=tame_sk_replace_me
TAME_ENVIRONMENT=productionUsage
import { TameClient } from "@tame-ai/sdk";
const tame = new TameClient({
baseUrl: process.env.TAME_BASE_URL!,
apiKey: process.env.TAME_API_KEY!,
agentId: "code-pipeline-agent",
context: {
environment: process.env.TAME_ENVIRONMENT ?? "production",
},
failureMode: "fail_closed",
});
const applyPatch = tame.protectTool({
name: "apply_patch",
async execute(args: {
repository: string;
file_path: string;
patch: string;
risk_score: number;
}) {
return realApplyPatch(args);
},
});TAME checks the tool call before execution. If a policy blocks the call, the SDK throws
TameToolError and the protected tool is not executed.
Lifecycle and model telemetry
await tame.recordAgentEvent({
event_type: "model.completed",
trace_id: "trace_123",
payload: {
provider: "your-provider",
model: "your-model-name",
outcome: "success",
},
});Supported event types are agent.started, agent.completed, agent.failed,
model.requested, model.completed, and model.failed. Send metadata only:
never prompts, completions, credentials, or raw customer data.
Notes
- Send only sanitized tool arguments and evidence.
- Do not send secrets, tokens, private keys, or full customer records.
- Keep policy decisions deterministic. AI explanations happen after incidents are stored.
