Files
zeekayandGitHub 5b5cf9e9db feat: merge AgentField control plane + SDKs as Hanzo Agents (#1)
Transforms hanzoai/agents from a marketplace config repo into a full
agent orchestration platform by merging the AgentField infrastructure:

- Go control plane (K8s-like agent orchestration, service mesh, DAG workflows)
- Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC)
- TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows)
- Go SDK (idiomatic agent builder + client)
- React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI)
- Docker/K8s/Helm deployment configs
- Examples: hello world, deep research, RAG, simulation, benchmarks
- Functional test suite across Python/Go/TypeScript

All references rebranded: AgentField → Hanzo Agents
- Module: github.com/hanzoai/agents/control-plane
- Python: hanzo_agents
- TypeScript: @hanzo/agents
- Go: github.com/hanzoai/agents/sdk/go
- Env vars: HANZO_AGENTS_*
- Config: hanzo-agents.yaml

Previous marketplace configs moved to config/ directory.
2026-02-09 18:53:09 -08:00

69 lines
1.9 KiB
JavaScript

import http from 'node:http';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
async function loadSdk() {
const base = process.env.TS_SDK_PATH;
const candidates = [
base && path.join(base, 'dist', 'index.js'),
'/usr/local/lib/node_modules/@hanzo/agents-sdk/dist/index.js',
'/usr/lib/node_modules/@hanzo/agents-sdk/dist/index.js'
].filter(Boolean);
for (const candidate of candidates) {
try {
return await import(pathToFileURL(candidate).href);
} catch {
// try next candidate
}
}
return await import('@hanzo/agents-sdk');
}
const { Agent } = await loadSdk();
const hanzoAgentsUrl = process.env.HANZO_AGENTS_SERVER ?? 'http://localhost:8080';
const nodeId = process.env.TS_AGENT_ID ?? 'ts-serverless-agent';
const port = Number(process.env.TS_AGENT_PORT ?? 8097);
const host = process.env.TS_AGENT_BIND_HOST ?? '0.0.0.0';
const agent = new Agent({
nodeId,
hanzoAgentsUrl,
deploymentType: 'serverless',
devMode: true
});
agent.reasoner('hello', async (ctx) => ({
greeting: `Hello, ${ctx.input.name ?? 'Hanzo Agents'}!`,
runId: ctx.runId,
executionId: ctx.executionId,
parentExecutionId: ctx.parentExecutionId
}));
agent.reasoner('relay', async (ctx) => {
const target = process.env.TS_CHILD_TARGET ?? ctx.input.target;
if (!target) {
return { error: 'target is required' };
}
const downstream = await agent.call(target, { name: ctx.input.name ?? 'ts-child' });
return { target, downstream };
});
const handler = agent.handler();
const server = http.createServer(async (req, res) => {
try {
await handler(req, res);
} catch (err) {
res.statusCode = 500;
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify({ error: err?.message ?? 'handler failure' }));
}
});
server.listen(port, host, () => {
console.log(`Serverless TS handler listening on http://${host}:${port}`);
});