A modern agent compiler for building and executing LLM-powered agents
Project description
The a1 compiler for safe, reliable, deterministic AI agents.
a1 is an agent compiler. It takes an Agent (set of tools and a description) and compiles either AOT (ahead-of-time) into a Tool or JIT (just-in-time) for immediate execution tuned to the agent input.
uv pip install a1
🏎️ Why use an agent compiler?
- Safety a1 generates code for every agent input and isolates LLM contexts as much as possible, reducing the amount of potentially untrusted data an LLM is exposed to.
- Speed a1 makes codegen practical for agents with aggressive parallelism and static checking.
- Determinism a1 optimizes for determinism via a swappable cost function.
Agent compilers emerged from frustration with agent frameworks where every agent runs a static while loop program. Slow, unsafe, and highly nondeterministic. An agent compiler can perform the same while loop (just set Verify=IsLoop()) but has the freedom to explore superoptimal execution plans, while subject to engineered constraints.
🚀 How to get started?
from a1 import Agent, tool, Tool, LLM, Done, Runtime
from pydantic import BaseModel
# Define a simple tool
@tool(name="add", description="Add two numbers")
async def add(a: int, b: int) -> int:
return a + b
# Define input/output schemas
class MathInput(BaseModel):
problem: str
class MathOutput(BaseModel):
answer: str
# Create an agent
agent = Agent(
name="math_agent",
description="Solves simple math problems",
input_schema=MathInput,
output_schema=MathOutput,
tools=[add, LLM("gpt-4.1")], # LLMs are tools!
)
# Use the agent with AOT compilation
async def main():
# Compile ahead-of-time
compiled: Tool = await agent.aot()
result = await compiled(problem="What is 2 + 2?")
print(result)
# Or execute just-in-time
result = await runtime.jit(agent, problem="What is 5 + 3?")
print(result)
import asyncio
asyncio.run(main())
See the tests/ directory for extensive examples of everything a1 can do. Docs coming soon to docs.a1project.org
✨ Features
- Import your Langchain agents
- Observability via OpenTelemetry
- Tools instantiated from MCP or OpenAPI
- RAG instantiated given any SQL database, any fsspec path (e.g.
s3://my-place/hereorsomewhere/local). - Skills defined manually or by crawling online docs.
- Context engineering via a simple API that lets compiled code manage multi-agent behavior.
- Zero lock-in use any LLM, any secure code execution cloud.
- Only gets better as researchers develop increasingly powerful methods to
Generate,Costestimate, andVerifyagent code.
🤝 Contributing
Awesome! See our Contributing Guide for details.
📄 MIT License
As it should be!
Project details
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 a1_compiler-0.1.0.tar.gz.
File metadata
- Download URL: a1_compiler-0.1.0.tar.gz
- Upload date:
- Size: 224.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eff3186c8cb177d948aa7f73e1d723dbec1fd1aa33fdfb5c74e2d79fc9ccb730
|
|
| MD5 |
e9729e604bfe6876159add817e2fbaf7
|
|
| BLAKE2b-256 |
75204af902bcd12f3562e599c0e0ed62201485e4980f411702f328c11c0985b9
|
File details
Details for the file a1_compiler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: a1_compiler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 69.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de3231d909cba05ee12b7295443613a6a91e61476ff38d4e34d5714a4a3ca981
|
|
| MD5 |
403771ecd66000d3e53120ee3eb568d2
|
|
| BLAKE2b-256 |
b2fbfd20138bfe777caf81e24b1e0f5a44ce81d50b0224bfbce3feb8ec619977
|