Skip to main content

Module agent_capability

Module agent_capability 

Source
Expand description

Agent capability registry — maps capability id → agents that implement it.

Differs from sibling crate::capabilities (which restricts what tools an agent may call). This registry answers the inverse question: given a capability id from the agent-bundle vocabulary (docs/agent-bundle-spec.mdtranscribe-audio, summarize, etc.), which installed agents implement it?

Used by invoke_capability dispatch (Rust side) and by the host app’s DynamicOptionsProvider (Swift side, via UniFFI’s list_agents).

§Selection strategy

When multiple agents advertise the same capability, [select] picks one in this order:

  1. The caller-provided hint if it names a registered agent.
  2. Most-recently-used agent for the capability.
  3. First registered (insertion order).

This is intentionally simple. A scoring-based selector (latency, quality, cost) belongs in car-inference’s adaptive router, not here — this layer only handles “which agent” once “which model” has already been resolved upstream.

§Persistence

In-memory only for v1. The bundle install path (when it lands) will re-register on each runtime start. Last-used timestamps don’t survive restart — pinning by hint is the durable signal.

Structs§

AgentCapabilityRegistry
Maps capability id → ordered list of agents that implement it.