pub struct RunAgentClient { /* private fields */ }Expand description
Main client for interacting with RunAgent deployments
Implementations§
Source§impl RunAgentClient
impl RunAgentClient
Sourcepub async fn new(config: RunAgentClientConfig) -> RunAgentResult<Self>
pub async fn new(config: RunAgentClientConfig) -> RunAgentResult<Self>
Create a new RunAgent client from configuration
This is the single entry point for creating clients.
§Examples
use runagent::{RunAgentClient, RunAgentClientConfig};
use std::env;
#[tokio::main]
async fn main() -> runagent::RunAgentResult<()> {
// Local agent with explicit address
let client = RunAgentClient::new(RunAgentClientConfig::new("agent-id", "entrypoint")
.with_local(true)
.with_address("127.0.0.1", 8450)
.with_enable_registry(false)
).await?;
// Remote agent
let client = RunAgentClient::new(RunAgentClientConfig::new("agent-id", "entrypoint")
.with_api_key(env::var("RUNAGENT_API_KEY").unwrap_or_else(|_| "key".to_string()))
).await?;
Ok(())
}Sourcepub async fn run(&self, input_kwargs: &[(&str, Value)]) -> RunAgentResult<Value>
pub async fn run(&self, input_kwargs: &[(&str, Value)]) -> RunAgentResult<Value>
Run the agent with keyword arguments only
Sourcepub async fn run_with_args(
&self,
input_args: &[Value],
input_kwargs: &[(&str, Value)],
) -> RunAgentResult<Value>
pub async fn run_with_args( &self, input_args: &[Value], input_kwargs: &[(&str, Value)], ) -> RunAgentResult<Value>
Run the agent with the given input
Sourcepub async fn run_stream(
&self,
input_kwargs: &[(&str, Value)],
) -> RunAgentResult<Pin<Box<dyn Stream<Item = RunAgentResult<Value>> + Send>>>
pub async fn run_stream( &self, input_kwargs: &[(&str, Value)], ) -> RunAgentResult<Pin<Box<dyn Stream<Item = RunAgentResult<Value>> + Send>>>
Run the agent and return a stream of responses
Sourcepub async fn run_stream_with_args(
&self,
input_args: &[Value],
input_kwargs: &[(&str, Value)],
) -> RunAgentResult<Pin<Box<dyn Stream<Item = RunAgentResult<Value>> + Send>>>
pub async fn run_stream_with_args( &self, input_args: &[Value], input_kwargs: &[(&str, Value)], ) -> RunAgentResult<Pin<Box<dyn Stream<Item = RunAgentResult<Value>> + Send>>>
Run the agent with streaming and both positional and keyword arguments
Sourcepub async fn get_agent_architecture(&self) -> RunAgentResult<Value>
pub async fn get_agent_architecture(&self) -> RunAgentResult<Value>
Get the agent’s architecture information
Sourcepub async fn health_check(&self) -> RunAgentResult<bool>
pub async fn health_check(&self) -> RunAgentResult<bool>
Check if the agent is available
Sourcepub fn entrypoint_tag(&self) -> &str
pub fn entrypoint_tag(&self) -> &str
Get entrypoint tag
Auto Trait Implementations§
impl Freeze for RunAgentClient
impl !RefUnwindSafe for RunAgentClient
impl Send for RunAgentClient
impl Sync for RunAgentClient
impl Unpin for RunAgentClient
impl !UnwindSafe for RunAgentClient
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
Mutably borrows from an owned value. Read more
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>
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 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>
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