Documentation

Build LLM-powered agents
with production-ready TypeScript

DSPy for TypeScript. Working with LLMs is complex—they don't always do what you want. DSPy makes it easier to build amazing things with LLMs. Just define your inputs and outputs (signature) and an efficient prompt is auto-generated and used. Connect together various signatures to build complex systems and workflows using LLMs.

15+ LLM Providers
End-to-end Streaming
Auto Prompt Tuning

Ax Examples Guide

This page lists every runnable example in src/examples/, grouped by theme and linked to GitHub for easy browsing.

Getting Started

Signatures, Structured Output, and Examples

Functions and Tool Calling

Streaming, Assertions, and Control Flow

Agents and Agent Patterns

RLM and Runtime-State Examples

Flow Orchestration

Optimization, Training, and Evaluation

RAG, Retrieval, and Memory

Multi-Modal, Audio, and Vision

Provider-Specific Examples

Anthropic

Gemini and Vertex

OpenAI

Other Providers

MCP Integrations

Routing, Balancing, and Service Selection

Observability and Debugging

Browser, Local Runtime, and Deployment