Python client library that wraps multiple AI provider APIs behind one simple interface for text, structured data, and conversations.
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
Install the TypeScript package from npm
npm install @ax-llm/ax - 2
Import ai and ax and create a classifier with your OpenAI API key
- 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
A lightweight Python framework for building modular, schema-driven AI agent pipelines on top of Instructor and Pydantic.
An open-source platform for building and running autonomous, LLM-powered agents and multi-agent workflows, with a no-code graph editor.
A Python framework for building LLM-powered applications and agents, with standard interfaces for models, embeddings, vector stores and third-party integrations.
An open-source SDK that guards AI apps against prompt injections, redacts PII and secrets, and scans repositories for agent-targeted attacks.
A Python framework that adds input and output guards to LLM applications and generates validated structured data from LLM outputs.