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
impl AgentRegistry
Sourcepub fn new(root: impl AsRef<Path>) -> DevelopmentResult<Self>
pub fn new(root: impl AsRef<Path>) -> DevelopmentResult<Self>
Create a registry rooted at the canonical project directory.
Sourcepub fn set_resident_broker(
&mut self,
broker: ResidentAgentBroker,
) -> DevelopmentResult<()>
pub fn set_resident_broker( &mut self, broker: ResidentAgentBroker, ) -> DevelopmentResult<()>
Configure the authenticated broker used for resident-agent requests.
pub fn set_additional_system_prompt( &mut self, prompt: Option<String>, ) -> DevelopmentResult<()>
Sourcepub fn additional_system_prompt(&self) -> Option<&str>
pub fn additional_system_prompt(&self) -> Option<&str>
Active user-global and trusted-project instructions supplied to Pi.
pub fn set_defaults( &mut self, model: Option<String>, thinking: Option<String>, ) -> DevelopmentResult<()>
Sourcepub fn set_default_unrestricted(&mut self, unrestricted: bool)
pub fn set_default_unrestricted(&mut self, unrestricted: bool)
Make newly created resident agents unrestricted for this process.
Sourcepub fn create(&mut self, spec: AgentSpec) -> DevelopmentResult<AgentId>
pub fn create(&mut self, spec: AgentSpec) -> DevelopmentResult<AgentId>
Validate and enqueue an agent; dependencies must be known and successful.
Sourcepub fn refresh(&mut self) -> DevelopmentResult<()>
pub fn refresh(&mut self) -> DevelopmentResult<()>
Drain worker events, update snapshots, and start newly ready agents.
Sourcepub fn snapshot(&mut self, id: &AgentId) -> DevelopmentResult<AgentSnapshot>
pub fn snapshot(&mut self, id: &AgentId) -> DevelopmentResult<AgentSnapshot>
Return one refreshed agent snapshot or a not-found error.
Sourcepub fn list(&mut self) -> DevelopmentResult<Vec<AgentSnapshot>>
pub fn list(&mut self) -> DevelopmentResult<Vec<AgentSnapshot>>
Return refreshed snapshots for all registered agents.
Sourcepub fn history(&mut self, since: u64) -> DevelopmentResult<Vec<AgentEvent>>
pub fn history(&mut self, since: u64) -> DevelopmentResult<Vec<AgentEvent>>
Return retained events at or after the supplied sequence number.
Sourcepub fn prompt(
&mut self,
id: &AgentId,
text: impl Into<String>,
) -> DevelopmentResult<()>
pub fn prompt( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>
Send an initial prompt to an agent, subject to prompt-size bounds.
pub fn prompt_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>
pub fn steer( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>
pub fn steer_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>
pub fn follow_up( &mut self, id: &AgentId, text: impl Into<String>, ) -> DevelopmentResult<()>
pub fn follow_up_with_context( &mut self, id: &AgentId, text: impl Into<String>, context: Option<Value>, ) -> DevelopmentResult<()>
pub fn approve_tool( &mut self, id: &AgentId, frame_id: impl Into<String>, approved: bool, ) -> DevelopmentResult<()>
pub fn request( &mut self, id: &AgentId, request: PiSessionRequest, ) -> DevelopmentResult<()>
Sourcepub fn complete(&mut self, id: &AgentId) -> DevelopmentResult<()>
pub fn complete(&mut self, id: &AgentId) -> DevelopmentResult<()>
Mark a non-terminal agent complete after its worker settles.
Sourcepub fn cancel(&mut self, id: &AgentId) -> DevelopmentResult<()>
pub fn cancel(&mut self, id: &AgentId) -> DevelopmentResult<()>
Cancel a non-terminal agent and stop its worker.
Sourcepub fn restart(&mut self, id: &AgentId) -> DevelopmentResult<()>
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
impl Drop for AgentRegistry
Source§impl TaskAgentBackend for AgentRegistry
impl TaskAgentBackend for AgentRegistry
fn refresh_agents(&mut self) -> DevelopmentResult<()>
fn create_agent(&mut self, spec: AgentSpec) -> DevelopmentResult<AgentId>
fn agent_snapshots(&mut self) -> DevelopmentResult<Vec<AgentSnapshot>>
fn agent_events(&mut self, since: u64) -> DevelopmentResult<Vec<AgentEvent>>
fn prompt_agent( &mut self, id: &AgentId, prompt: String, ) -> DevelopmentResult<()>
fn cancel_agent(&mut self, id: &AgentId) -> DevelopmentResult<()>
fn complete_agent(&mut self, id: &AgentId) -> DevelopmentResult<()>
Auto Trait Implementations§
impl !RefUnwindSafe for AgentRegistry
impl !Sync for AgentRegistry
impl !UnwindSafe for AgentRegistry
impl Freeze for AgentRegistry
impl Send for AgentRegistry
impl Unpin for AgentRegistry
impl UnsafeUnpin for AgentRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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