mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
hanzoai/agents carried the reconciled Go, TypeScript and Python SDKs: memory in Base with one record schema across all three, scope ids resolved the way the control plane resolves them, /v1 paths, one address per vector operation, agents that start under Express 5, and suites that run (Go green, 92 TypeScript, 527 Python). They come home here. The Go module is github.com/hanzoai/agent/sdk/go, because the path has to name the repository it is fetched from. The TypeScript manifest names its versions directly and keeps npm's lockfile; this repo is not a pnpm workspace. Versions are 0.2.10. Co-authored-by: Hanzo Dev <[email protected]>
Hanzo Agents TypeScript SDK
The TypeScript SDK provides an idiomatic Node.js interface for building and running Hanzo Agents agents. It mirrors the Python SDK APIs, including AI, memory, discovery, and MCP tooling.
Installing
npm install @hanzo-agents/sdk
Rate limiting
AI calls are wrapped with a stateless rate limiter that matches the Python SDK: exponential backoff, container-scoped jitter, Retry-After support, and a circuit breaker.
Configure per-agent via aiConfig:
import { Agent } from '@hanzo-agents/sdk';
const agent = new Agent({
nodeId: 'demo',
aiConfig: {
model: 'gpt-4o',
enableRateLimitRetry: true, // default: true
rateLimitMaxRetries: 20, // max retry attempts
rateLimitBaseDelay: 1.0, // seconds
rateLimitMaxDelay: 300.0, // seconds cap
rateLimitJitterFactor: 0.25, // ±25% jitter
rateLimitCircuitBreakerThreshold: 10, // consecutive failures before opening
rateLimitCircuitBreakerTimeout: 300 // seconds before closing breaker
}
});
To disable retries, set enableRateLimitRetry: false.
You can also use the limiter directly:
import { StatelessRateLimiter } from '@hanzo-agents/sdk';
const limiter = new StatelessRateLimiter({ maxRetries: 3, baseDelay: 0.5 });
const result = await limiter.executeWithRetry(() => makeAiCall());
Execution Notes
Log execution progress with ctx.note(message: string, tags?: string[]) for fire-and-forget debugging in the Hanzo Agents UI.
agent.reasoner('process', async (ctx) => {
ctx.note('Starting processing', ['debug']);
const result = await processData(ctx.input);
ctx.note(`Completed: ${result.length} items`, ['info']);
return result;
});
Use note() for Hanzo Agents UI tracking, console.log() for local debugging.