Rust SDK for 开源AI工作流 是 AI Skill Hub 本期精选AI工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
Rust SDK for building AI agents with local OpenAI-compatible servers,提供了一个Rust SDK来构建本地OpenAI兼容的AI代理。
Rust SDK for 开源AI工作流 是一款基于 Rust 开发的开源工具,专注于 workflow、llamacpp、llm 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
Rust SDK for building AI agents with local OpenAI-compatible servers,提供了一个Rust SDK来构建本地OpenAI兼容的AI代理。
Rust SDK for 开源AI工作流 是一款基于 Rust 开发的开源工具,专注于 workflow、llamacpp、llm 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:cargo install(推荐) cargo install open-agent-sdk-rust # 方式二:从源码编译 git clone https://github.com/slb350/open-agent-sdk-rust cd open-agent-sdk-rust cargo build --release # 二进制在 ./target/release/open-agent-sdk-rust
# 查看帮助 open-agent-sdk-rust --help # 基本运行 open-agent-sdk-rust [options] <input> # 详细使用说明请查阅文档 # https://github.com/slb350/open-agent-sdk-rust
# open-agent-sdk-rust 配置说明 # 查看配置选项 open-agent-sdk-rust --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export OPEN_AGENT_SDK_RUST_CONFIG="/path/to/config.yml"
Open Agent SDK (Rust) provides a clean, streaming API for working with OpenAI-compatible local model servers. 100% feature parity with the Python SDK—complete with streaming, tool call aggregation, hooks, and automatic tool execution—built on Tokio for high-performance async I/O.
[dependencies]
open-agent-sdk = "0.6.4"
tokio = { version = "1", features = ["full"] }
futures = "0.3"
serde_json = "1.0"
For development:
git clone https://github.com/slb350/open-agent-sdk-rust.git
cd open-agent-sdk-rust
cargo build
use open_agent::{
AgentOptions, Client, Hooks,
PreToolUseEvent, PostToolUseEvent,
HookDecision,
};
// Security gate - block dangerous operations
let hooks = Hooks::new()
.add_pre_tool_use(|event| async move {
if event.tool_name == "delete_file" {
return Some(HookDecision::block("Delete operations require approval"));
}
Some(HookDecision::continue_())
})
.add_post_tool_use(|event| async move {
// Audit logger - track all tool executions
println!("Tool executed: {} -> {:?}", event.tool_name, event.tool_result);
None
});
// Register hooks in AgentOptions
let options = AgentOptions::builder()
.system_prompt("You are a helpful assistant")
.model("qwen2.5-32b-instruct")
.base_url("http://localhost:1234/v1")
.hooks(hooks)
.build()?;
let mut client = Client::new(options)?;
use open_agent::{Client, AgentOptions};
use tokio::time::{timeout, Duration};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let options = AgentOptions::builder()
.system_prompt("You are a helpful assistant.")
.model("qwen2.5-32b-instruct")
.base_url("http://localhost:1234/v1")
.build()?;
let mut client = Client::new(options)?;
client.send("Write a detailed 1000-word essay...").await?;
// Timeout after 5 seconds
match timeout(Duration::from_secs(5), async {
while let Some(block) = client.receive().await? {
// Process blocks
let _ = block;
}
Ok::<_, Box<dyn std::error::Error>>(())
}).await {
Ok(_) => println!("Completed"),
Err(_) => {
client.interrupt(); // Clean cancellation
println!("Operation timed out!");
}
}
// Client is still usable after interrupt
client.send("Short question?").await?;
// Continue using client...
Ok(())
}
Example agents demonstrating real-world usage:
These agents demonstrate:
simple_query.rs – Minimal streaming query (simplest quickstart)calculator_tools.rs – Manual tool execution patternauto_execution_demo.rs – Automatic tool execution patternvision_example.rs – Multimodal image support (URLs, local files, base64)vision_api_demo.rs – Vision API walkthrough with token cost noteshooks_example.rs – Lifecycle hooks patterns (security gates, audit logging)context_management.rs – Manual history management patternsinterrupt_demo.rs – Interrupt capability patterns (timeout, conditional, concurrent)advanced_patterns.rs – Retry logic and concurrent request handlingtest_tool_serialization.rs – Verifies tool call serialization (see examples/test_tool_serialization.rs)AgentOptions::builder()
.system_prompt(str) // System prompt
.model(str) // Model name (required)
.base_url(str) // OpenAI-compatible endpoint (required)
.tool(Tool) // Add a single tool for function calling
.tools(Vec<Tool>) // Add multiple tools at once
.hooks(Hooks) // Lifecycle hooks for monitoring/control
.auto_execute_tools(bool) // Enable automatic tool execution
.max_tool_iterations(u32) // Max tool calls per query in auto mode
.max_tokens(u32) // Tokens to generate (default: 4096)
.max_turns(u32) // Max conversation turns (default: 1)
.temperature(f32) // Sampling temperature (default: 0.7)
.timeout(u64) // Request timeout in seconds (default: 60)
.api_key(str) // API key (default: "not-needed")
.build()?
Build AI agents in Rust using your own hardware
What you can build:
Why local?
How fast? From zero to working agent in under 5 minutes. Rust-native performance (zero-cost abstractions, no GC), fearless concurrency, with 360+ tests.
---
http://localhost:1234/v1http://localhost:11434/v1Note on LM Studio: LM Studio is particularly well-tested with this SDK and provides reliable OpenAI-compatible API support. If you're looking for a user-friendly local model server with excellent compatibility, LM Studio is highly recommended.
#
该项目提供了一个开源的Rust SDK,用于构建本地OpenAI兼容的AI代理,具有很好的扩展性和可定制性,但仍然需要进一步的开发和测试。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,Rust SDK for 开源AI工作流 在AI工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | open-agent-sdk-rust |
| 原始描述 | 开源AI工作流:Rust SDK for building AI agents with local OpenAI-compatible servers (LMStudio, 。⭐20 · Rust |
| Topics | workflowllamacppllmlocalllamalocalllmollamarust |
| GitHub | https://github.com/slb350/open-agent-sdk-rust |
| License | MIT |
| 语言 | Rust |
收录时间:2026-06-06 · 更新时间:2026-06-06 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。