Repolode
ax-llm

ax-llm/ax

A TypeScript-first DSPy-style framework for building typed, structured LLM programs with agents, flows, and optimizers, also compiled to Python, Java, C++, Go, and Rust.

Stars
2,978
Forks
201
Open issues
5
Last commit
yesterday

What is it?

Ax lets developers describe LLM tasks as typed signatures, either as a short string DSL, a fluent builder, or Standard Schema validators such as Zod, Valibot, and ArkType. Outputs are parsed and validated into typed values, with retries on validation failure. A single provider-name switch selects among many hosted and local model backends, including OpenAI, Anthropic, Google Gemini, Ollama, and OpenAI-compatible endpoints.

On top of signatures, the project provides agents with a sandboxed JavaScript runtime and recursive long-context execution, typed workflow graphs with branching, loops and parallel steps, and optimizers such as GEPA and few-shot bootstrapping. It also covers multimodal inputs, streaming with field-level parsing, tool calling, and MCP servers as tool sources.

The same programming model is compiled into checked-in Python, Java, C++, Go, and Rust packages, so programs can move across runtime stacks.

Key features

  • 01Typed structured output from string DSL, fluent builder, or Zod/Valibot/ArkType schemas
  • 02Unified API across many model providers, switched by a profile name
  • 03Agents with sandboxed JS runtime, checkpointed replay, and memory and skill loading
  • 04Typed workflow graphs with branches, loops, and parallel execution
  • 05Optimizers including GEPA and few-shot bootstrapping
  • 06Streaming parsing, tool calling, and MCP client support

Use cases

  • Extracting structured data from emails, tickets, or documents into typed objects
  • Building TypeScript applications that call LLMs with validated outputs
  • Creating multi-step LLM pipelines with branching and retry logic
  • Tuning prompts automatically against a labeled evaluation set

Quick start

  1. 1

    Install the TypeScript package from npm

    npm install @ax-llm/ax
  2. 2

    Import ai and ax and create a classifier with your OpenAI API key

  3. 3

    Run the classifier by calling forward with an LLM and review text

Things to know

  • Requires an API key from a model provider such as OpenAI or Anthropic to run LLM calls.
  • Multi-language ports (Python, Java, C++, Go, Rust) are generated from the TypeScript source and may lag behind it.

In collections

Topics

FAQ

What is ax?
A TypeScript-first DSPy-style framework for building typed, structured LLM programs with agents, flows, and optimizers, also compiled to Python, Java, C++, Go, and Rust. Ax lets developers describe LLM tasks as typed signatures, either as a short string DSL, a fluent builder, or Standard Schema validators such as Zod, Valibot, and ArkType. Outputs are parsed and validated into typed values, with retries on validation failure. A single provider-name switch selects among many hosted and local model backends, including OpenAI, Anthropic, Google Gemini, Ollama, and OpenAI-compatible endpoints.
Is ax free to use? What license does it have?
ax is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is ax still maintained?
Actively maintained. The last commit to ax was on Nov 6, 2026.
What can I use ax for?
Extracting structured data from emails, tickets, or documents into typed objects Building TypeScript applications that call LLMs with validated outputs Creating multi-step LLM pipelines with branching and retry logic Tuning prompts automatically against a labeled evaluation set
How do I install ax?
Install the TypeScript package from npm: npm install @ax-llm/ax Import ai and ax and create a classifier with your OpenAI API key Run the classifier by calling forward with an LLM and review text
Where can I get ax?
The source code and installation instructions are on GitHub: https://github.com/ax-llm/ax

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects