1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Deep Agent with directory-based skills (progressive disclosure).
//!
//! Aligned with [Deep Agent Skills](https://docs.langchain.com/oss/python/deepagents/skills).
//! Each skill is a directory containing `SKILL.md` with YAML frontmatter (name, description).
//! Only frontmatter is read at startup; when the user message matches a skill, its full
//! content is loaded and injected into context for that turn.
//!
//! Run with:
//! ```bash
//! cargo run --example deep_agent_skills
//! ```
use std::path::PathBuf;
use oris_runtime::{
agent::{create_deep_agent, DeepAgentConfig},
chain::Chain,
prompt_args,
schemas::messages::Message,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
// Path to skills directory (each subdir can contain SKILL.md with frontmatter)
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string());
let skills_dir: PathBuf = [&manifest_dir, "examples", "skills"].iter().collect();
let config = DeepAgentConfig::new()
.with_planning(true)
.with_filesystem(false)
.with_skill_dir(skills_dir);
let agent = create_deep_agent(
"gpt-4o-mini",
&[],
Some("You are a helpful assistant. Use Skills when they are injected."),
config,
)?;
println!("=== Deep Agent with progressive skills ===\n");
// This prompt should match the graph-docs skill (description mentions state graphs)
let result = agent
.invoke(prompt_args! {
"messages" => vec![
Message::new_human_message("What is the graph API? Do you have a skill loaded for it?")
]
})
.await?;
println!("Response: {}\n", result);
Ok(())
}