pub struct AgentCoordinator { /* private fields */ }Expand description
Agent Coordinator
Coordinates multiple agents with task assignment, load balancing, and deadlock detection.
Implementations§
Source§impl AgentCoordinator
impl AgentCoordinator
Sourcepub fn with_heartbeat_timeout(self, secs: i64) -> Self
pub fn with_heartbeat_timeout(self, secs: i64) -> Self
Set heartbeat timeout
Sourcepub fn register_agent(
&mut self,
capabilities: AgentCapabilities,
) -> CoordinatorResult<()>
pub fn register_agent( &mut self, capabilities: AgentCapabilities, ) -> CoordinatorResult<()>
Register an agent
Sourcepub fn unregister_agent(&mut self, agent_id: &str) -> CoordinatorResult<()>
pub fn unregister_agent(&mut self, agent_id: &str) -> CoordinatorResult<()>
Unregister an agent
Sourcepub fn update_agent_status(
&mut self,
agent_id: &str,
status: AgentStatus,
) -> CoordinatorResult<()>
pub fn update_agent_status( &mut self, agent_id: &str, status: AgentStatus, ) -> CoordinatorResult<()>
Update agent status
Sourcepub fn heartbeat(&mut self, agent_id: &str) -> CoordinatorResult<()>
pub fn heartbeat(&mut self, agent_id: &str) -> CoordinatorResult<()>
Update agent heartbeat
Sourcepub fn get_agent(&self, agent_id: &str) -> Option<&AgentCapabilities>
pub fn get_agent(&self, agent_id: &str) -> Option<&AgentCapabilities>
Get agent by ID
Sourcepub fn get_agent_mut(
&mut self,
agent_id: &str,
) -> Option<&mut AgentCapabilities>
pub fn get_agent_mut( &mut self, agent_id: &str, ) -> Option<&mut AgentCapabilities>
Get mutable agent by ID
Sourcepub fn get_agents(&self) -> Vec<&AgentCapabilities>
pub fn get_agents(&self) -> Vec<&AgentCapabilities>
Get all agents
Sourcepub fn get_agents_by_type(&self, agent_type: &str) -> Vec<&AgentCapabilities>
pub fn get_agents_by_type(&self, agent_type: &str) -> Vec<&AgentCapabilities>
Get agents by type
Sourcepub fn get_agents_with_capability(
&self,
capability: &str,
) -> Vec<&AgentCapabilities>
pub fn get_agents_with_capability( &self, capability: &str, ) -> Vec<&AgentCapabilities>
Get agents with capability
Sourcepub fn check_agent_health(&mut self)
pub fn check_agent_health(&mut self)
Check agent health and mark offline if heartbeat timeout
Sourcepub fn assign_task(
&mut self,
task: Task,
criteria: &AssignmentCriteria,
) -> CoordinatorResult<String>
pub fn assign_task( &mut self, task: Task, criteria: &AssignmentCriteria, ) -> CoordinatorResult<String>
Assign a task to an agent based on criteria
Sourcepub fn start_task(&mut self, task_id: &str) -> CoordinatorResult<()>
pub fn start_task(&mut self, task_id: &str) -> CoordinatorResult<()>
Mark a task as started
Sourcepub fn complete_task(
&mut self,
task_id: &str,
result: TaskResult,
) -> CoordinatorResult<()>
pub fn complete_task( &mut self, task_id: &str, result: TaskResult, ) -> CoordinatorResult<()>
Complete a task
Sourcepub fn fail_task(
&mut self,
task_id: &str,
error: String,
) -> CoordinatorResult<()>
pub fn fail_task( &mut self, task_id: &str, error: String, ) -> CoordinatorResult<()>
Fail a task
Sourcepub fn get_task_result(&self, task_id: &str) -> Option<&TaskResult>
pub fn get_task_result(&self, task_id: &str) -> Option<&TaskResult>
Get task result
Sourcepub fn get_agent_tasks(&self, agent_id: &str) -> Vec<&Task>
pub fn get_agent_tasks(&self, agent_id: &str) -> Vec<&Task>
Get tasks assigned to an agent
Sourcepub fn get_pending_tasks(&self) -> Vec<&Task>
pub fn get_pending_tasks(&self) -> Vec<&Task>
Get pending tasks
Sourcepub fn get_running_tasks(&self) -> Vec<&Task>
pub fn get_running_tasks(&self) -> Vec<&Task>
Get running tasks
Sourcepub fn record_resource_dependency(&mut self, agent_id: &str, resource: &str)
pub fn record_resource_dependency(&mut self, agent_id: &str, resource: &str)
Record that an agent is waiting for a resource
Sourcepub fn remove_resource_dependency(&mut self, agent_id: &str, resource: &str)
pub fn remove_resource_dependency(&mut self, agent_id: &str, resource: &str)
Remove a resource dependency
Sourcepub fn record_resource_holder(&mut self, resource: &str, agent_id: &str)
pub fn record_resource_holder(&mut self, resource: &str, agent_id: &str)
Record that an agent holds a resource
Sourcepub fn remove_resource_holder(&mut self, resource: &str)
pub fn remove_resource_holder(&mut self, resource: &str)
Remove a resource holder
Sourcepub fn detect_deadlock(&self) -> Option<DeadlockInfo>
pub fn detect_deadlock(&self) -> Option<DeadlockInfo>
Detect deadlock using cycle detection in the wait-for graph
Sourcepub fn create_sync_barrier(&mut self, agent_ids: Vec<String>) -> String
pub fn create_sync_barrier(&mut self, agent_ids: Vec<String>) -> String
Create a synchronization barrier for agents
Sourcepub fn arrive_at_barrier(
&mut self,
barrier_id: &str,
agent_id: &str,
) -> CoordinatorResult<bool>
pub fn arrive_at_barrier( &mut self, barrier_id: &str, agent_id: &str, ) -> CoordinatorResult<bool>
Agent arrives at a barrier
Sourcepub fn is_barrier_reached(&self, barrier_id: &str) -> bool
pub fn is_barrier_reached(&self, barrier_id: &str) -> bool
Check if all agents have arrived at a barrier
Sourcepub fn remove_barrier(&mut self, barrier_id: &str)
pub fn remove_barrier(&mut self, barrier_id: &str)
Remove a barrier
Sourcepub fn get_pending_agents(&self, barrier_id: &str) -> Vec<String>
pub fn get_pending_agents(&self, barrier_id: &str) -> Vec<String>
Get agents that haven’t arrived at a barrier
Sourcepub fn get_stats(&self) -> CoordinatorStats
pub fn get_stats(&self) -> CoordinatorStats
Get coordinator statistics
Sourcepub fn clear_event_callbacks(&mut self)
pub fn clear_event_callbacks(&mut self)
Clear all event callbacks
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentCoordinator
impl !RefUnwindSafe for AgentCoordinator
impl Send for AgentCoordinator
impl Sync for AgentCoordinator
impl Unpin for AgentCoordinator
impl UnsafeUnpin for AgentCoordinator
impl !UnwindSafe for AgentCoordinator
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.