execute_code(code, timeout). The LLM writes an async Python script that calls your tools directly. One turn can do the work of many.
Setup
How It Works
The LLM writes the entire workflow in one shot. Concierge runs it in a sandboxed environment.What the LLM Writes
Why It’s 98% Less Context
Compare the token cost:- Plain mode (5 turns)
- Code mode (1 turn)
Sandbox Security
The code runs in a restricted environment:
Default timeout is 30 seconds. Configurable per call.
The sandbox only exposes your registered tools via the
tools module. The agent cannot access anything outside what you’ve explicitly defined.When to Use
Good fit:- Complex workflows with conditionals (
if cheapest.price < 500: ...) - Batch operations (loop over items)
- Maximum cost efficiency
- Chaining 3+ tools in sequence
- LLMs that struggle with code generation (smaller models)
- Simple one-tool calls (Plain is simpler)
- When you need human-readable execution logs (Plan is more auditable)