Managed Execution

Bounded server-side tool loops with explicit execution policies

By default, skills inject tools but leave execution to your client. With managed execution, TheRouter runs a server-side loop: call tool, feed result back, repeat until the model produces a final response or a boundary is hit.

Execution boundaries

  • mode: "managed" — enable the server-side loop
  • max_steps — maximum inference rounds (default 5)
  • max_duration_ms — wall-clock timeout (default 30000)
  • max_tool_calls — total tool invocations across all steps (default 10)

Complete example

Request
{
  "model": "anthropic/claude-sonnet-4.5",
  "messages": [{ "role": "user", "content": "Current weather in Paris in Fahrenheit." }],
  "skills": [{ "id": "web" }],
  "skill_execution": {
    "mode": "managed",
    "max_steps": 3,
    "max_duration_ms": 15000,
    "max_tool_calls": 5
  }
}

Incomplete execution

When a boundary is hit, _skill_execution.status is "incomplete" with a reason: max_steps_reached, max_duration_exceeded, max_tool_calls_reached, or tool_error.

incomplete.json
{ "_skill_execution": { "status": "incomplete", "reason": "max_steps_reached",
    "steps_executed": 5, "tool_calls_made": 8, "duration_ms": 12400 } }

Failure modes

  • Provider 4xx — terminal, error propagates to client.
  • Built-in failures — fail-open, model can retry or proceed.
  • Webhook failures — structured error returned to model.
Not a general agent runtime
Managed execution is for bounded, deterministic tool loops. Keep max_steps low and use it for tasks needing 2–5 tool calls.