Skip to main content

Automated project building and test execution inside Docker containers

Project description

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.

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

execution_agent-0.1.2.tar.gz (108.1 kB view details)

Uploaded Source

Built Distribution

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

execution_agent-0.1.2-py3-none-any.whl (123.3 kB view details)

Uploaded Python 3

File details

Details for the file execution_agent-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for execution_agent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d9e7ac6444089a06a98bbb454be7e6de2801e252756bc10fcf0c86f804df4925
MD5 f46ebca5d212ea814f19b6ddbcd2cf9b
BLAKE2b-256 a175530522a4b307beba2acea9bbf598b1edab0f2cddee88bb6038cbf584711f

See more details on using hashes here.

File details

Details for the file execution_agent-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for execution_agent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8659fdea757e630bb7e53ca068a0d78eadfb28c3442ae43809e669ac4a344cc
MD5 563df419067393821da0e3a3edc18ad5
BLAKE2b-256 caead60e1030e24e6a500b157bd28f53f218954fb75c7cd3582fda3fa803d92e

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