Skip to main content

Execution Agent

PyPI version Python 3.10+ License: MIT

An LLM-powered agent that automatically sets up, builds, and runs test suites for software projects inside Docker containers. Given a Git repository, it analyzes the project, creates a Dockerfile, installs dependencies, and executes the test suite — all autonomously.

Installation

pip install execution-agent

Requires Python 3.10+ and Docker installed on the host.

Quick Start

# 1. Set your API key
export OPENAI_API_KEY="your-api-key"

# 2. Create a project metadata file
cat > project_meta_data.json << 'EOF'
{
  "project_path": "my_project",
  "project_url": "https://github.com/username/my_project",
  "language": "Python",
  "budget": 40
}
EOF

# 3. Run the agent
execution-agent --experiment-file project_meta_data.json

How It Works

  1. Context gathering — Clones the repository, inspects CI configs, README, and dependency files
  2. Dockerfile generation — Creates a Docker environment tailored to the project
  3. Build & test — Iteratively runs commands inside the container to install, build, and test
  4. Retry with learning — If the budget is exhausted, retries with lessons from previous attempts
  5. Forced exit — As a last resort, a knowledge model synthesizes a final solution from all context

The task is considered successful when ~80%+ of tests pass.

Command-Line Options

execution-agent --experiment-file META.json [OPTIONS]
Option Description Default
--experiment-file Path to project metadata JSON (required) —
--task Custom task string Auto-generated
--task-file File containing custom task instructions —
--model LLM model for the agent gpt-5-nano
--knowledge-model LLM model for context analysis gpt-5-mini
--api-key OpenAI API key $OPENAI_API_KEY
--workspace-root Output directory execution_agent_workspace
--prompt-files Custom prompt templates directory Bundled defaults
--log-level DEBUG / INFO / WARNING / ERROR INFO
--run-log-dir Custom directory for run logs Auto-generated
--max-retries Retries after budget exhaustion 2

You can also run it as a module:

python -m execution_agent --experiment-file project_meta_data.json

Project Metadata Format

{
  "project_path": "scipy",
  "project_name": "SciPy",
  "project_url": "https://github.com/scipy/scipy",
  "language": "Python",
  "budget": 40
}
Field Description
project_path Directory name for the project
project_name Human-readable name (optional)
project_url Git repository URL
language Primary language: Python, Java, Javascript, C, C++, Rust
budget Maximum execution cycles (steps)

Agent Tools

The agent can use these tools during execution:

Tool Description
linux_terminal Execute bash commands inside the Docker container
read_file Read file contents
write_to_file Write files (Dockerfiles, scripts, etc.)
search_docker_image Search Docker Hub for base images
goals_accomplished Signal successful task completion

Output Structure

execution_agent_workspace/
├── _run_logs/<project>/<timestamp>/
│   ├── run.log                    # Human-readable log
│   ├── run.jsonl                  # Structured JSON log
│   ├── messages.json              # Full LLM conversation history
│   ├── replay_trace.sh            # Bash script to replay all commands
│   ├── tool_metrics.json          # Tool execution statistics
│   ├── cycles_chats/              # Per-cycle LLM prompts
│   ├── success_artifacts/         # On success: Dockerfile, commands.sh, launch.sh
│   └── forced_exit_cycle/         # On budget exhaustion: final attempt artifacts
└── <project>/                     # Cloned repository

Reproducing a Successful Run

cd execution_agent_workspace/_run_logs/<project>/<timestamp>/success_artifacts/
./launch.sh

Retry Mechanism

  1. Attempt 1: Initial run with full budget
  2. Attempts 2–N: Retries informed by lessons from previous attempts
  3. Forced exit cycle: If all retries fail, a knowledge model generates a final Dockerfile and test script based on everything learned

Each attempt produces a summary with problems encountered, progress made, and suggestions for the next attempt.

Language Support

Built-in guidelines are included for: Python, Java, JavaScript/TypeScript, C, C++, and Rust.

Environment Variables

Variable Description
OPENAI_API_KEY API key for LLM access (required)
OPENAI_MODEL Default model (fallback for --model)
KNOWLEDGE_MODEL Default knowledge model (fallback for --knowledge-model)

License

MIT — see LICENSE.md for details.

Based on mini-swe-agent by Kilian Lieret and Carlos E. Jimenez.

Metadata

Release files for execution-agent 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for execution-agent 0.1.2
File Size Uploaded Provenance
execution_agent-0.1.2.tar.gz 108.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for execution-agent 0.1.2
File Interpreter ABI Platform
execution_agent-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 231.4 kB

Release files / execution_agent-0.1.2.tar.gz

Download URL execution_agent-0.1.2.tar.gz
Size 108.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d9e7ac6444089a06a98bbb454be7e6de2801e252756bc10fcf0c86f804df4925
BLAKE2b-256 checksum
How to use checksums
a175530522a4b307beba2acea9bbf598b1edab0f2cddee88bb6038cbf584711f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / execution_agent-0.1.2-py3-none-any.whl

Download URL execution_agent-0.1.2-py3-none-any.whl
Size 123.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8659fdea757e630bb7e53ca068a0d78eadfb28c3442ae43809e669ac4a344cc
BLAKE2b-256 checksum
How to use checksums
caead60e1030e24e6a500b157bd28f53f218954fb75c7cd3582fda3fa803d92e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for execution-agent 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page