The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(toolpacks): add README for toolpacks module
Steven Enamakele86ae6b1aa75
diff --git a/crates/openhuman-core/src/tools/toolpacks/README.md b/crates/openhuman-core/src/tools/toolpacks/README.mdindex 09cd4e6317..458f72d440 100644--- a/crates/openhuman-core/src/tools/toolpacks/README.md+++ b/crates/openhuman-core/src/tools/toolpacks/README.md@@ -9,35 +9,45 @@ constructed and executable but unadvertised: the agent sees one small tool,## How it works-- [`types::ToolPack`] is the unit: an `id`, a one-line `summary` shown in the+- `types::ToolPack` is the unit: an `id`, a one-line `summary` shown in thealways-on pack index, the `tools` it owns, and `owners` — agent ids the pack- is *not* applied to, because the specialist that a family was delegated to- (e.g. `settings_agent` for `system`) should not pay a `use_skill` round trip- on every call of its own belt.-- [`registry::PACKS`] is the compiled-in table. Membership is a build-time- decision on purpose: a pack config or RPC could edit would let a caller move- a dangerous tool out of the reviewed, advertised surface without review.- `registry::pack`, `pack_for_tool`, `all_packed_tool_names`,- `packed_tool_names_for_agent`, and the two `pack_index_markdown*` /- `callable_pack_ids` helpers all read this table.-- [`tools::UseSkillTool`] (name constant `USE_SKILL = "use_skill"`) is the one- always-on proxy tool. Called with `skill` alone it renders that pack's tool- schemas into the conversation (`render_pack_filtered`); called with `skill` +- `tool` + `args` it resolves and executes the real tool, forwarding- permission level, timeout policy, and external-effect classification so- nothing is laundered through the proxy. [`tools::PackRegistryHandle`] is the- late-bound, non-owning (`Weak`) view into the agent's tool registries the- proxy dispatches through — two of them (durable + `synthesized_tools`),- since `delegate_*` tools live in the second and both must be rebound after- every registry rebuild (see `ops::bind_pack_registry` /- `ops::bind_synthesized_pack_registry` doc comments for the exact call- points and staleness failure mode).-- [`ops::strip_packed_from_visible`] does the actual compression: it removes- a pack's tool names from an agent's advertised `visible` set and adds- `use_skill` back in only if something was actually withheld.- [`ops::is_withheld_from`] exposes the same predicate for callers building a- tool *listing* rather than mutating a `visible` set (the collapsed- `delegate_to` tool).+ is *not* applied to, because the specialist a family was delegated to+ (`settings_agent` for `system`, `skill_executor` for `skills`, ...) should+ not pay a `use_skill` round trip on every call of its own belt.+- `registry::PACKS` is the compiled-in table. Membership is a build-time+ decision on purpose: a pack that config or RPC could edit would let a caller+ move a dangerous tool out of the reviewed, advertised surface.+ `pack`, `pack_for_tool`, `all_packed_tool_names`,+ `packed_tool_names_for_agent`, `pack_index_markdown[_filtered]`, and+ `callable_pack_ids` all read this table. The `pub(crate)`+ `DELIBERATELY_UNPACKED_FLEET_TOOLS` list names the delegation family that is+ kept *off* packs because it is used on almost every turn;+ `agent/orchestration/tools/collapsed_delegation.rs` collapses that family+ into `delegate_to` instead and explains the trade.+- `tools::UseSkillTool` (`USE_SKILL = "use_skill"`) is the one always-on proxy+ tool. Called with `skill` alone it renders that pack's tool schemas into the+ conversation; with `skill` + `tool` + `args` it resolves the real tool+ (refusing a tool that the named pack does not own) and forwards+ `permission_level[_with_args]`, `timeout_policy`, and+ `external_effect_with_args` to it, so nothing is laundered through the+ proxy. The tool's own `execute` path renders the pack unfiltered; the+ session-scoped listing (`render_pack_filtered` + `route_sentence`) is+ produced by the tinyagents policy middleware, which is the only layer that+ holds the session (see below).+- `tools::PackRegistryHandle` is the late-bound, non-owning (`Weak`) view the+ proxy dispatches through. It holds two registries — the durable tool `Arc`+ and the agent's `synthesized_tools` `Arc`, where every `delegate_*` tool+ lives — and each must be rebound after its `Arc` is replaced, or packed+ tools degrade to "skill unavailable" / "no tool in skill". The handle rides+ on `Tool::host_extension` and is read back by+ `tools::traits::pack_registry_handle`.+- `ops::strip_packed_from_visible` does the actual compression: it removes a+ pack's tool names from an agent's advertised `visible` set (only those whose+ group is `Withheld`) and adds `use_skill` back in only if something was+ actually withheld. An empty `visible` set is the harness's "everything+ visible" sentinel and is left alone. `ops::is_withheld_from` exposes the+ same predicate for a caller building a tool *listing* rather than a+ `visible` set; nothing in-tree calls it today.**Why a proxy instead of dynamic registration.** Registering the real schemasmid-turn would be better (native tool calling, no nested `args` object), but@@ -48,9 +58,9 @@ the upstream change that would retire this proxy.## `ToolGroups`-[`groups::ToolGroups`] (fixed-size array, `GROUP_COUNT = PACKS.len()`) is the+`groups::ToolGroups` (fixed-size array, `GROUP_COUNT = PACKS.len()`) is the`CoreBuilder`-facing narrowing control referenced from `AGENTS.md` ("tool-visibility with `ToolGroups`"). Per pack it holds a [`groups::GroupMode`]:+visibility with `ToolGroups`"). Per pack it holds a `groups::GroupMode`:| Mode | Schemas on the wire | Registered and callable || --- | --- | --- |@@ -58,39 +68,58 @@ visibility with `ToolGroups`"). Per pack it holds a [`groups::GroupMode`]:| `Withheld` (default) | no, reached via `use_skill` | yes || `Off` | no | no |-`ToolGroups::default()`/`packed()` puts every pack in `Withheld` — exactly the-compiled-in behavior before this type existed, so a host that never calls-`CoreBuilder::tool_groups` is unaffected. This axis only narrows: a pack-compiled out by a Cargo feature, or off under the ambient `DomainSet`, stays-absent regardless of the mode set here. `groups::current()` reads the ambient-`ToolGroups` off `CoreContext`, falling back to `Withheld`-everywhere when-there is no context (unit tests, pre-boot CLI paths).+`ToolGroups::default()` / `packed()` puts every pack in `Withheld` — exactly+the compiled-in behavior before this type existed, so a host that never calls+`CoreBuilder::tool_groups` is unaffected. `advertised()`, `none()`, and+`with(id, mode)` are the other constructors; an unknown id in `with` is+logged and ignored, and a tool that belongs to no pack always reports+`Advertised`. This axis only narrows: a pack compiled out by a Cargo feature,+or off under the ambient `DomainSet`, stays absent regardless of the mode set+here. `groups::current()` reads the ambient `ToolGroups` off `CoreContext`,+falling back to `Withheld`-everywhere when there is no context (unit tests,+pre-boot CLI paths).## Name collision-`use_skill` here is the tool-pack disclosure proxy in this module. It is-unrelated to `skills::runtime::run_skill`, which is itself one of the tools-packed under the `skills` pack (see `registry::PACKS`) — do not conflate the-two when tracing a `run_skill` call.+`use_skill` is the tool-pack disclosure proxy in this module. `run_skill` is+a different thing: the synthesized delegate into the `skill_executor` agent+(`delegate_name = "run_skill"` in+`skills/runtime/agent/skill_executor/agent.toml`), which is itself one of the+tools packed under the `skills` pack. A `run_skill` call that arrives through+`use_skill { skill: "skills", tool: "run_skill" }` is this proxy dispatching+to that delegate, not a second skill runtime.## Called by-- `crates/openhuman-core/src/tools/ops.rs` — registers `use_skill` into the- default/all tool registries.-- `crates/openhuman-core/src/core/runtime/builder.rs` and- `crates/openhuman-core/src/core/runtime/context.rs` — `CoreBuilder::tool_groups`- plumbing and the ambient `ToolGroups` on `CoreContext`.-- `crates/openhuman-core/src/agent/harness/session/builder/` — binds the pack- registry (durable and synthesized) when an agent's tool `Arc`s are built or- rebuilt, and strips packed names from the agent's visible set.-- `crates/openhuman-core/src/agent/orchestration/tools/collapsed_delegation.rs`- — consults `is_withheld_from` so a collapsed `delegate_to` listing never- re-advertises a route the pack table withholds.-- `crates/openhuman-embed/` — `Harness` builders expose `ToolGroups` to- embedding hosts.+- `tools/ops.rs` — `all_tools_with_runtime` drops every tool whose group is+ `Off`, then appends `use_skill` via `append_pack_tools`.+- `tools/traits.rs` — `pack_registry_handle` reads the handle back off a+ tool's `host_extension`.+- `core/runtime/builder.rs` and `core/runtime/context.rs` —+ `CoreBuilder::tool_groups` and the ambient `ToolGroups` on `CoreContext`.+- `agent/harness/session/builder/` — `builder_build.rs` strips packed names+ from the agent's visible set and binds both registries once the tool `Arc`s+ exist; `mod.rs` calls `scope_use_skill_spec` so the advertised `use_skill`+ spec lists only packs this session can call something in, and drops the+ spec entirely when that is none.+- `agent/harness/session/turn/tools.rs` — rebinds the synthesized registry+ after every delegation refresh and re-strips packed names;+ `agent/harness/session/runtime_impl_01_part_01.rs` re-strips after+ materializing the visible set.+- `agent/tinyagents/middleware_part_03.rs` / `middleware_part_07.rs` — after+ the permission gates, intercepts the disclosure half of a `use_skill` call+ (`named_tool` is `None`) and renders it with `render_pack_filtered` against+ the session's allowlist, with `route_sentence` naming the owner delegate+ when nothing in the pack is callable.+- `agent/registry/agents/orchestrator/prompt.rs` — `pack_for_tool` to tell+ the orchestrator which pack a withheld delegate lives in.+- `crates/openhuman-embed/` — re-exports `GroupMode` and `ToolGroups` and+ exposes `Harness::builder().tool_groups(..)`.## Tests-`toolpacks_tests.rs` and `toolpacks_tests_part_02_tests.rs` (pack table-invariants, `strip_packed_from_visible`, `render_pack_filtered` behavior);-`groups_tests.rs` (`GroupMode` defaults and narrowing rules).+`toolpacks_tests.rs` (pack-table invariants, owner rules,+`strip_packed_from_visible`, `use_skill` dispatch and permission / timeout /+effect forwarding, dual-registry binding) and its `toolpacks_tests_part_02_tests.rs`+(`scope_use_skill_spec`, `render_pack_filtered` filtering, `route_sentence`,+rebinding); `groups_tests.rs` (`GroupMode` defaults and narrowing rules).