Generated Ax runtime library
Project description
Ax for Python
Build Ax programs from Python without giving up the Ax model: typed signatures, structured generation, provider routing, RLM agents, flows, and optimizer artifacts all come from the same shared compiler contract. The package feels like Python, but the behavior stays aligned with the main Ax implementation.
Quick Start
pip install axllm
from axllm import s
sig = s("question:string -> answer:string")
schema = sig.to_json_schema("outputs")
assert "answer" in schema["properties"]
What You Can Build
- Signatures and schemas: describe inputs and outputs once, then reuse that shape for validation, prompts, tools, and typed results.
- AxGen: run structured generation with retries, tool calls, field processors, assertions, traces, usage, and provider-backed output parsing.
- AxAI: call OpenAI-compatible, OpenAI Responses, Gemini, Anthropic, Azure OpenAI, DeepSeek, Mistral, Reka, Cohere, and Grok clients through one provider boundary.
- AxAgent and RLM: let an agent plan and execute actor-code steps while Ax keeps envelopes, state, logs, traces, context, discovery, recall, and final typed responses aligned.
- AxFlow: compose AxGen, AxAgent, and nested flows into a portable program graph.
- Optimizers: save, load, apply, and evaluate optimizer artifacts, including the generated GEPA engine.
Package Shape
- Import package:
axllm - Distribution metadata:
pyproject.toml,MANIFEST.in, andaxllm/py.typed - Base dependencies: none
- Network support: available
Shared Ax behavior is Core-owned. The generated target code stays focused on idiomatic wrappers, transports, dynamic value helpers, and host-runtime boundaries.
Examples
no-key examples are deterministic local smokes. They are the fastest way to see the package work without any provider account:
python examples/signature_schema.py: signature parsing and JSON schema generationpython examples/axgen_scripted_client_tool.py: AxGen with a scripted client and toolpython examples/provider_mapping_no_key.py: provider mapping through a scripted transportpython examples/provider_stream_no_key.py: provider streaming through a scripted SSE transportpython examples/axflow_program_graph.py: AxFlow program graphpython examples/audio_responses_mapping.py: OpenAI Responses speak/transcribe mapping through a scripted transportpython examples/realtime_audio_events.py: Grok/Gemini realtime audio setup, input, and event foldingpython examples/runtime_adapter.py: customAxCodeRuntimesessionpython examples/runtime_protocol.py: process runtime protocol against the AxJS reference adapterpython examples/optimizer_artifact.py: optimizer artifact save/load/apply lifecyclepython examples/gepa_local_optimizer.py: local GEPA optimizer artifact generationpython examples/mcp_scripted_tools.py: MCP tool discovery and invocation through a scripted transport
provider-api examples make a real provider call and require OPENAI_API_KEY or OPENAI_APIKEY:
OPENAI_API_KEY=... python examples/axgen_openai_api.py: AxGen with a real OpenAI-compatible provider APIOPENAI_API_KEY=... python examples/flow_openai_api.py: AxFlow with a real OpenAI-compatible provider API
Runtime Profiles And RLM Agents
AxAgent uses an RLM executor loop. On each turn, the model writes a small actor-code step, and Ax sends that step into an AxCodeRuntime session. Think of the runtime as the agent's REPL: it keeps session state, exposes safe host callbacks, returns envelopes such as final(...), askClarification(...), discover(...), recall(...), and used(...), and lets the agent continue from the result.
The TypeScript package ships AxJSRuntime as the reference JavaScript implementation of that REPL contract. Generated runtime profiles are adapters for the same AxCodeRuntime / AxCodeSession boundary. They exist so RLM agents can execute actor code in a host runtime that fits the target package.
This package is not a TypeScript transpiler. AxIR compiles shared Ax semantics into native package code; it does not run your original Ax TypeScript application inside a Python runtime. Application code is still written in the language you are using here.
Optional profile files in this package:
javascript-quickjs: JavaScript actor code through a QuickJS protocol server viaProcessCodeRuntime.python-pyodide: Python actor code through a Pyodide JSONL protocol server.
See examples/runtime_profiles/README.md for setup, policy, and verification details.
Optional runtime profiles are dependency-bearing and opt-in. Adapter policy owns sandboxing, dependency loading, hard cancellation, process security, and host permissions. The shared Ax contract still owns envelopes, state, logs, traces, and the model-visible protocol.
Contract Snapshot
- Compiler contract version: 0.1
- Package: axllm
- Supported conformance suites: signature, schema, validation, prompt, axgen, axai, axagent, axoptimize, axprogram, axflow, axmcp
- Provider mode: provider-descriptor-registry-openai-compatible-openai-responses-google-gemini-anthropic
- Scripted transport support: true
- Real network support: available
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file axllm-22.0.6.tar.gz.
File metadata
- Download URL: axllm-22.0.6.tar.gz
- Upload date:
- Size: 210.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
474b3be807290f97c2e64f1afdd5887a1351bc4db3d02e1b1ba4ca94f848c3e1
|
|
| MD5 |
1a8824a4f06583714a22a5ed252f865e
|
|
| BLAKE2b-256 |
1afafe64100ac937ddf4e01f9c089d76beb979ea51cc91f93a4ff100fd141494
|
Provenance
The following attestation bundles were made for axllm-22.0.6.tar.gz:
Publisher:
package-publish.yml on ax-llm/ax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axllm-22.0.6.tar.gz -
Subject digest:
474b3be807290f97c2e64f1afdd5887a1351bc4db3d02e1b1ba4ca94f848c3e1 - Sigstore transparency entry: 1903824192
- Sigstore integration time:
-
Permalink:
ax-llm/ax@fa53d4ec2ee02baf4c0dbdf53e3af8db1255caa8 -
Branch / Tag:
refs/tags/22.0.6 - Owner: https://github.com/ax-llm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package-publish.yml@fa53d4ec2ee02baf4c0dbdf53e3af8db1255caa8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file axllm-22.0.6-py3-none-any.whl.
File metadata
- Download URL: axllm-22.0.6-py3-none-any.whl
- Upload date:
- Size: 198.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28adfbe0453e86df87b65c9db0feaa4e463dced4643ae114f6482ac32de3c6d8
|
|
| MD5 |
b2840a353bbb4cf0de6be8e3fed82826
|
|
| BLAKE2b-256 |
7b30fede781ace5163bf1fc653180b59f7589c26207c2054e2cf3ea11ed6ab90
|
Provenance
The following attestation bundles were made for axllm-22.0.6-py3-none-any.whl:
Publisher:
package-publish.yml on ax-llm/ax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axllm-22.0.6-py3-none-any.whl -
Subject digest:
28adfbe0453e86df87b65c9db0feaa4e463dced4643ae114f6482ac32de3c6d8 - Sigstore transparency entry: 1903824328
- Sigstore integration time:
-
Permalink:
ax-llm/ax@fa53d4ec2ee02baf4c0dbdf53e3af8db1255caa8 -
Branch / Tag:
refs/tags/22.0.6 - Owner: https://github.com/ax-llm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package-publish.yml@fa53d4ec2ee02baf4c0dbdf53e3af8db1255caa8 -
Trigger Event:
release
-
Statement type: