Skip to content

AgentForgeBuild AI Agents That Actually Work

Production-ready TypeScript framework for building AI agents with type-safe tools, streaming responses, and multi-provider support.

AgentForge
TypeScriptMIT LicensePRs WelcomeNode.js 18+

Why This Exists

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.

Active development - Designed with production patterns - Open source

What This Project Demonstrates

🏗

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

Simple, Powerful API

Build an AI agent with tools in under 30 lines of code

typescript
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!

Quick Install

$npm install agentforge zod

Why AgentForge?

Type Safety First

Every tool parameter, every response, every error - fully typed. Catch bugs at compile time, not in production.

Production Architecture

Built with patterns from real production systems: middleware pipelines, error boundaries, retry logic, and graceful degradation.

Framework Agnostic

Works with any frontend or backend. First-class React hooks included, but the core is pure TypeScript.

Zero Lock-in

Switch between OpenAI, Anthropic, or any provider with a single line change. Your tools work everywhere.

Testable by Design

Mock providers, test tools in isolation, verify middleware behavior. Testing AI agents should not be hard.

Extensively Documented

Comprehensive guides, API reference, and real-world examples. Learn once, build anything.

Ready to Build?

Start building production-ready AI agents in minutes.

Released under the MIT License.