Type-Safe Tools
Define tools with Zod schemas for full TypeScript inference. Parameters are validated at runtime and compile time.
Production-ready TypeScript framework for building AI agents with type-safe tools, streaming responses, and multi-provider support.
AgentForge was built to solve a real problem: most AI agent frameworks break down when you try to ship them to production.
This project demonstrates how to design a type-safe, provider-agnostic, streaming-first agent system using modern TypeScript, clean architecture, and production-grade patterns.
Designing modular, provider-agnostic architecture that scales
Building type-safe APIs with runtime validation using Zod
Implementing streaming systems with async iterators
Designing middleware pipelines for extensibility
Production patterns: circuit breakers, retry logic, graceful degradation
Complete documentation with branding, SEO, and examples
Build an AI agent with tools in under 30 lines of code
import { Agent, OpenAIProvider, defineTool } from 'agentforge';
import { z } from 'zod';
// Define a type-safe tool
const weatherTool = defineTool({
name: 'get_weather',
description: 'Get current weather for a location',
parameters: z.object({
location: z.string().describe('City name'),
}),
execute: async ({ location }) => {
// Your implementation here
return { temperature: 72, condition: 'sunny', location };
},
});
// Create an agent
const agent = new Agent({
provider: new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY }),
tools: [weatherTool],
systemPrompt: 'You are a helpful weather assistant.',
});
// Run it
const response = await agent.run('What is the weather in Boston?');
console.log(response.content);
// The current weather in Boston is 72F and sunny!npm install agentforge zodEvery tool parameter, every response, every error - fully typed. Catch bugs at compile time, not in production.
Built with patterns from real production systems: middleware pipelines, error boundaries, retry logic, and graceful degradation.
Works with any frontend or backend. First-class React hooks included, but the core is pure TypeScript.
Switch between OpenAI, Anthropic, or any provider with a single line change. Your tools work everywhere.
Mock providers, test tools in isolation, verify middleware behavior. Testing AI agents should not be hard.
Comprehensive guides, API reference, and real-world examples. Learn once, build anything.
Start building production-ready AI agents in minutes.