Skip to main content

spawn_dyn_agent

Function spawn_dyn_agent 

Source
pub async fn spawn_dyn_agent(
    harness: &dyn DynAgentHarness,
    spec: AgentRunSpec,
    event_sender: ActivityEventSender,
    control_receiver: Option<ControlReceiver>,
) -> Result<DispatchOutcome, HarnessError>
Expand description

Drives one activity attempt through an ERASED DynAgentHarness — the same harness-blind driver as spawn_agent, but over a dyn harness a worker can HOLD without being generic (the typed AgentHarness is not object-safe).

Behaviour is identical to spawn_agent: it starts the harness, concurrently pumps the session’s events to event_sender and feeds control_receiver commands to the session, and maps the terminal result into DispatchOutcome::Completed. The only difference is the erased session type, so the whole event/intervention contract (§4.1 result/event split, capability gating, stale-target no-op) holds unchanged.

§Errors

Returns HarnessError when the harness cannot be started or the terminal result cannot be received — same taxonomy as spawn_agent.