← All tools

Code Engineering

Build / Compile

Compile the current project; auto-detects the build tool from on-disk markers.

build

Overview

Runs the project's compile step in a subprocess (no tests), captures stdout/stderr, truncates to 50 KB, and returns the exit code so the agent can decide whether the change holds together.

How it works

READ_ONLY-permission tool wrapping ProcessBuilder. Detection is first-match-wins by marker file. Default timeout 300s; the agent may override runner explicitly. Output is capped at MAX_OUTPUT_CHARS so a noisy build doesn't blow the prompt budget.

Example

When a user asks:

Did my last edit break the compile?

the agent calls the tool:

build()

and gets back: exit=0 — compiled in 8.2s (mvn -B -q -DskipTests compile)

What it's good for

Real scenarios where agents put this tool to work.

Post-edit syntax check before invoking the slower test_runner
Pre-PR sanity gate inside a self-improving coding loop
Compile multi-language polyglot repos without hardcoding which builder runs where

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/build/BuildTool.java in the swarm-ai repository.

Open build on GitHub →