mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
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.
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import dotenv from 'dotenv';
|
|
import { dirname, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { Agent, type AIConfig } from '@hanzo-agents/sdk';
|
|
import {
|
|
aggregationRouter,
|
|
decisionRouter,
|
|
entityRouter,
|
|
scenarioRouter,
|
|
simulationRouter
|
|
} from './routers/index.js';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
dotenv.config({ path: resolve(process.cwd(), '.env') });
|
|
if (!process.env.OPENAI_API_KEY && !process.env.OPENROUTER_API_KEY) {
|
|
dotenv.config({ path: resolve(__dirname, '../../../.env') });
|
|
}
|
|
|
|
const aiConfig: AIConfig =
|
|
process.env.OPENROUTER_API_KEY
|
|
? {
|
|
// OpenRouter is OpenAI-compatible; keep provider as openai
|
|
provider: 'openai',
|
|
model: process.env.OPENROUTER_MODEL ?? 'deepseek/deepseek-v3.1-terminus',
|
|
apiKey: process.env.OPENROUTER_API_KEY,
|
|
baseUrl: process.env.OPENROUTER_BASE_URL ?? 'https://openrouter.ai/api/v1'
|
|
}
|
|
: {
|
|
provider: 'openai',
|
|
model: process.env.OPENAI_MODEL ?? 'gpt-4o',
|
|
apiKey: process.env.OPENAI_API_KEY
|
|
};
|
|
|
|
const agent = new Agent({
|
|
nodeId: 'simulation-engine',
|
|
aiConfig,
|
|
host: 'localhost',
|
|
devMode: true
|
|
});
|
|
|
|
[scenarioRouter, entityRouter, decisionRouter, aggregationRouter, simulationRouter].forEach((router) =>
|
|
agent.includeRouter(router)
|
|
);
|
|
|
|
agent.reasoner<{ message: string }, { echo: string }>('echo', async (ctx) => ({
|
|
echo: ctx.input.message
|
|
}));
|
|
|
|
agent
|
|
.serve()
|
|
.then(() => {
|
|
console.log('Simulation agent serving on port 8001');
|
|
})
|
|
.catch((err) => {
|
|
console.error('Failed to start simulation agent', err);
|
|
process.exit(1);
|
|
});
|