Delegate coding tasks to an isolated, disposable cloud sandbox that inspects repositories, modifies code, runs test suites, captures tested patches, and opens GitHub Pull Requests with live streaming visibility.
π Live Web App | Engineered by Anmol Sharma | GitHub | Live Portfolio
π Click to expand: End-to-End Sequence Diagram
sequenceDiagram
autonumber
actor Dev as Developer (Browser)
participant UI as Next.js 16 Web UI
participant API as FastAPI Control Plane
participant DB as PostgreSQL (Asyncpg)
participant Redis as Redis / arq Queue
participant Worker as arq Background Worker
participant LLM as Google Gemini 2.5 (Agent Loop)
participant Sandbox as Docker Sandbox (/workspace/repo)
participant GitHub as GitHub REST API
Dev->>UI: Submit Task Prompt + Target Repo URL
UI->>API: POST /api/tasks
API->>DB: Insert Task record (status: PENDING)
API->>Redis: Enqueue run_agent_loop(task_id, prompt, repo_url)
API-->>UI: Return task_id
UI->>API: Open WebSocket /ws/tasks/{task_id}
Redis->>Worker: Dequeue task job
Worker->>DB: Update Task (status: RUNNING)
Worker->>API: Broadcast status: running
API-->>UI: Stream status badge: RUNNING
Worker->>Sandbox: Provision ephemeral container & git clone
Worker->>Sandbox: git checkout -b nimbus/task-<task_id>
loop Agent Execution Loop (up to 20 turns)
Worker->>LLM: Send Task Goal + Working Dir Context
LLM-->>Worker: JSON Tool Command (e.g. bash command)
Worker->>API: Broadcast command event
API-->>UI: Stream $ command to Terminal
Worker->>Sandbox: Execute command in background thread
Sandbox-->>Worker: Exit code + stdout / stderr
Worker->>API: Broadcast result event
API-->>UI: Stream terminal output & test results
end
Worker->>Sandbox: git add -N . && git diff HEAD
Sandbox-->>Worker: Capture patch_diff
Worker->>Sandbox: Commit changes & git push branch
Worker->>GitHub: POST /repos/{owner}/{repo}/pulls (Draft PR)
GitHub-->>Worker: Return PR URL
Worker->>DB: Save patch_diff, pr_url, status: COMPLETED
Worker->>API: Broadcast status: completed + PR link
API-->>UI: Render "View Draft PR" Button & Patch Diff Viewer
π Click to expand: Security & Trust Boundary Architecture
graph TD
subgraph Trusted Zone ["π Trusted Control Plane (Host / Cloud Cluster)"]
UI["Web Frontend\n(Next.js 16 App Router)"]
API["FastAPI Gateway\n(REST & WebSockets)"]
DB[("PostgreSQL 16\n(Tasks & Append-Only Events)")]
Redis[("Redis 7\n(arq Queue + Pub/Sub)")]
Worker["arq Background Worker\n(Non-blocking Async Loop)"]
Secrets["Secret Vault\n(GEMINI_API_KEY, GITHUB_TOKEN)"]
LLM["Google Gemini 2.5\n(Structured Reasoning)"]
end
subgraph Untrusted Zone ["β οΈ Untrusted Ephemeral Sandbox (Docker / microVM)"]
Container["Disposable Container Sandbox\nβ’ Memory Cap: 1 GB\nβ’ CPU Limit: 2.0 Cores\nβ’ PIDs Limit: 256\nβ’ Cap Drop: ALL\nβ’ No New Privileges\nβ’ Timeout: 300s"]
Repo["/workspace/repo\nCloned Repository Code"]
Tools["Sandboxed Toolchain\n(git, python3, build-essential)"]
end
UI <-->|HTTPS / WSS| API
API <--> DB
API <--> Redis
Redis <--> Worker
Worker <--> DB
Worker --- Secrets
Worker <-->|REST API| LLM
Worker -->|Async Threadpool / isolated pipe| Container
Container --- Repo
Container --- Tools
Worker -->|Transient Auth Header| GitHub["GitHub API\n(Draft Pull Request)"]
π Click to expand: Task Lifecycle State Machine
stateDiagram-v2
[*] --> PENDING: User delegates task via UI / API
PENDING --> RUNNING: Worker dequeues from Redis
state RUNNING {
[*] --> WorkspaceInit: Provision Ephemeral Docker Container
WorkspaceInit --> GitClone: Clone repo & create branch nimbus/task-<id>
GitClone --> ReasoningLoop: Initialize Gemini 2.5 Agent
state ReasoningLoop {
PlanAction --> EmittingCommand: Generate structured JSON
EmittingCommand --> ExecutingInSandbox: Run command inside container
ExecutingInSandbox --> EvaluatingFeedback: Inspect stdout/stderr & test exit code
EvaluatingFeedback --> PlanAction: Refine fix & repeat
}
ReasoningLoop --> DiffExtraction: Agent signals completion
DiffExtraction --> CommitAndPush: Commit changes & push branch
CommitAndPush --> OpenDraftPR: Create GitHub Draft PR
}
RUNNING --> COMPLETED: Success (Patch captured & PR opened)
RUNNING --> FAILED: Agent exception / syntax failure
PENDING --> CANCELLED: User cancels task
RUNNING --> CANCELLED: User cancels task
COMPLETED --> [*]
FAILED --> [*]
CANCELLED --> [*]
The Next.js 16 frontend provides a modern glassmorphic split-pane dashboard:
+---------------------------------------------------------------------------------------+
| <- Back Task #42 π± nimbus/task-42 [π View Draft PR] [π’ COMPLETED] |
+-------------------------------------------+-------------------------------------------+
| π― USER GOAL | π₯οΈ AGENT EXECUTION TERMINAL |
| | |
| "Fix authentication middleware bug and | 10:40:12 Agent initialized workspace |
| add unit tests for token verification" | 10:40:14 $ git status |
| | 10:40:15 On branch nimbus/task-42 |
| π REPOSITORY | 10:40:18 $ pytest tests/test_auth.py |
| https://github.com/org/repo | 10:40:20 [Exit code: 1] 1 test failed |
| | 10:40:24 $ python3 fix_auth.py |
| π GENERATED PATCH DIFF [Collapse] | 10:40:27 $ pytest tests/test_auth.py |
| +---------------------------------------+ | 10:40:30 [Exit code: 0] 5 passed in 0.4s |
| | diff --git a/auth.py b/auth.py | | 10:40:32 Agent finished: Verified fix! |
| | + if not token: raise AuthError() | | 10:40:35 Draft PR opened successfully! |
| | - if token == None: pass | | |
| +---------------------------------------+ | |
+-------------------------------------------+-------------------------------------------+
- β‘ 100% Non-Blocking Asynchronous Core:
- FastAPI with
asyncpgconnection pooling (pool_size=20,max_overflow=10,pool_pre_ping=True). - Asynchronous LLM reasoning using Google GenAI's native async client (
client.aio.chats). - Asynchronous Docker container execution wrappers (
asyncio.to_thread) preventing I/O starvation.
- FastAPI with
- π‘οΈ Zero-Trust Workspace Isolation:
- Ephemeral Docker sandbox per task with hard resource limits (
1 GBRAM,2.0CPUs, PID cap256, dropped capabilities, and strict execution timeouts). - Secrets are kept outside the sandboxβGitHub authentication is injected via transient basic headers without writing credentials into
.git/config.
- Ephemeral Docker sandbox per task with hard resource limits (
- π Append-Only Event Sourcing & Instant Replay:
- Every log, bash command, terminal output, and status change is persisted in PostgreSQL as a durable
TaskEvent. - Interrupted browser sessions reconnect to
/ws/tasks/{id}and instantly receive full historical playback.
- Every log, bash command, terminal output, and status change is persisted in PostgreSQL as a durable
- π Real-Time Task Cancellation:
POST /api/tasks/{task_id}/cancelendpoint instantly signals running workers and cleans up Docker resources.
- π Automated GitHub Draft PRs:
- Automatically provisions feature branches (
nimbus/task-<task_id>), commits changes, pushes to remote, and creates Draft Pull Requests with patch diff previews.
- Automatically provisions feature branches (
Nimbus/
βββ backend/
β βββ alembic/ # Database migration scripts & environment
β βββ app/
β β βββ db.py # SQLAlchemy 2.0 async engine & connection pool setup
β β βββ github_client.py # GitHub REST API client for Draft PRs & branch pushes
β β βββ main.py # FastAPI control plane, REST routes & WebSocket gateway
β β βββ models.py # SQLAlchemy relational models (Task, TaskEvent)
β β βββ settings.py # Pydantic configuration & env variable schema
β β βββ worker.py # arq background worker & async Gemini agent loop
β β βββ workspace.py # Ephemeral Docker workspace sandbox adapter
β βββ evals/ # Benchmark runner & automated eval suite
β βββ tests/ # 17 comprehensive unit & integration tests
β βββ Dockerfile.workspace # Pre-built sandbox workspace container definition
β βββ pyproject.toml # uv package manager configuration
βββ frontend/
β βββ src/app/
β β βββ layout.tsx # App layout with Geist typography & metadata
β β βββ page.tsx # Task submission dashboard (prompt + repo URL)
β β βββ tasks/[id]/ # Real-time streaming terminal & patch diff inspector
β βββ package.json # Next.js 16 + React 19 + TypeScript config
βββ docs/
β βββ architecture.md # Full architecture specification & sequence diagrams
β βββ roadmap.md # Multi-phase milestone delivery roadmap
β βββ security.md # Security model & container trust boundaries
βββ TASKS.md # Project task tracker & milestone checklist
βββ PROJECT_STATE.md # Up-to-date development status & technical audit
βββ docker-compose.yml # Local multi-service infrastructure setup
βββ .env.example # Environment variables template
- Python 3.13+ with
uvinstalled. - Node.js 18+ &
npm. - Docker running locally.
- PostgreSQL 16 & Redis 7 (or via Docker Compose).
cp .env.example .env
Ensure .env contains:
DATABASE_URL=postgresql+asyncpg://nimbus_user:nimbus_password@localhost:5432/nimbus_db REDIS_URL=redis://localhost:6379/0 GEMINI_API_KEY=your_google_gemini_api_key GITHUB_TOKEN=your_github_token_for_prs # Optional
cd backend # Run database migrations uv run alembic upgrade head # Start FastAPI control plane (Terminal 1) uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload # Start arq background worker (Terminal 2) uv run arq app.worker.WorkerSettings
cd frontend # Install dependencies npm install # Start Next.js development server (Terminal 3) npm run dev
Open http://localhost:3000 to submit tasks and inspect live streaming execution!
cd backend
uv run pytest============================== test session starts ==============================
collected 46 items
tests/test_api.py ........ [ 17%]
tests/test_auth.py ........ [ 34%]
tests/test_browser.py ... [ 41%]
tests/test_credentials.py ..... [ 52%]
tests/test_evals.py .. [ 56%]
tests/test_github_client.py ... [ 63%]
tests/test_llm.py .... [ 71%]
tests/test_scaling.py .... [ 80%]
tests/test_worker.py .... [ 89%]
tests/test_workspace.py ..... [100%]
============================== 46 passed in 7.43s ==============================
cd backend
uv run python evals/eval_runner.py| Phase | Milestone | Status | Key Deliverables |
|---|---|---|---|
| Phase 0 | Foundation & Durable State | β Completed | FastAPI, Postgres asyncpg, Alembic migrations, Redis arq queue, WebSocket gateway |
| Phase 1 | Safe Single-Agent Execution | β Completed | Isolated Docker sandbox, async Gemini loop, git diff extraction, Next.js UI |
| Phase 2 | Multi-Tenant GitHub Workflow | β Completed | Ephemeral token injection, branch isolation (nimbus/task-<id>), automated Draft PRs |
| Phase 3 | Product-Grade Scalability | π In Progress | Distributed Redis Pub/Sub, session reconnect replay, MicroVM provider interface |
| Phase 4 | Browser Automation & Cloud Deploy | π Planned | Playwright visual verification, screenshot artifacts, production multi-cloud deploy |
Developed with β€οΈ by Anmol Sharma. Released under the MIT License.