Skip to main content

AgentNetworkClient

Struct AgentNetworkClient 

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

MCP relay client that communicates with a subprocess over stdio.

Implementations§

Source§

impl AgentNetworkClient

Source

pub async fn spawn_agent( &mut self, description: &str, working_dir: &str, config: AgentConfig, ) -> Result<String, AgentNetworkClientError>

Spawn a new agent with the given description and config.

Source

pub async fn await_agent( &mut self, agent_id: &str, timeout_secs: Option<u64>, ) -> Result<AgentResult, AgentNetworkClientError>

Wait for an agent to complete, with optional timeout.

Source

pub async fn list_agents( &mut self, ) -> Result<Vec<AgentInfo>, AgentNetworkClientError>

List all agents.

Source

pub async fn stop_agent( &mut self, agent_id: &str, ) -> Result<(), AgentNetworkClientError>

Stop a running agent by ID.

Source

pub async fn get_agent_status( &mut self, agent_id: &str, ) -> Result<AgentInfo, AgentNetworkClientError>

Get the current status of an agent by ID.

Source§

impl AgentNetworkClient

Source

pub async fn connect( binary_path: &str, ) -> Result<AgentNetworkClient, AgentNetworkClientError>

Connect to a relay process using default MCP server arguments.

Source

pub async fn connect_with_args( binary_path: &str, args: &[&str], ) -> Result<AgentNetworkClient, AgentNetworkClientError>

Connect to a relay process with custom arguments.

Source

pub async fn send_request( &mut self, method: &str, params: Option<Value>, ) -> Result<Value, AgentNetworkClientError>

Send a JSON-RPC request and read the response.

Source

pub async fn initialize(&mut self) -> Result<Value, AgentNetworkClientError>

Perform the MCP initialize handshake with the relay process.

Source

pub async fn call_tool( &mut self, name: &str, args: Value, ) -> Result<Value, AgentNetworkClientError>

Call a tool on the relay server by name with the given arguments.

Source

pub async fn list_tools(&mut self) -> Result<Value, AgentNetworkClientError>

List all tools available on the relay server.

Source

pub async fn shutdown(self) -> Result<(), AgentNetworkClientError>

Shut down the relay client and terminate the child process.

Source

pub fn is_initialized(&self) -> bool

Check whether the client has completed initialization.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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> 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