Skip to content

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

Merge remote-tracking branch 'refs/remotes/upstream/main' into pr/5664\n

Steven Enamakel2bfd2a2c1f9b
diff --cc AGENTS.md
index b42f2287c9,d79896ed14..e5b0670e2f
--- a/AGENTS.md
+++ b/AGENTS.md
@@@ -349,8 -364,47 +364,47 @@@ two paths' equivalence — keep that a
A move never changes the wire surface — RPC namespaces are string literals in `ControllerSchema`, not derived from module paths — so **do not rename namespace strings to match new paths**.
-**Skills runtime**: the QuickJS per-skill VM engine is gone. `src/openhuman/skills/` holds skill metadata/tool descriptors; execution of installed `SKILL.md` workflows lives in `src/openhuman/skills/runtime/` (starts/cancels runs, hosts the `skill_executor` agent, reuses `runtime_node`/`runtime_python`).
+**Skills runtime**: the QuickJS per-skill VM engine is gone. `src/openhuman/skills/` holds skill metadata/tool descriptors; execution of installed `SKILL.md` workflows lives in `src/openhuman/skills/runtime/` (starts/cancels runs, hosts the `skill_executor` agent, reuses `runtime::node`/`runtime::python`, which are clients for the `tinyruntime` module).
+ ### Tool calling lives in tinyagents — `src/openhuman/agent/dispatcher.rs` is a seam
+
+ How a model is told to ask for a tool, how the ask is parsed, how results are
+ rendered back, and how a transcript is replayed onto the provider wire are one
+ thing — a **dialect** — and all four live in
+ `tinyagents::harness::tool_calling::dialect` (`XmlDialect` / `PFormatDialect` /
+ `NativeDialect`). They belong together because a catalogue advertising one
+ grammar next to a parser expecting another is a silent whole-turn failure: the
+ model emits a call, nothing recognises it, the iteration is spent, and no error
+ is logged anywhere.
+
+ `dispatcher.rs` keeps two things and delegates the rest:
+
+ - **The vocabulary.** `ParsedToolCall` / `ToolExecutionResult` are named for
+ ~190 call sites, and `ConversationMessage` is the durable JSONL record on
+ existing installations' disks. The crate speaks its own thin `TranscriptEntry`
+ instead, so the conversions in `dispatcher.rs` are the seam — field-wise maps
+ that keep the wire bytes identical while the logic sits upstream. **A
+ conversion that decides something is a second implementation in disguise; put
+ the judgement in the crate.**
+ - **The `Tool` trait object.** The crate takes `ToolSchema`s, never a host's
+ tool type — same reason the parse seam already documents: depending on
+ OpenHuman's `Tool` would make the crate unusable by a second host.
+
+ Two consequences worth knowing before editing this area:
+
+ - **Executing a tool did not move and will not.** The security policy, approval
+ gate, sandbox, per-call timeout and progress events are OpenHuman's. A dialect
+ decides what the model reads and writes; it never decides what is allowed to
+ happen. That line is what keeps the policy auditable in one place.
+ - **The catalogue has one renderer.** `ToolsSection` calls the crate's
+ `render_pformat_catalogue`, which builds each `Call as:` signature from the
+ same schema its parser reconstructs arguments from — so prompt order and parse
+ order agree by construction. The local copy this replaced carried a comment
+ promising the two "stay in lockstep", which is the shape of a bug waiting to
+ happen, not a guarantee. `humanize_tool_name` and `context_detail_from_args`
+ in `tools/traits.rs` are re-exports/wrappers over the crate for the same
+ reason; only the trimming rule (80 chars, `…`) is OpenHuman's.
+
**Rules:**
- New functionality → dedicated subdirectory (`openhuman/<domain>/mod.rs` + siblings). No new root-level `*.rs` files.