@forgeframework/ai-agents
v0.3.0
Published
Agent orchestration framework for the Forge Framework.
Maintainers
Readme
@forgeframework/ai-agents
Agent orchestration framework for the Forge Framework.
Part of the Forge Framework — a TypeScript framework for backend microservices and web applications.
Installation
npm install @forgeframework/ai-agentsUsage
import { AgentConfig, CoreOrchestrator, PlanningStrategy, ToolDefinition } from '@forgeframework/ai-agents';
import { AIProviderFactory, AIFramework } from '@forgeframework/ai-llm';
import { z } from 'zod';
const searchTool: ToolDefinition = {
name: 'search_database',
description: 'Search the product database by query',
inputSchema: z.object({ query: z.string(), limit: z.number().optional().default(10) }),
handler: async (input) => ({
content: [{ type: 'text', text: JSON.stringify(await db.products.search(input.query, input.limit)) }],
isError: false,
}),
annotations: { readOnly: true, destructive: false, idempotent: true },
};
const llmProvider = AIProviderFactory.createInstance({ framework: AIFramework.NATIVE, model: 'gpt-4o' });
const config: AgentConfig = {
model: 'gpt-4o',
maxIterations: 10,
maxTokens: 4096,
tools: [searchTool],
memory: { type: 'conversation', conversationWindowSize: 20 },
systemPrompt: 'You are a product search assistant.',
planningStrategy: PlanningStrategy.REACT,
};
const orchestrator = new CoreOrchestrator(config, llmProvider);
const result = await orchestrator.execute('Find me wireless headphones under $100');
console.log(result.output);
console.log(`Steps: ${result.steps.length}, Tokens: ${result.tokenUsage.totalTokens}`);Documentation
Full API reference and guides: https://carbonforge.io/framework/docs/ai/ai-agents
(Documentation site launching soon.)
License
MIT © Carbon Forge
