Agent Interface
The abstract base class defines the contract all agents must implement:- Sandbox execution — Agents invoke CLI tools inside the container via
sandbox.exec()orsandbox.exec_stream() - Streaming support — Optional
callbackenables line-by-line output rendering - Conversation state —
run()starts a new task;continue_run()sends follow-up messages - 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)
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
--output-format stream-json— Emits per-tool progress events thatAgentRendererparses--verbose— Include tool details in output--dangerously-skip-permissions— Allow all file operations without prompts-c— Continue previous conversation (follow-up mode)
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):
Environment Injection
Agent environment variables are written to/tmp/.ftl_env inside the container:
Write env file (sandbox/docker.py:196-206):
sandbox/docker.py:219-223):
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’sstream-json) enable live progress display.
Callback pattern:
sandbox/docker.py:239-261):
- 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:timeout command conventions.
Adding New Agents
To integrate a new agent:-
Create adapter class in
ftl/agents/your_agent.py: -
Register in
__init__.py: -
Add auth keys to orchestrator:
- Build Docker image with your agent’s CLI installed
-
Test:
Agent Comparison
Next Steps
Session Orchestration
How agents are invoked in the session lifecycle
Sandbox Internals
Container execution environment and workspace management