Skip to main content

Build AI Agents That Actually Work

DeepAgents is a TypeScript framework for building multi-agent AI systems that handle complex, real-world tasks. Create agents that use tools, coordinate through handoffs, query databases in natural language, and leverage RAG for intelligent document retrieval.

Quick Start

Get up and running in 5 minutes with your first agent

Core Concepts

Learn about agent architecture and composition patterns

API Reference

Explore the complete package documentation

Examples

See real-world agent implementations

Why DeepAgents?

Type-Safe

Full TypeScript support with inference for context, outputs, and tools

Multi-Agent

Built-in handoffs for agent delegation and coordination

Production-Ready

Context persistence, streaming, error recovery, and evals

Model-Agnostic

Works with OpenAI, Anthropic, Google, Groq, and any Vercel AI SDK provider

SQL Generation

Natural language to SQL with multi-database support

RAG Built-In

Local-first retrieval with vector search and embeddings

Framework Packages

@deepagents/agent

Core agent framework with tools, handoffs, and streaming

@deepagents/context

Context management with XML, Markdown, and TOML renderers

@deepagents/text2sql

AI-powered natural language to SQL queries

@deepagents/retrieval

Local-first RAG with vector embeddings and search

@deepagents/evals

LLM evaluation framework with scoring and persistence

@deepagents/orchestrator

High-level orchestration patterns for complex workflows

@deepagents/toolbox

Pre-built tools for web search, filesystem, and more

Key Features

Agent Composition

Build modular agents with specific roles and capabilities. Agents can use tools, maintain context, and delegate to specialized agents.
import { agent, execute } from '@deepagents/agent';
import { openai } from '@ai-sdk/openai';

const assistant = agent({
  name: 'assistant',
  model: openai('gpt-4o'),
  prompt: 'You are a helpful AI assistant.',
});

const stream = execute(assistant, 'Hello!', {});
for await (const chunk of stream.textStream) {
  process.stdout.write(chunk);
}

Multi-Agent Coordination

Agents automatically coordinate through handoffs, allowing specialized agents to handle specific tasks.
const researcher = agent({
  name: 'researcher',
  model: openai('gpt-4o'),
  prompt: 'You research topics thoroughly.',
  handoffDescription: 'Handles research and fact-finding',
});

const writer = agent({
  name: 'writer',
  model: openai('gpt-4o'),
  prompt: 'You write clear, engaging content.',
  handoffDescription: 'Handles content creation',
});

const coordinator = agent({
  name: 'coordinator',
  model: openai('gpt-4o'),
  prompt: 'Coordinate research and writing tasks',
  handoffs: [researcher, writer],
});

Natural Language to SQL

Convert questions to validated, executable SQL queries with built-in safety and domain knowledge injection.
import { Text2Sql } from '@deepagents/text2sql';
import { Postgres, tables, constraints } from '@deepagents/text2sql/postgres';

const text2sql = new Text2Sql({
  version: 'v1',
  model: groq('llama-3.3-70b-versatile'),
  adapter: new Postgres({
    execute: async (sql) => pool.query(sql).then(r => r.rows),
    grounding: [tables(), constraints()],
  }),
});

const sql = await text2sql.toSql('Show top 10 customers by revenue');
Ingest content from various sources and perform semantic search with local embeddings.
import { ingest, similaritySearch } from '@deepagents/retrieval';
import { githubConnector } from '@deepagents/retrieval/connectors';

await ingest({
  connector: githubConnector({
    owner: 'JanuaryLabs',
    repo: 'deepagents',
  }),
  store: sqliteStore,
  embedder: fastEmbed,
});

const results = await similaritySearch({
  query: 'How do agent handoffs work?',
  store: sqliteStore,
  embedder: fastEmbed,
  limit: 5,
});

Philosophy

DeepAgents is in early development with no backwards compatibility concerns. We do things RIGHT: clean, organized, zero tech debt. No workarounds, only full implementations built for scale.
We focus on:
  • Type Safety - Full TypeScript inference across all APIs
  • Composability - Build complex systems from simple, reusable agents
  • Production Quality - Persistence, streaming, error recovery, and evaluation
  • Developer Experience - Clear APIs, helpful errors, comprehensive examples

Getting Started

1

Install the packages

npm install @deepagents/agent @ai-sdk/openai ai zod
2

Create your first agent

import { agent, execute } from '@deepagents/agent';
import { openai } from '@ai-sdk/openai';

const assistant = agent({
  name: 'assistant',
  model: openai('gpt-4o'),
  prompt: 'You are a helpful assistant.',
});
3

Execute and stream responses

const stream = execute(assistant, 'Tell me about AI agents', {});
console.log(await stream.text);
Continue to the Quick Start Guide for a complete walkthrough.

Community and Support

GitHub Repository

Star the repo, report issues, and contribute

Report Issues

Found a bug? Let us know

License

DeepAgents is MIT licensed. See the LICENSE file for details.

Build docs developers (and LLMs) love