Repository navigation
Agent Supervisor v0.3.0
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 finalProcessReceipt. - Rust exposes process status/result lookup, waiting, result removal, stdin
writes and EOF, per-process shutdown, and awaitedshutdown_all(). - Python
Supervisorexposes the corresponding methods. Its
SupervisorProcessIdcompares and hashes by value, and managed results use
RunResultwith an optional output collection error. Supervisor::start_agent_run()in Rust andSupervisor.start_agent_run()
in Python create anAgentRununder 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
AgentRunScopetype is renamed toAgentRunand is now created
bySupervisorrather than constructed independently. Supervisor.stream()in Python andSupervisor::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 aSupervisedChildwithinto_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, sosupervisor.stream(run=...)
shows agent events and tool output together without a second read loop.
Each adapter's result exposesagent_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 returnedProcess, calling
close_stdin()if the command takes no input.Process.wait()returns its
output, andProcess.shutdown()stops it.Command.timeoutdoes not apply to
start(), so enforce a deadline withasyncio.wait_for(). - A background job is no longer stopped for exceeding its output limits. Its
result keeps the newest bytes and setsoutput_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()andSupervisor.start()remain interactive
APIs. The caller uses the returned child/Processhandle for stdin, output,
and final waiting. - Background jobs require an active Tokio runtime. The supervisor owns their
output draining, exit observation, and reaping; useshutdown_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; usewait_process()orshutdown_all()to obtain the
observed final receipt.