DSL-based intent execution system with iterative refinement, featuring AI-powered suggestions via Ollama, safe simulation, and automatic health validation.
Project description
ITERUN
DSL-based intent execution system with iterative refinement, ITERUN boundary, and AI-powered assistance
AI Cost Tracking
- ๐ค LLM usage: $1.2995 (8 commits)
- ๐ค Human dev: ~$414 (4.1h @ $100/h, 30min dedup)
Generated on 2026-06-06 using openrouter/qwen/qwen3-coder-next
Overview
ITERUN is a system that allows you to:
- Define intents using a simple YAML-based DSL
- Simulate execution with dry-run planning
- Get AI suggestions using local LLMs via Ollama
- Iteratively refine your intent through feedback loops
- Execute safely with the ITERUN boundary (explicit approval required)
Architecture
โโโโโโโโโโโโโโโโโโโโโโโ
โ CLI / Web UI โ โ User interface
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Parser / Validator โ โ DSL โ IR
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Intermediate Rep. โ โ Canonical state
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Planner / Simulator โ โ Dry-run
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ AI Gateway (Ollama) โ โ LLM suggestions
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Feedback Loop โ โ Iterate
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ ITERUN Boundary โ โ Explicit approval
โโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Executor โ โ Real execution
โโโโโโโโโโโโโโโโโโโโโโโ
Quick Start
Installation
# Clone repository
git clone https://github.com/softreck/iterun.git
cd iterun
# Full setup (recommended)
make setup
# Or manual install
pip install -r requirements.txt
pip install litellm
cp .env.example .env
Configuration (.env)
Copy .env.example to .env and adjust:
# Server
HOST=0.0.0.0
PORT=8080
# AI Gateway
OLLAMA_BASE_URL=http://localhost:11434
DEFAULT_MODEL=llama3.2
MAX_MODEL_PARAMS=12.0
# Execution (no ITERUN prompt by default)
SKIP_ITERUN_CONFIRMATION=true
CONTAINER_PORT=8000
AI Gateway Setup (Ollama)
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Start and pull model
make ollama-start
make ollama-pull
# Or manually
ollama serve
ollama pull llama3.2
Using Makefile
make help # Show all commands
make setup # Full setup
make web # Start web server
make shell # Interactive shell
make execute # Execute example intent
make test # Run all tests
make ollama-models # List available models
make clean # Clean temp files
Shell Interface
# Start interactive shell
make shell
# Or: python -m cli.main
# Execute intent directly (no ITERUN prompt)
make execute
# Or: python -m cli.main execute examples/user-api.intent.yaml
Interactive Shell Commands:
intent> new my-api # Create new intent
intent> load file.yaml # Load from file
intent> plan # Run dry-run
intent> suggest # Get AI suggestions
intent> apply # Auto-apply AI suggestions
intent> chat # Chat with AI
intent> iterate # Apply manual changes
intent> iterun # Approve execution
intent> execute # Execute approved intent
intent> show [json] # Show current state
intent> models # List AI models
intent> ai-health # Check AI Gateway status
intent> help # Show help
intent> exit # Exit shell
Web Interface
# Start web server
python -m web.app
# Open browser at http://localhost:8080
AI Gateway
The AI Gateway uses LiteLLM to provide unified access to local LLMs via Ollama.
Supported Models (โค12B parameters)
| Model | Size | Description |
|---|---|---|
llama3.2 |
3B | Default - Fast and efficient |
llama3.2:1b |
1B | Ultra lightweight |
llama3.1:8b |
8B | Balanced performance |
mistral |
7B | Fast inference |
mistral-nemo |
12B | Best quality under 12B |
gemma2 |
9B | Google Gemma 2 |
gemma2:2b |
2B | Lightweight |
phi3 |
3.8B | Microsoft Phi-3 |
qwen2.5 |
7B | Alibaba Qwen 2.5 |
codellama |
7B | Code generation |
codegemma |
7B | Google CodeGemma |
deepseek-coder |
6.7B | DeepSeek Coder |
Configuration
Environment variables:
export OLLAMA_BASE_URL="http://localhost:11434"
export DEFAULT_MODEL="llama3.2"
export MAX_MODEL_PARAMS="12.0"
DSL Format
INTENT:
name: user-api
goal: Create a REST API for user management
ENVIRONMENT:
runtime: docker
base_image: python:3.12-slim
ports:
- 8000
IMPLEMENTATION:
language: python
framework: fastapi
actions:
- api.expose GET /ping
- api.expose GET /users
- api.expose POST /users
- api.expose DELETE /users/{id}
EXECUTION:
mode: dry-run
Supported Actions
| Action | Format | Description |
|---|---|---|
api.expose |
api.expose METHOD /path |
Expose HTTP endpoint |
db.create |
db.create table_name |
Create database table |
db.add_column |
db.add_column table column type |
Add column to table |
shell.exec |
shell.exec command |
Execute shell command |
rest.call |
rest.call METHOD url |
Call external REST API |
file.create |
file.create path |
Create file |
API Reference
REST Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/intents |
List all intents |
POST |
/api/intents/parse |
Parse DSL and create intent |
GET |
/api/intents/{id} |
Get intent by ID |
DELETE |
/api/intents/{id} |
Delete intent |
POST |
/api/intents/{id}/plan |
Run dry-run |
POST |
/api/intents/{id}/iterate |
Apply changes |
POST |
/api/intents/{id}/iterun |
Approve for execution |
POST |
/api/intents/{id}/execute |
Execute approved intent |
GET |
/api/intents/{id}/code |
Get generated code |
AI Gateway Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/ai/status |
Check AI Gateway status |
GET |
/api/ai/models |
List available models |
POST |
/api/ai/complete |
Generate AI completion |
POST |
/api/ai/chat |
Chat with AI |
POST |
/api/intents/{id}/ai/suggest |
Get AI suggestions |
POST |
/api/intents/{id}/ai/apply |
Auto-apply suggestions |
Python API
from ir.models import IntentIR
from parser import parse_dsl
from planner import plan_intent
from ai_gateway import get_gateway, create_feedback_loop
# Parse DSL
ir = parse_dsl(dsl_content)
# Run dry-run
result = plan_intent(ir)
print(result.generated_code)
# Get AI suggestions
loop = create_feedback_loop()
suggestions = loop.analyze(ir, focus="security")
print(suggestions.suggestions)
# Apply AI suggestions
loop.iterate(ir, auto_apply=True)
# Or chat directly
gateway = get_gateway()
response = gateway.complete("Explain FastAPI middleware")
print(response["content"])
Testing
# Run all tests (58 tests)
pytest
# Run specific test suites
pytest tests/e2e/test_shell.py -v # 17 tests
pytest tests/e2e/test_web.py -v # 18 tests
pytest tests/e2e/test_ai_gateway.py -v # 23 tests
# Run with coverage
pytest --cov=. --cov-report=html
Project Structure
iterun/
โโโ ir/ # Intermediate Representation models
โโโ parser/ # DSL parser
โโโ planner/ # Dry-run simulator
โโโ executor/ # Execution engine
โโโ ai_gateway/ # LiteLLM AI Gateway
โ โโโ gateway.py # Main gateway with Ollama models
โ โโโ feedback_loop.py # LLM-powered feedback loop
โโโ cli/ # Shell interface
โโโ web/ # Web interface (FastAPI)
โโโ tests/e2e/ # E2E test suite
โ โโโ test_shell.py
โ โโโ test_web.py
โ โโโ test_ai_gateway.py
โโโ examples/ # Example DSL files
โโโ config.py # Configuration loader
โโโ Makefile # Build automation
โโโ .env.example # Environment template
โโโ requirements.txt
โโโ README.md
Workflow
- Define Intent โ Write DSL or use web editor
- Parse โ Convert DSL to IR (Intermediate Representation)
- Plan โ Run dry-run simulation, review generated code
- Get AI Suggestions โ Analyze with local LLM
- Iterate โ Make changes, re-plan until satisfied
- Execute โ Run with auto-validation and auto-fix
- Validate โ Automatic health checks on all endpoints
Validation & Auto-Fix
After container deployment, the system automatically:
- Waits for container startup (configurable
STARTUP_WAIT) - Validates all exposed endpoints with HTTP requests
- Detects issues like connection refused, timeouts, HTTP errors
- Auto-fixes common problems:
- Missing
__main__block - Wrong port configuration
- Missing dependencies
- Missing
- Restarts container with fixes
- Re-validates until success or max iterations reached
Configuration
# In .env
VALIDATE_AFTER_EXECUTE=true
AUTO_FIX_ENABLED=true
MAX_FIX_ITERATIONS=3
STARTUP_WAIT=2
VALIDATION_TIMEOUT=10
Example Output
Execution Logs:
[12:38:55] Container started: 8f35e0a2fb27
[12:38:55] Waiting 2s for container startup...
[12:38:57] โ http://localhost:8002 โ 200
[12:38:57] โ http://localhost:8002/ping โ 200
[12:38:57] โ http://localhost:8002/health โ 200
[12:38:57] โ All endpoints validated successfully
โ Execution completed in 2.56s
Validation:
โ All endpoints validated
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/intents/{id}/validate |
Validate running container |
GET |
/api/containers/{id}/logs |
Get container logs |
License
Licensed under Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iterun-0.1.5.tar.gz.
File metadata
- Download URL: iterun-0.1.5.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
239b967f07c9ce4356eb43363c7fddc1ac6f45daf43bc7b4905f7252a5cb7f19
|
|
| MD5 |
05f79c301e7b881ab35e96689c7ef0af
|
|
| BLAKE2b-256 |
b005e38dcdc3db0e769690495a27295c150fa4ceebeb844b12bca720eff4b3b3
|
File details
Details for the file iterun-0.1.5-py3-none-any.whl.
File metadata
- Download URL: iterun-0.1.5-py3-none-any.whl
- Upload date:
- Size: 45.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05b673a7162b19ba6604bdc76c688a3eab00ad88b63f9b639887eaeb41560695
|
|
| MD5 |
9057c6b2ee4558b2cad75fd6f343fb90
|
|
| BLAKE2b-256 |
942b29d11a71f491d2a9eb722aaa78f25f89c38ebab9ba1eddddde725c1d911b
|