| Crates.io | runagent |
| lib.rs | runagent |
| version | 0.1.1 |
| created_at | 2025-07-11 10:48:27.447574+00 |
| updated_at | 2025-07-11 10:53:55.920244+00 |
| description | RunAgent SDK for Rust - Deploy and manage AI agents easily |
| homepage | https://runagent.ai |
| repository | https://github.com/runagent-dev/runagent |
| max_upload_size | |
| id | 1747665 |
| size | 353,614 |
RunAgent is a comprehensive Rust SDK for deploying and managing AI agents with support for multiple frameworks including LangChain, LangGraph, LlamaIndex, and more. Whether you're building chatbots, autonomous agents, or complex AI workflows, RunAgent provides the tools you need to deploy, test, and scale your AI applications.
cargo add runagent tokio
Or add manually to Cargo.toml:
[dependencies]
runagent = "0.1.0"
tokio = { version = "1.35", features = ["full"] }
use runagent::prelude::*;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
runagent::init_logging();
let client = RunAgentClient::new("my-agent-id", "generic", true).await?;
let response = client.run(&[
("message", json!("Hello, world!")),
("temperature", json!(0.7))
]).await?;
println!("Response: {}", response);
Ok(())
}
use runagent::prelude::*;
use futures::StreamExt;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = RunAgentClient::new("my-agent-id", "generic_stream", true).await?;
let mut stream = client.run_stream(&[
("message", json!("Tell me a story"))
]).await?;
while let Some(chunk) = stream.next().await {
match chunk {
Ok(data) => println!("Chunk: {}", data),
Err(e) => eprintln!("Stream error: {}", e),
}
}
Ok(())
}
# API Configuration
export RUNAGENT_API_KEY="your-api-key"
export RUNAGENT_BASE_URL="https://api.runagent.ai"
# Local Configuration
export RUNAGENT_CACHE_DIR="~/.runagent"
export RUNAGENT_LOGGING_LEVEL="info"
use runagent::RunAgentConfig;
let config = RunAgentConfig::new()
.with_api_key("your-api-key")
.with_base_url("https://api.runagent.ai")
.with_logging()
.build();
use runagent::prelude::*;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = RunAgentClient::new("langchain-agent", "invoke", true).await?;
let response = client.run(&[
("input", json!({
"messages": [
{"role": "user", "content": "What is the weather like?"}
]
}))
]).await?;
println!("LangChain response: {}", response);
Ok(())
}
use runagent::prelude::*;
use serde_json::json;
use futures::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = RunAgentClient::new("langgraph-agent", "stream", true).await?;
let mut stream = client.run_stream(&[
("input", json!({
"messages": [{"role": "user", "content": "Analyze this data"}]
}))
]).await?;
while let Some(chunk) = stream.next().await {
match chunk {
Ok(data) => {
if let Some(node) = data.get("node") {
println!("Executing node: {}", node);
}
}
Err(e) => eprintln!("Error: {}", e),
}
}
Ok(())
}
Enable or disable features in Cargo.toml:
[dependencies]
runagent = { version = "0.1.0", features = ["db", "server"] }
Available:
db (default): Enable database supportserver (default): Enable local serverRunAgentClientnew(agent_id, entrypoint_tag, local)run(input_kwargs)run_stream(input_kwargs)health_check()LocalServernew(agent_id, agent_path, host, port)from_path(agent_path, host, port)start()get_info()DatabaseServicenew(db_path)add_agent(agent)list_agents()get_capacity_info()use runagent::{RunAgentError, RunAgentResult};
fn handle_errors() -> RunAgentResult<()> {
match some_operation() {
Ok(result) => Ok(result),
Err(RunAgentError::Authentication { message }) => {
eprintln!("Auth error: {}", message);
Err(RunAgentError::authentication("Invalid credentials"))
}
Err(RunAgentError::Connection { message }) => {
eprintln!("Connection error: {}", message);
if err.is_retryable() {
retry_operation()
} else {
Err(err)
}
}
Err(e) => Err(e),
}
}
cargo test
cargo test --all-features
cargo test --test integration
See examples/ folder for:
We welcome contributions! See CONTRIBUTING.md for guidelines.
git clone https://github.com/runagent-dev/runagent.git
cd runagent/runagent-rust
cargo build
cargo test
This project is licensed under the MIT License - see the LICENSE file.
Need help? Join our Discord or check the documentation!