Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(architecture): clarify tool-call iteration cap resolution

Steven Enamakel7c5e2556005f
diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.md
index a847217e24..d8bb1badca 100644
--- a/gitbooks/developing/architecture/agent-harness.md
+++ b/gitbooks/developing/architecture/agent-harness.md
@@ -236,7 +236,7 @@ The loader is `agent::prompts::agents_md` (pure functions returning pre-loaded s
## The tool-call loop
-Inside `Agent::turn`, the tool-call loop is the inner engine. Since issue #4249 it is the published **tinyagents** crate's `AgentHarness` loop, assembled per turn by `run_turn_via_tinyagents_shared` ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](../../../crates/openhuman-core/src/agent/tinyagents/mod.rs)). It runs up to `max_tool_iterations` rounds (default 10):
+Inside `Agent::turn`, the tool-call loop is the inner engine. Since issue #4249 it is the published **tinyagents** crate's `AgentHarness` loop, assembled per turn by `run_turn_via_tinyagents_shared` ([`crates/openhuman-core/src/agent/tinyagents/mod.rs`](../../../crates/openhuman-core/src/agent/tinyagents/mod.rs)). It runs up to the turn's iteration cap, resolved in `session_host/builder/iteration_cap.rs`: an explicit `[agent] max_tool_iterations_override` (or `OPENHUMAN_AGENT_MAX_TOOL_ITERATIONS`) wins, then the agent definition's cap (the orchestrator's is 200), then `max_tool_iterations` (default 10) for a turn with no definition. The model is told how many calls remain at 50% and 80% of the budget, and `inference_agent_chat` reports a capped turn with `hit_cap: true` and its `checkpoint` text:
```
loop {
diff --git a/scripts/life-scenarios/run.mjs b/scripts/life-scenarios/run.mjs
index 92e464ae7a..cf042a731c 100644
--- a/scripts/life-scenarios/run.mjs
+++ b/scripts/life-scenarios/run.mjs
@@ -273,9 +273,9 @@ async function prepareHome(runDir, opts, { searchBase } = {}) {
// The web-chat path (`channel_web_chat`, the desktop driver below) has no
// per-call `agent_id` the way `inference_agent_chat` does, so this is how
// it is pointed at the suite's benchmark agent. Without it that path runs
- // `orchestrator`, whose definition caps the turn at 15 iterations — and a
- // definition cap OVERWRITES `[agent] max_tool_iterations` rather than being
- // bounded by it, so no cap setting can substitute for choosing the agent.
+ // `orchestrator`. A definition cap replaces `[agent] max_tool_iterations`,
+ // so only `max_tool_iterations_override` changes the budget without
+ // changing which agent (prompt, tools) answers.
"[agent]",
`chat_agent_id = "${opts.agentId}"`,
"",