Skip to main content

AgentService

Struct AgentService 

Source
pub struct AgentService;
Expand description

Service for agent-related operations.

Implementations§

Source§

impl AgentService

Source

pub async fn spawn( town: &Town, name: &str, cli: Option<&str>, ) -> Result<SpawnResult>

Spawn a new agent.

Source

pub async fn spawn_with_metadata( town: &Town, name: &str, cli: Option<&str>, role_id: Option<&str>, nickname: Option<&str>, parent_agent_id: Option<AgentId>, spawn_mode: Option<SpawnMode>, ) -> Result<SpawnResult>

Spawn a new agent with extended metadata (role, nickname, parent).

Source

pub async fn list(town: &Town) -> Result<Vec<AgentInfo>>

List all agents with their current status.

Source

pub async fn status(town: &Town) -> Result<TownStatus>

Get town status including all agents.

Source

pub async fn kill(channel: &Channel, agent_id: AgentId) -> Result<()>

Kill (stop) an agent gracefully.

Source

pub async fn stop_all(town: &Town) -> Result<Vec<Agent>>

Request all non-terminal agents in a town to stop gracefully.

Source

pub async fn restart(channel: &Channel, agent_id: AgentId) -> Result<()>

Restart a stopped agent.

Source

pub async fn prune(town: &Town, all: bool) -> Result<Vec<Agent>>

Prune stopped/stale agents.

Source

pub async fn interrupt(channel: &Channel, agent_id: AgentId) -> Result<()>

Interrupt (pause) a running agent.

Sets the agent’s state to Paused. The agent will not pick up new work until resumed.

Source

pub async fn wait( channel: &Channel, agent_id: AgentId, timeout: Option<Duration>, ) -> Result<Agent>

Wait for an agent to reach a terminal state.

Polls the agent state at 1-second intervals until the agent is in a terminal state or the timeout expires. Returns the final agent state.

Source

pub async fn resume(channel: &Channel, agent_id: AgentId) -> Result<()>

Resume a paused agent.

Sets the agent’s state back to Idle so it can accept new work.

Source

pub async fn close(channel: &Channel, agent_id: AgentId) -> Result<()>

Close an agent: drain its current work and then stop.

Sets the agent to Draining state, which means it will finish its current task but won’t accept new work. Then requests a stop.

Source

pub async fn list_open(town: &Town) -> Result<Vec<AgentInfo>>

List all agents that are not in a terminal state.

Source

pub async fn get_result( channel: &Channel, agent_id: AgentId, ) -> Result<Option<Task>>

Get the result of an agent’s most recently completed task.

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<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> 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 = Infallible

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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,