Core Design Principles
- Agent Isolation — Agents run entirely inside Docker containers with no direct access to the host filesystem
- Shadow Credentials — Real API keys never enter the sandbox; agents see generated fake values
- Parallel Verification — Tests generate while the agent codes, running immediately when both finish
- Diff-Driven Merge — Changes are computed on-demand and applied only after explicit human approval
- Persistent Containers — One container per project, warm across tasks to eliminate cold-boot overhead
The agent cannot have skin in the game. The human must. Every change requires explicit approval before it touches the real filesystem.
Session Lifecycle
When you runftl code "your task", the system executes this sequence:
Key Components
Session (orchestrator.py:96-416)
The Session class manages the entire lifecycle of a coding task. It coordinates:
- Snapshotting project state
- Booting or reusing containers
- Shadow credential injection
- Parallel agent + test execution
- Diff computation and review
- Merge/reject decisions
Agent Adapters (agents/)
Abstract interface for different coding agents (Claude Code, Codex, Aider, Kiro). All agents:
- Execute inside the sandbox via
sandbox.exec()orsandbox.exec_stream() - Support initial tasks and follow-up messages
- Stream output line-by-line when a callback is provided
Sandbox (sandbox/docker.py)
Docker-based isolation layer providing:
- Persistent containers keyed by project path hash
- Workspace reset from snapshots on each task
- Environment variable injection (credentials + agent auth)
- Command execution with streaming support
- Linux-internal diff computation
Credential System (credentials.py + proxy.py)
Two-layer security model:
- Shadow injection — Fake credentials injected into container environment
- Network proxy (optional) — MITM proxy swaps shadow→real values at the network layer for live API calls
The proxy requires the
cryptography package (pip install -e '.[proxy]'). Without it, agents see only shadow values and live API calls will fail.Data Flow
Persistence Model
Parallel Execution
FTL uses Python’sThreadPoolExecutor to run the agent and test generator in parallel:
AWS Integration Points
FTL supports optional AWS-backed capabilities:- S3 — Snapshot storage (replaces local rsync)
- Secrets Manager — Credential source (replaces
.env) - CloudWatch — Session tracing
- Bedrock Guardrails — Hard-blocking diff safety scan (replaces local lint)
.ftlconfig.
Security Boundaries
- Container isolation — Agent has no direct host filesystem access
- Shadow credentials — Real secrets never enter the sandbox environment
- Network proxy — Optional MITM layer intercepts and rewrites credentials in transit
- Diff review — Lint scan + optional LLM Q&A before merge
- Human approval — Every change requires explicit user consent
Next Steps
Session Orchestration
Detailed session lifecycle and state management
Agent Adapters
Agent abstraction and implementation details
Sandbox Internals
Docker backend, container lifecycle, and diff computation