Skip to content

Agent Supervisor 0.3.0

Version 0.3.0 adds manager-owned background process jobs to the Rust supervisor and the Python Supervisor wrapper. The host application remains the owner of the supervisor; jobs do not move to a separate daemon.

Added

  • Rust Supervisor::start_background() starts a process under a stable SupervisorProcessId. The manager drains bounded stdout and stderr, observes process exit, reaps the child, and retains its final ProcessReceipt.
  • Rust exposes process status/result lookup, waiting, result removal, stdin writes and EOF, per-process shutdown, and awaited shutdown_all().
  • Python Supervisor exposes the corresponding methods. Its SupervisorProcessId compares and hashes by value, and managed results use RunResult with an optional output collection error.
  • Supervisor::start_agent_run() in Rust and Supervisor.start_agent_run() in Python create an AgentRun under the top-level supervisor. Agent-run tools share the supervisor's process registry and are cleaned up with their run; shutdown_all() also cancels active agent runs.
  • The public AgentRunScope type is renamed to AgentRun and is now created by Supervisor rather than constructed independently.
  • Supervisor.stream() in Python and Supervisor::stream() in Rust watch work as one ordered stream of events, for one process, one agent run, or everything on the supervisor. Watching never affects the work. Background jobs can now be followed live, and a late watcher replays retained events. In Rust, converting a SupervisedChild with into_event_stream() publishes its output to watchers; output read directly from raw pipes stays caller-owned.
  • Framework adapters publish the agent's events to the run's stream and read the framework's stream in the background, so supervisor.stream(run=...) shows agent events and tool output together without a second read loop. Each adapter's result exposes agent_run. Rust integrations can use AgentRun::publish_agent_event().
  • Rust and Python examples show multiple jobs, stopping one by ID, inspecting its output and exit result, and awaiting cleanup of the remaining jobs.

Changed

  • The module-level agent_supervisor.stream() is removed. Use Supervisor.start() and iterate the returned Process, calling close_stdin() if the command takes no input. Process.wait() returns its output, and Process.shutdown() stops it. Command.timeout does not apply to start(), so enforce a deadline with asyncio.wait_for().
  • A background job is no longer stopped for exceeding its output limits. Its result keeps the newest bytes and sets output_truncated.
  • Streaming framework adapters now start reading as soon as they are called, rather than when the caller first reads the stream.

Lifecycle and limits

  • Existing Supervisor::start() and Supervisor.start() remain interactive APIs. The caller uses the returned child/Process handle for stdin, output, and final waiting.
  • Background jobs require an active Tokio runtime. The supervisor owns their output draining, exit observation, and reaping; use shutdown_all() before the runtime exits when final results are needed.
  • Dropping the supervisor requests termination of its remaining process trees. Drop is synchronous and cannot return final output or await reaping.
  • One-shot output and output read through the managed interactive event stream are bounded by the command policy. A Rust caller that takes raw pipes owns draining and bounding that output. A background job retains its newest output up to the configured limits. The timeout in a command policy applies to one-shot execution; persistent jobs run until they exit or the host explicitly stops them.
  • Unix shutdown sends a graceful process-group signal and force-stops after the grace period if needed. Windows has no graceful process signal and requests a force-stop immediately.
  • Per-process stop outcomes report the request sent. They do not claim the process exited; use wait_process() or shutdown_all() to obtain the observed final receipt.

Examples and API references