What is A1?
A1 is a direct replacement for agent frameworks. While prior art generates a static while loop program for each agent, an agent compiler generates a program optimized for each unique agent input.
Why use an agent compiler?
- Safety - Minimizes exposure of sensitive data to an LLM.
- Speed - Up to 10x faster code generation.
- Determinism - Code is optimized for minimal non-deterministic behavior (e.g. LLM calls replaced with code where possible).
- Flexibility - Skills and Tools from any existing OpenAPI, MCP server, databases, fsspec paths, Python functions
Key Features
Quick Example
from a1 import Agent, tool, LLM
from pydantic import BaseModel
@tool
async def add(a: int, b: int) -> int:
return a + b
class MathInput(BaseModel):
problem: str
class MathOutput(BaseModel):
answer: int
agent = Agent(
name="math_agent",
description="Solves simple math problems",
input_schema=MathInput,
output_schema=MathOutput,
tools=[add, LLM("gpt-4.1")],
)
# Compile ahead-of-time
compiled = await agent.aot()
result = await compiled.execute(problem="What is 2 + 2?")
# Or execute just-in-time
result = await agent.jit(problem="What is 5 + 3?")