Skip to main content

Module spawn

Module spawn 

Source
Expand description

agents spawn — in-process chunk-or-id streaming handler.

The agent input is the shared AgentSelector — a direct ref (inline / file / python / remote), a tag, or an existing instance. Tags resolve first: BOUND → the live hierarchy (historic case), GROUPED → the group’s stored spec plus the tag threaded into the conduit for the BOUND upgrade, ABSENT → error.

Stream-true (dangerous_advanced.stream = Some(true)): resolve

  • lock + drive the SDK streaming WS connection inside this cli process. The INITIAL lock (try_acquire, failure = error; skipped when dangerous_advanced.skip_lock says a parent already transferred the claim into this process): historic case → the AIH lock, un-upgraded tag case → the tag lock, plain ref → no initial lock. Historic spawns load their agent params + continuation from the stored session. Mid-stream, every newly revealed hierarchy gets a best-effort AIH claim ([AgentInstanceRegistry::observe]); the first success releases the tag claim. End-of-stream: if the hierarchy has undelivered message_queue rows, restart with the latest continuation — restart passes flow into the same output stream.

Stream-false (the default): re-invoke objectiveai-cli agents spawn ... as a detached subprocess with the same arguments plus stream = true (so the resolution + locking above runs in the child), read the first ResponseItem::Id line off the child’s stdout, yield it, and return. The subprocess runs orphaned to completion (Unix: kernel re-parents to init; Windows: DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP keeps it alive past parent exit).

params.stream on the wire is always Some(true); the dangerous_advanced.stream setting only controls cli-side output.

Modules§

request_schema
response_schema

Functions§

execute