agent-toolbox-sdk
v1.0.5
Published
TypeScript SDK for agent-toolbox.ai — hallucination firewall, import validator, secret scanner, injection detector, token counter, vulnerability scanner, context distiller
Maintainers
Readme
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
# or: pnpm add agent-toolbox-sdkQuick start
import { AgentoolboxClient } from "agent-toolbox-sdk";
const client = new AgentoolboxClient({
baseUrl: "https://api.agent-toolbox.ai",
// apiKey: "your-solana-tx-signature" // omit for free tier
});
// Validate imports in AI-generated code
const { hallucinated } = await client.validateImports({
language: "python",
code: "import numpy\nfrom superlogger import magic_log",
});
// hallucinated → [{ name: "superlogger", status: "hallucinated" }]
// Full hallucination firewall
const result = await client.verify({
outputType: "code",
language: "python",
llmResponse: generatedCode,
enforcementMode: "block",
});
// result.verdict → "BLOCK" | "FLAG" | "PASS"
// result.certificate → "sha256:..."Services
| Method | Endpoint | What it does |
|---|---|---|
| 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/pricingfor the address) - Use the transaction signature as your API key
// Discover pricing + wallet first
const pricing = await fetch("https://api.agent-toolbox.ai/v1/pricing").then(r => r.json());
// After sending SOL to pricing.wallet:
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..."`;
// Step 1: scan for secrets
const { safe, findings } = await client.scanSecrets({ code }) as any;
if (!safe) throw new Error(`Secrets: ${findings.map((f: any) => f.type).join(", ")}`);
// Step 2: validate imports
const { hallucinated } = await client.validateImports({ language: "python", code });
if (hallucinated.length > 0) throw new Error(`Hallucinated: ${hallucinated.map(p => p.name)}`);
// Step 3: full firewall
const result = await client.verify({ outputType: "code", language: "python", llmResponse: code });
if (result.verdict === "BLOCK") throw new Error("Blocked: " + result.claims[0]?.evidence);Links
- API: api.agent-toolbox.ai
- Docs: github.com/solhammer/agentoolbox
- Website: agent-toolbox.ai
- Issues: github.com/solhammer/agentoolbox/issues
License
MIT
