FleetAgent is the entry point for every user turn. It is a dspy.ReAct module wrapped by AgentRuntime, which owns the sandbox, conversation history, and core-memory state.
FleetAgent (dspy.ReAct)
Source: src/fleet_rlm/runtime/agent/agent.py.
FleetAgent is a thin dspy.Module that extends dspy.ReAct with fleet-rlm’s tool registry and per-turn behavior. The ReAct loop drives turn-taking:
Signature
Behavior is defined through a DSPy signature (src/fleet_rlm/runtime/agent/signatures.py):
- Discoverable — DSPy can introspect the signature.
- Serializable — agent state can round-trip through manifests.
- Optimizable — GEPA, BootstrapFewShot, and MIPROv2 all see the signature.
AgentRuntime
Source:src/fleet_rlm/runtime/agent/runtime.py.
AgentRuntime is the per-session state envelope around FleetAgent. It carries:
| Field | Purpose |
|---|---|
agent | The FleetAgent instance |
interpreter | The active DaytonaInterpreter |
history | dspy.History of conversation turns |
core_memory | Persona, Human, Scratchpad blocks |
document_paths | Session-local loaded document paths |
lm | Configured DSPy LM for the planner |
delegate_lm | Optional separate LM for delegate_to_rlm |
AgentRuntime is what gets restored from a session manifest. Importing a session replaces these fields rather than merging them.
Core memory
Core memory is a mixin pattern offering three named blocks:| Block | Purpose |
|---|---|
Persona | Agent persona and behavior contract |
Human | What the agent knows about the user |
Scratchpad | Free-form working memory for the active task |
CoreMemoryUpdateProposal signature) — never by silent mutation.
Tool registry
Tools are registered into the ReAct agent at construction time.FleetAgent.discover_tools() builds the default registry; callers can pass extra_tools=[...] to extend it.
Key tools:
| Tool | Purpose |
|---|---|
delegate_to_rlm | Spawn an isolated child Daytona sandbox running a bounded dspy.RLM |
| Document / file tools | Load and inspect session documents |
| Sandbox execution tools | Run code in the active interpreter |
| Memory tools | Read and update core memory blocks |
Per-turn execution
A single turn flows through the runtime as: The streaming events flow back throughruntime/execution/streaming_events.py, are shaped by api/events/events.py, and exit the system on the two WebSocket endpoints.
History and trajectory
dspy.History is the conversation memory primitive. It’s a typed list of turn pairs (user_request, assistant_response) that the agent reads on every turn.
The trajectory is the per-turn ReAct execution trace — every thought, action, and observation. It’s optionally returned through run_react_chat_once(include_trajectory=True) and is always written to MLflow if tracing is enabled.
History is session-scoped and persisted in session manifests. Trajectory is turn-scoped and lives in MLflow + the streaming event log.
Delegate LM
delegate_to_rlm accepts an optional delegate_lm distinct from the planner LM. This is set via:
.env
Reset semantics
agent.areset(...) is the async reset path. It tears down:
- The current sandbox interpreter context.
- Conversation history.
- Core memory (back to defaults).
- Loaded documents.
Implementation pointers
| File | Role |
|---|---|
runtime/agent/agent.py | FleetAgent (dspy.ReAct) |
runtime/agent/runtime.py | AgentRuntime |
runtime/agent/signatures.py | DSPy signatures |
runtime/agent/chat_turns.py | Per-turn state and metrics |
runtime/factory.py | build_runtime() factory |
runtime/tools/ | Tool registry |
runtime/execution/streaming_events.py | Event construction |
See also
- Recursive RLM — delegation policy.
- Sessions & persistence — what gets restored.
- Python API — public interfaces.