pub struct AgentService;Expand description
Service for agent-related operations.
Implementations§
Source§impl AgentService
impl AgentService
Sourcepub async fn spawn(
town: &Town,
name: &str,
cli: Option<&str>,
) -> Result<SpawnResult>
pub async fn spawn( town: &Town, name: &str, cli: Option<&str>, ) -> Result<SpawnResult>
Spawn a new agent.
Sourcepub 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>
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).
Sourcepub async fn list(town: &Town) -> Result<Vec<AgentInfo>>
pub async fn list(town: &Town) -> Result<Vec<AgentInfo>>
List all agents with their current status.
Sourcepub async fn status(town: &Town) -> Result<TownStatus>
pub async fn status(town: &Town) -> Result<TownStatus>
Get town status including all agents.
Sourcepub async fn kill(channel: &Channel, agent_id: AgentId) -> Result<()>
pub async fn kill(channel: &Channel, agent_id: AgentId) -> Result<()>
Kill (stop) an agent gracefully.
Sourcepub async fn stop_all(town: &Town) -> Result<Vec<Agent>>
pub async fn stop_all(town: &Town) -> Result<Vec<Agent>>
Request all non-terminal agents in a town to stop gracefully.
Sourcepub async fn restart(channel: &Channel, agent_id: AgentId) -> Result<()>
pub async fn restart(channel: &Channel, agent_id: AgentId) -> Result<()>
Restart a stopped agent.
Sourcepub async fn interrupt(channel: &Channel, agent_id: AgentId) -> Result<()>
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.
Sourcepub async fn wait(
channel: &Channel,
agent_id: AgentId,
timeout: Option<Duration>,
) -> Result<Agent>
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.
Sourcepub async fn resume(channel: &Channel, agent_id: AgentId) -> Result<()>
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.
Sourcepub async fn close(channel: &Channel, agent_id: AgentId) -> Result<()>
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.
Auto Trait Implementations§
impl Freeze for AgentService
impl RefUnwindSafe for AgentService
impl Send for AgentService
impl Sync for AgentService
impl Unpin for AgentService
impl UnsafeUnpin for AgentService
impl UnwindSafe for AgentService
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
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