ax

The pretty much "official" DSPy framework for Typescript

What is ax?

The pretty much "official" DSPy framework for Typescript

Overview of ax

What it is

Ax is a TypeScript-first programming framework for building with large language models (LLMs). It provides a unified programming model that compiles into verified libraries for TypeScript, Python, Java, C++, Go, and Rust. The framework is published as the npm package @ax-llm/ax.

Key features

  • Signatures for typed structured generation using a string DSL, a fluent f() builder, or any Standard Schema v1 validator (Zod, Valibot, ArkType).
  • Named deployment profiles that select wire behavior (native API, router, hosted inference) and resolve the model ID internally; the same signature works across providers like OpenAI, Anthropic, Google Gemini, Meta, Together, Fireworks, DeepSeek, and Grok.
  • Agents with runtime execution, context budgets, checkpoints, action-log replay, discovery, memory, skills, and delegation.
  • Flows as typed program graphs with branches, loops, feedback, cache behavior, parallel execution, and .returns(...) projection.
  • Optimizers including GEPA, few-shot bootstrapping, portable optimizer artifacts, and evaluation/apply flows.
  • Provider-native speed with streaming as the default; the hot path renders the signature, calls the provider, parses the result, and returns a typed value.

Use cases

  • Structured extraction from text (e.g., sentiment, priority, ticket numbers).
  • Constrained and nested object generation using a string grammar or fluent builder.
  • Multi-language AI application development where the same program model runs across TypeScript, Python, Java, C++, Go, and Rust.
  • Building agents with memory, delegation, and checkpointing.
  • Creating typed program graphs (flows) with branching, looping, and parallel execution.

Getting started

typescript import { ai, ax } from '@ax-llm/ax'; const llm = ai({ name: 'openai', apiKey: process.env.OPENAI_APIKEY }); const classify = ax( 'review:string -> sentiment:class 'positive, negative, neutral'', ); const { sentiment } = await classify.forward(llm, { review: 'This product is amazing!', }); // sentiment: 'positive' — typed as the literal union For runnable examples in all supported languages, see src/examples/README.md in the repository.

License and pricing

The project is licensed under Apache-2.0 and is open source. Pricing is not stated in the provided metadata or README.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/ax-llmax.svg)](https://yunodb.com/tools/ax-llmax?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/ax-llmax?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/ax-llmax.svg" alt="Featured on YunoDB" height="20"></a>