agent-toolbox-sdk
TypeScript SDK for agent-toolbox.ai — the quality layer for AI agents.
Seven services callable by any agent. Pay per call in SOL. Free tier: 10 calls/IP.
Install
npm install agent-toolbox-sdk
Quick start
import { AgentoolboxClient } from "agent-toolbox-sdk";
const client = new AgentoolboxClient({
baseUrl: "https://api.agent-toolbox.ai",
});
const { hallucinated } = await client.validateImports({
language: "python",
code: "import numpy\nfrom superlogger import magic_log",
});
const result = await client.verify({
outputType: "code",
language: "python",
llmResponse: generatedCode,
enforcementMode: "block",
});
Services
validateImports() | POST /v1/validate/imports | Catches hallucinated package names against PyPI/npm/crates.io/Go |
verify() | POST /v1/verify | PASS/FLAG/BLOCK firewall — packages, URLs, citations, contradictions |
distill() | POST /v1/distill | Compresses conversation context to a token budget |
scanSecrets() | POST /v1/scan/secrets | Detects hardcoded credentials in code (10 patterns, redacted) |
scanInjection() | POST /v1/scan/injection | Detects prompt injection in user input |
countTokens() | POST /v1/tokens/count | BPE token counting + cost estimation for GPT-4/Claude/Gemini |
scanVulnerabilities() | POST /v1/scan/vulnerabilities | Checks packages against OSV/CVE database |
Authentication
Free tier: 10 calls/IP, no auth needed.
Paid tier (SOL micropayments):
- Send SOL to the service wallet (see
GET /v1/pricing for the address)
- Use the transaction signature as your API key
const pricing = await fetch("https://api.agent-toolbox.ai/v1/pricing").then(r => r.json());
const client = new AgentoolboxClient({
baseUrl: "https://api.agent-toolbox.ai",
apiKey: "<your-solana-transaction-signature>",
});
1 SOL = 10,000 credits · 0.0001 SOL per call
Full example
import { AgentoolboxClient } from "agent-toolbox-sdk";
const client = new AgentoolboxClient({ baseUrl: "https://api.agent-toolbox.ai" });
const code = `import requests\nfrom ghostpkg import magic\nAPI_KEY="sk-abc123..."`;
const { safe, findings } = await client.scanSecrets({ code }) as any;
if (!safe) throw new Error(`Secrets: ${findings.map((f: any) => f.type).join(", ")}`);
const { hallucinated } = await client.validateImports({ language: "python", code });
if (hallucinated.length > 0) throw new Error(`Hallucinated: ${hallucinated.map(p => p.name)}`);
const result = await client.verify({ outputType: "code", language: "python", llmResponse: code });
if (result.verdict === "BLOCK") throw new Error("Blocked: " + result.claims[0]?.evidence);
Links
License
MIT