Skip to main content

Module runner

Module runner 

Source
Expand description

In-process agent runner — the runtime execution layer (per #1029).

Why: The PM’s delegate_to_agent tool dispatches to an AgentRunner; the M1 harness runs the delegated sub-agent in-process so a delegation cycle is cheap, fully observable, and rolls the sub-agent’s token usage onto the same shared LLM client as the PM. This module is the production implementation of that seam — and RunnerKind::InProcess is the real default backend. What: InProcessAgentRunner (implements tools::AgentRunner), the RegistryFactory DI seam for sub-agent tool assembly, InProcessRunnerConfig (default turn/timeout budget), RunnerError, and agent_config_exists. Each run loads the agent config, gates its tools by tools.allowed, resolves the model + assembled system prompt, drives an AgentLoop, and returns its output. Test: runner::tests::* (stubbed-PM delegation, return-to-PM output, tools.allowed enforcement, usage roll-up) — all offline. Runtime execution layer: the in-process agent runner (issue #1029).

Why: The PM’s delegate_to_agent tool needs a concrete AgentRunner that actually executes a sub-agent. The M1 model-comparison harness runs that sub-agent in-process — same process as the PM — so a delegation cycle is cheap, deterministic to observe, and lets the sub-agent’s token usage accrue onto the same shared LLM client (and thus the PM’s transcript). This module is that runner plus its DI seams. What: Re-exports InProcessAgentRunner (implements crate::tools::AgentRunner), the RegistryFactory trait (how a sub-agent’s tools are assembled), InProcessRunnerConfig (default loop budget), RunnerError (structured library error), and the agent_config_exists helper. Test: runner::tests::* cover the full delegation path offline via a scripted LlmClientTrait mock.

Structs§

InProcessAgentRunner
Runs a delegated sub-agent in-process by driving its own AgentLoop.
InProcessRunnerConfig
Static tuning for an in-process runner’s default loop budget.

Enums§

RunnerError
Failure modes of an in-process agent run.

Traits§

RegistryFactory
Builds the tool registry a sub-agent is allowed to use for one invocation.

Functions§

agent_config_exists
Convenience: discover whether an agent config exists for name under dir.