DeepStrike Rust SDK
Build Rust Agents with providers, typed tools, durable sessions, Memory, Skills, Knowledge, governance, and bounded evaluation loops.
Use RuntimeRunner when an Agent needs streaming events, durable session recovery, tool control, or host-provided integrations.
Add to your project
[]
= "0.2"
= { = "1", = ["full"] }
= "0.3"
= "1"
Quick start
use Arc;
use ;
async
Streaming via RuntimeRunner::run_streaming:
use ;
use StreamExt;
let mut stream = runner.run_streaming.await?;
while let Some = stream.next.await
Providers
| Constructor | Backend |
|---|---|
OpenAIProvider::new(api_key) |
OpenAI API |
OpenAIProvider::with_base_url(key, model, url) |
Any OpenAI-compatible endpoint |
AnthropicProvider::new(api_key) |
Anthropic API |
qwen(api_key) |
DashScope (通义千问) |
deepseek(api_key) |
DeepSeek API |
minimax(api_key) |
MiniMax API |
ollama(model) |
Local Ollama |
kimi(api_key) |
Moonshot Kimi |
Custom providers: implement the LLMProvider trait.
Context model (four slots)
| Slot | Source | Role |
|---|---|---|
system_stable |
system partition | Identity — never changes within a run |
system_knowledge |
knowledge partition | Preloaded memory — low frequency |
turns[0] |
task_state + signals |
Goal, plan, compression log, runtime signals |
turns[1..N] |
history | Conversation — sole compression target |
Set system_prompt for stable instructions and initial_memory for durable preloaded context in the complete RuntimeOptions value above.
See docs/concepts/context-slots-compression.md.
RuntimeOptions
The most frequently configured fields are provider, execution_plane, session_log,
max_tokens, max_turns, skill_dir, knowledge_source, memory_store, agent_id,
resource_quota, memory_policy, governance, and signal_source. Construct the complete
RuntimeOptions value as in the quick start, then set the fields that fit your Agent.
Tools
use ;
let mut plane = new;
plane.register;
plane.register;
plane.unregister;
let mut gov = allow;
gov.block_tool;
Skills
Set skill_dir — the kernel auto-injects a skill meta-tool, and the LLM loads skills by name on demand.
Set skill_dir: Some("./skills".into()) in the complete RuntimeOptions value. The Agent can then load Skills by name on demand.
Knowledge
Implement KnowledgeSource — the kernel injects a knowledge meta-tool. Runtime retrieval → history; durable preload → Slot 2 via initial_memory.
use async_trait;
;
Memory
WorkingMemory (SDK-side scratch pad)
SDK helper — not the removed kernel working partition.
use WorkingMemory;
let mut mem = default;
mem.set;
mem.get; // Some(&json!(1))
mem.clear;
MemoryStore (durable long-term memory)
// In-session: memory(query) → history tool result
// Preload: initial_memory → Slot 2
// Post-session: the runner saves the transcript and extracts durable records.
Governance
SDK PermissionManager
use ;
let mut pm = new;
pm.grant;
pm.revoke;
pm.grant_with_approval;
Kernel GovernancePipeline
use GovernancePipeline;
use ;
let mut pipeline = new;
pipeline.permission.add_rule;
pipeline.veto.block_tool;
pipeline.rate_limiter.set_limit;
// Permission → Veto → RateLimit → Constraint → Audit
Signals
Provide a SignalSource through signal_source in the complete RuntimeOptions value. Call
runner.interrupt() when the application needs to stop the active run immediately.
Harness (evaluation framework)
use *;
let body = new;
let judge = new;
let attempt_loop = new?;
let mut request = generated;
request.criteria = vec!;
let outcome = attempt_loop.run.await?;
println!;
Stream events
| Variant | Fields |
|---|---|
TextDelta(String) |
text chunk |
ThinkingDelta(String) |
reasoning chunk |
ToolCall { id, name } |
tool invoked |
ToolResult { call_id, content, is_error } |
tool output |
Done { iterations, total_tokens, status } |
run complete |
Error(String) |
non-fatal error |
status: completed · max_turns · token_budget · timeout · user_abort · error