Skip to main content
FTL supports multiple coding agents through a unified adapter interface. All agents execute inside the Docker sandbox — they never touch the host filesystem directly.

Agent Interface

The abstract base class defines the contract all agents must implement:
Key design points:
  1. Sandbox execution — Agents invoke CLI tools inside the container via sandbox.exec() or sandbox.exec_stream()
  2. Streaming support — Optional callback enables line-by-line output rendering
  3. Conversation state — run() starts a new task; continue_run() sends follow-up messages
  4. Return values — All methods return (exit_code, stdout, stderr) matching subprocess conventions
Agents never have direct filesystem access. They operate exclusively through commands executed inside the sandbox.

Supported Agents

FTL ships with four agent adapters:

Agent Registry (agents/__init__.py)

The orchestrator calls get_agent(agent_name) to instantiate the configured adapter.

Claude Code Adapter

The default agent, optimized for streaming output and tool visibility. Source: agents/claude_code.py:1-24
Flags:
  • --output-format stream-json — Emits per-tool progress events that AgentRenderer parses
  • --verbose — Include tool details in output
  • --dangerously-skip-permissions — Allow all file operations without prompts
  • -c — Continue previous conversation (follow-up mode)
Streaming behavior:
When a callback is provided, output flows line-by-line through the renderer. Otherwise, execution blocks until completion.
Claude Code’s conversation history persists in /home/ftl/.claude/ inside the container, surviving across tasks.

Agent Authentication

The orchestrator forwards agent-specific environment variables from the host into the container. Agent key mapping (orchestrator.py:44-56):
Collection from host environment:
Pre-boot validation:
This fails fast before booting the sandbox if the agent won’t be able to authenticate.

Environment Injection

Agent environment variables are written to /tmp/.ftl_env inside the container: Write env file (sandbox/docker.py:196-206):
Source before commands (sandbox/docker.py:219-223):
Every sandbox.exec() or sandbox.exec_stream() call automatically sources this file, making both shadow credentials and agent auth keys available.

Streaming Output

Agents that support structured output (like Claude Code’s stream-json) enable live progress display. Callback pattern:
Sandbox streaming implementation (sandbox/docker.py:239-261):
Key behaviors:
  • Stderr merged into stdout so errors stream live
  • Full output accumulated and returned
  • Ctrl+C terminates the container process

Timeout Handling

All agent executions have a default 60-minute timeout:
Exit code 124 indicates timeout, matching POSIX timeout command conventions.

Adding New Agents

To integrate a new agent:
  1. Create adapter class in ftl/agents/your_agent.py:
  2. Register in __init__.py:
  3. Add auth keys to orchestrator:
  4. Build Docker image with your agent’s CLI installed
  5. Test:

Agent Comparison

Next Steps

Session Orchestration

How agents are invoked in the session lifecycle

Sandbox Internals

Container execution environment and workspace management