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
2.1 KiB
TypeScript

import { Agent } from '@hanzo-agents/sdk';
import dotenv from 'dotenv';
dotenv.config();
const agent = new Agent({
nodeId: process.env.AGENT_NODE_ID ?? 'ts-serverless-hello',
version: '1.0.0',
deploymentType: 'serverless',
controlPlaneUrl: process.env.HANZO_AGENTS_URL ?? 'http://localhost:8080',
devMode: true
});
agent.reasoner('hello', async (ctx) => ({
greeting: `Hello, ${ctx.input.name ?? 'Hanzo Agents'}!`,
runId: ctx.runId,
executionId: ctx.executionId
}));
agent.reasoner('relay', async (ctx) => {
const target = (process.env.CHILD_TARGET ?? ctx.input.target) as string | undefined;
if (!target) {
return { error: 'target is required' };
}
const downstream = await agent.call(target, { message: ctx.input.message ?? 'ping' });
return { target, downstream };
});
// Exported handler works for AWS Lambda/Cloud Functions and raw HTTP (Vercel/Netlify).
// You can adapt any platform-specific event shape here (e.g., Supabase/Netlify payloads).
export const handler = agent.handler((event) => {
const body = typeof event?.body === 'string' ? safeJson(event.body) : event?.body;
const input = event?.input ?? body?.input ?? body ?? {};
return {
path: event?.rawPath || event?.path || '/execute',
headers: event?.headers ?? {},
queryStringParameters: event?.queryStringParameters ?? event?.query ?? {},
reasoner: event?.reasoner ?? event?.target,
target: event?.target ?? event?.reasoner,
input,
executionContext: event?.executionContext ?? event?.execution_context
};
});
function safeJson(value: string | undefined) {
if (!value) return {};
try {
return JSON.parse(value);
} catch {
return {};
}
}
// Optional local runner for smoke-testing without heartbeats.
if (import.meta.url === `file://${process.argv[1]}`) {
const port = Number(process.env.PORT ?? 8787);
const { default: express } = await import('express');
const app = express();
app.all('*', async (req, res) => {
await handler(req, res);
});
app.listen(port, '0.0.0.0', () => {
console.log(`Serverless hello handler listening on http://localhost:${port}`);
});
}