Skip to main content

AgentRegistry

Struct AgentRegistry 

Source
pub struct AgentRegistry { /* private fields */ }
Expand description

Registry and scheduler for independent Pi subprocesses.

Each running agent owns a distinct Pi process and persistent session. The registry only starts dependency-ready work, bounds all queues and retained evidence, and never silently promotes a failed dependency to success.

Implementations§

Source§

impl AgentRegistry

Source

pub fn new(root: impl AsRef<Path>) -> DevelopmentResult<Self>

Create a registry rooted at the canonical project directory.

Source

pub fn set_resident_broker( &mut self, broker: ResidentAgentBroker, ) -> DevelopmentResult<()>

Configure the authenticated broker used for resident-agent requests.

Source

pub fn set_additional_system_prompt( &mut self, prompt: Option<String>, ) -> DevelopmentResult<()>

Source

pub fn additional_system_prompt(&self) -> Option<&str>

Active user-global and trusted-project instructions supplied to Pi.

Source

pub fn set_defaults( &mut self, model: Option<String>, thinking: Option<String>, ) -> DevelopmentResult<()>

Source

pub fn set_default_unrestricted(&mut self, unrestricted: bool)

Make newly created resident agents unrestricted for this process.

Source

pub fn create(&mut self, spec: AgentSpec) -> DevelopmentResult<AgentId>

Validate and enqueue an agent; dependencies must be known and successful.

Source

pub fn refresh(&mut self) -> DevelopmentResult<()>

Drain worker events, update snapshots, and start newly ready agents.

Source

pub fn snapshot(&mut self, id: &AgentId) -> DevelopmentResult<AgentSnapshot>

Return one refreshed agent snapshot or a not-found error.

Source

pub fn list(&mut self) -> DevelopmentResult<Vec<AgentSnapshot>>

Return refreshed snapshots for all registered agents.

Source

pub fn history(&mut self, since: u64) -> DevelopmentResult<Vec<AgentEvent>>

Return retained events at or after the supplied sequence number.

Source

pub fn prompt( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>

Send an initial prompt to an agent, subject to prompt-size bounds.

Source

pub fn prompt_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>

Source

pub fn steer( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>

Source

pub fn steer_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>

Source

pub fn follow_up( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>

Source

pub fn follow_up_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>

Source

pub fn approve_tool( &mut self, id: &AgentId, frame_id: impl Into<String>, approved: bool, ) -> DevelopmentResult<()>

Source

pub fn request( &mut self, id: &AgentId, request: PiSessionRequest, ) -> DevelopmentResult<()>

Source

pub fn complete(&mut self, id: &AgentId) -> DevelopmentResult<()>

Mark a non-terminal agent complete after its worker settles.

Source

pub fn cancel(&mut self, id: &AgentId) -> DevelopmentResult<()>

Cancel a non-terminal agent and stop its worker.

Source

pub fn restart(&mut self, id: &AgentId) -> DevelopmentResult<()>

Restart a failed or cancelled session under the same agent identity.

Interactive callers keep the selected agent id, so retrying after an aborted or crashed turn should not strand the composer on a terminal worker. Completed sessions remain terminal by design; callers should create a new session when they explicitly finished one.

Trait Implementations§

Source§

impl Drop for AgentRegistry

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl TaskAgentBackend for AgentRegistry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more