Skip to main content

A modern agent compiler for building and executing LLM-powered agents

Project description

BLAST Logo

The a1 compiler for safe, reliable, deterministic AI agents.

Documentation Discord Twitter Follow

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-compiler

🏎️ 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, LLM
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: int

# Create an agent with tools and LLM
agent = Agent(
    name="math_agent",
    description="Solves simple math problems",
    input_schema=MathInput,
    output_schema=MathOutput,
    tools=[add, LLM(model="gpt-4o")],  # LLMs are tools!
)

async def main():
    # Compile ahead-of-time
    compiled = await agent.aot()
    result = await compiled.execute(problem="What is 2 + 2?")
    print(f"AOT result: {result}")

    # Or execute just-in-time
    result = await agent.jit(problem="What is 5 + 3?")
    print(f"JIT result: {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, OpenAPI, or FastAPI servers
  • RAG instantiated given any SQL database or fsspec path (e.g. s3://my-place/here, gs://..., or local filesystem)
    • Unified RAG router that automatically switches between file and database operations
    • FileSystemRAG for file operations (ls, grep, cat) using fsspec
    • SQLRAG for database queries using SQLAlchemy with pandas
  • 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, Cost estimate, and Verify agent 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

a1_compiler-0.1.1.tar.gz (227.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

a1_compiler-0.1.1-py3-none-any.whl (70.2 kB view details)

Uploaded Python 3

File details

Details for the file a1_compiler-0.1.1.tar.gz.

File metadata

  • Download URL: a1_compiler-0.1.1.tar.gz
  • Upload date:
  • Size: 227.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for a1_compiler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d31add83ae6d69e9dd7485dda8b022447b2e5bd7fa2c0874226ac5889dfdfe19
MD5 d98c96828c9614c13dfa6118eb035f87
BLAKE2b-256 1064caec1b7bcddba235dbedc8811af304608a8aca039b674d8c0e0f99813db7

See more details on using hashes here.

File details

Details for the file a1_compiler-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: a1_compiler-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 70.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for a1_compiler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78f965295d5060c318a835599b73f258243ffff02797005f19f2c9fbb510cf3a
MD5 2ff0c96b3c7c88da8e8601831102b90b
BLAKE2b-256 0f054d77d6a9531927e94fda0d23e51d715e82d63c0a01d8c4ca8c60c2b7d0b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page