Design concept, not yet built
Agents that plan in code and stop at the gate.
A concept for an MCP workflow engine: a typed state machine, sandboxed Python, and human approval before anything destructive.
Task
Archive customers inactive for 24 months, then drop the legacy_notes column.
- Discovertools/list over MCP
- Plantyped Plan model
- Sandbox execPython in a microVM
- Approval gatehuman decides
- Resultapplied or aborted
Trace
Tokens illustrative
Approval gate
sql.alter_table
drop column legacy_notes
rows_archived: 3,184
The run is parked. Nothing executes until you decide.
Timings and token counts are illustrative figures from a simulated run, not measurements. The context-stuffing path is a counterfactual.
A run is a graph, not a loop
Every transition is declared and typed. The model chooses inside a node, never between nodes, so a run cannot wander and always ends in a named terminal state.
Typed edges
Each node returns a Pydantic model. A transition fires only when the output validates, which is what makes replays deterministic.
Bounded by design
Retries, tokens and wall-clock are budgets in the state, not suggestions in a prompt. Exhaust one and the run goes to Failed.
The loop it replaces
An unbounded think, act, observe cycle where the model also decides when to stop. Cheap to start, hard to cap, hard to audit.
Architecture
Select any block to see its job. Solid lines are tool traffic, the dashed line is the approval request returning to the client.
Select a block
Each block is a separately testable piece. Start with the state machine, it is the part that replaces the agent loop.
Typed tools the model discovers
Tools are described by JSON Schema and annotations. Destructive ones carry a hint the engine uses to route them through the gate.
Approval travels over the protocol
A gated call parks the workflow and asks the connected client. The reply is a signal into Temporal, so it survives restarts and cannot be skipped by the model.
Gate policy, evaluated in code
Generated code never touches the host
Agent-written Python runs in a throwaway microVM with no credentials and no route out except one the policy names.
Isolation
One Firecracker microVM per run. Its own kernel, no shared filesystem, destroyed when the run ends.
Egress
Default deny. A short allowlist is enforced outside the VM, so code inside cannot widen it.
Secrets
No tokens in the sandbox. Data comes in through MCP tool results, credentials stay on the tool servers.
Audit
Code, stdout and every blocked request are spans on the same trace as the approval that followed.
Code in the sandbox tries to reach:
Design targets targets, not measurements
Stack
Each piece does one job, and any of them can be swapped without touching the others.
Protocol
- MCP Python SDK, FastMCP tool servers and the engine's own server
- Streamable HTTP transport for any client
Orchestration
- Pydantic AI typed nodes and validated outputs
- Pydantic models for plans, results, budgets
Execution
- E2B Firecracker microVMs for generated code
- Python as the action language
Durability
- Temporal workflows, retries, approval signals
Observability
- OpenTelemetry spans across every hop
- Pydantic Logfire traces, latency, token burn