Skip to content

KARABASAN

Compil'agent reframes compilation as an agentic problem.

Core trick

Agent reads Triton MLIR and Inductor IR, proposes multi-knob pass candidate batches, benchmarks them, and reflects before the next round.

Tags

Description

Compil'agent reframes compilation as an agentic problem. It's a drop-in replacement for `torch.compile` and `@triton.jit`, and the main mechanisms are backend-agnostic. In just three lines of code, users get a faster, correctness-validated callable. What's distinctive is where the agent searches. Conventional autotuners sweep user-facing knobs like BLOCK_SIZE or num_warps. Compilagent goes a layer deeper, into the compiler's own decisions: Triton's MLIR pass pipeline, Inductor's scheduler, FX graph rewrites, or even lowering registry overrides. The agent reads the actual IR, forms hypotheses tied to specific evidence in those artifacts, proposes multi-knob candidate batches, benchmarks each, and reflects across the batch before the next round. The interesting bet Compil'agent makes isn't just that LLMs can do compiler search. This points to a broader shift in how compilers are built. The field has long shipped fixed pipelines tuned by hand-written heuristics that must work passably across every workload. Compil'agent treats the pipeline as a search space and the compiler's own decisions as a tool surface, and in the future, enables the agent to become the compiler itself.
dyigitpolat/compilagent★ 40 forksPythonMITCreated Apr 26, 2026 · last push Sep 17, 2026

README excerpt

# Compilagent

A lean, plug-and-play optimization core: any compiler, any agentic harness,
any workload. The core (`src/compilagent/`) defines seven plug-in slots —
`Backend`, `Workload`, `Harness`, `Toolset`, `ObservationSink`,
`ArtifactRenderer`, `CandidatePolicy` — and ships zero coupling to any
specific compiler, LLM runtime, or UI. Integrations live under
`src/compilagent/integrations/`.

> **Building your own integration?** A new compiler, agent runtime, or
> workload can plug into the core without forking this repo. See
> [docs/integration_guide.md](docs/integration_guide.md).

## Installation

Clean install from a fresh clone (Python ≥ 3.11):

```bash
git clone https://github.com/<your-fork>/compilagent.git
cd compilagent

# 1. Create and activate a venv
python3 -m venv env
source env/bin/activate

# 2. Upgrade pip (recommended)
python -m pip install --upgrade pip

# 3. Install the package + every integration
python -m pip install -e ".[all]"

# 4. Configure provider credentials
cp .env.example .env 2>/dev/null || touch .env
echo 'ANTHROPIC_API_KEY=sk-ant-...'                >> .env
echo 'COMPILAGENT_MODEL=anthropic:claude-opus-4-7' >> .env

# 5. Sanity check
python -c "import compilagent; print(compilagent.__name__, 'ok')"

# 6. Launch the observation UI (http://127.0.0.1:8765)
compilagent-observe
```

Pick narrower extras on machines that don't need everything:

```bash
python -m pip install -e ".[ui]"                              # UI only
python -m pip install -e 

Team