An intelligent, extensible coding assistant that can generate and execute Python code in a sandboxed Docker environment.
The easiest way to get started is with the interactive code generation tool.
./run.shThat's it! The script will:
- ✓ Check Python version (3.11+ required)
- ✓ Create a virtual environment
- ✓ Install all dependencies automatically
- ✓ Check if Docker is running
- ✓ Start the interactive tool
-
Python 3.11 or higher
python3 --version # Should be 3.11+ -
Docker (for code execution)
docker --version
Make sure Docker Desktop is running.
-
Anthropic API Key
Get your API key from Anthropic Console
Set it as an environment variable:
export ANTHROPIC_API_KEY='your-api-key-here'
Or create a
.envfile:echo "ANTHROPIC_API_KEY=your-api-key-here" > .env
If you prefer to install manually:
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
# Run the tool
python code_generation.pyThe code generation tool is an interactive CLI that:
- Asks you what code you want to create
- Generates Python code using Claude AI
- Executes the code in a secure Docker sandbox
- Shows you the results
What code would you like to generate?
>>> A function to calculate fibonacci numbers
Include test cases? (y/n) [n]: y
Step 1: Generating code...
Generated code:
```python
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
def test_fibonacci():
assert fibonacci(0) == 0
assert fibonacci(1) == 1
assert fibonacci(10) == 55
Execute this code? (y/n) [y]: y
Step 3: Executing code in Docker sandbox... Execution successful (completed in 145ms)
Output: All tests passed!
## Project Structure
platform/ ├── code_generation.py # Interactive code generation tool ├── run.sh # One-line setup and run script ├── src/assistant/ # Core assistant code │ ├── tools/ # AI tools (generate, execute, analyze, etc.) │ ├── runtimes/ # Execution runtimes (Python + Docker) │ ├── providers/ # LLM providers (Anthropic) │ └── config.py # Configuration management ├── tests/ # Test suite └── pyproject.toml # Dependencies and project metadata
## Development
### Running Tests
```bash
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run specific test file
pytest tests/test_runtime_basic.py
This project uses bd (beads) for issue tracking:
# See what's ready to work on
bd ready
# Create a new issue
bd create "Issue title" -t task -p 1
# Start working on an issue
bd update bd-123 --status in_progress
# Close when done
bd close bd-123 --reason "Completed"Code execution happens in a sandboxed Docker container with:
- ✓ No network access
- ✓ Memory limits (256MB default)
- ✓ CPU quota limits
- ✓ Timeout enforcement (30s default)
- ✓ Seccomp profile for syscall filtering
- ✓ All capabilities dropped
- ✓ Read-only filesystem
- GenerateTool: Create Python code from natural language descriptions
- ExecuteTool: Run code in sandboxed Docker environment
- FixTool: Automatically fix code errors
- ExplainTool: Get detailed code explanations
- AnalyzeTool: Analyze code quality and complexity
- Plugin system for custom tools
- Multiple LLM provider support (Anthropic, OpenAI)
- Event bus for hooks and monitoring
- Session management with persistence
MIT
Issues and pull requests welcome! See beads tracker for current work:
bd list --json