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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//! # radkit
//!
//! A Rust SDK for building AI agents that run on native and WASM targets.
//!
//! ## Overview
//!
//! radkit provides:
//! - **Agent Runtime**: Execute agents with skills and tool calling
//! - **LLM Integration**: Unified interface for multiple LLM providers
//! - **Tool System**: Extensible tool/function calling framework
//! - **Cross-Platform**: Native (tokio) and WASM (single-threaded) support
//! - **Type Safety**: Strong types with comprehensive error handling
//!
//! ## Quick Start
//!
//! ```ignore
//! use radkit::agent::Agent;
//! use radkit::runtime::RuntimeHandle;
//! use radkit::tools::{FunctionTool, ToolResult};
//! use serde_json::json;
//!
//! // Create a simple agent
//! let agent = Agent::builder()
//! .with_name("My Agent")
//! .build();
//!
//! // Define tools
//! let tool = FunctionTool::new(
//! "get_weather",
//! "Get weather for a location",
//! |args, _ctx| Box::pin(async move {
//! ToolResult::success(json!({"temp": 72}))
//! })
//! );
//!
//! // Create a runtime
//! # let llm = radkit::test_support::FakeLlm::with_responses("demo", std::iter::empty());
//! let runtime = RuntimeHandle::builder(agent, llm).build();
//! ```
//!
//! ## Feature Flags
//!
//! radkit uses feature flags to control optional dependencies:
//! - (Features will be documented as they're added)
//!
//! ## Platform Support
//!
//! - **Native** (Linux, macOS, Windows): Full async runtime with tokio
//! - **WASM** (wasm32-wasi, wasm32-unknown-unknown): Single-threaded execution
//!
//! ## Architecture
//!
//! - [`agent`]: Agent definitions and builders
//! - [`tools`]: Tool system for function calling
//! - [`runtime`]: Runtime services and execution
//! - [`errors`]: Typed error handling
//! - [`compat`]: Cross-platform compatibility layer
/// Re-exported procedural macros (e.g., `radkit::macros::skill!`).
pub use crate;
// Re-export tryparse for derive macro path resolution.
// This allows external crates to use `radkit::tryparse` instead of adding
// tryparse as a direct dependency. The tryparse-derive macro uses
// proc-macro-crate to find this re-export.
pub use tryparse as __private_tryparse;
/// Re-exported tryparse crate for parsing LLM outputs.
///
/// This module re-exports the `tryparse` crate, allowing users of radkit
/// to parse LLM outputs without adding `tryparse` as a direct dependency.
///
/// # Example
///
/// ```ignore
/// use radkit::macros::LLMOutput;
/// use radkit::tryparse;
/// use serde::Deserialize;
///
/// #[derive(Deserialize, LLMOutput)]
/// struct UserData {
/// name: String,
/// age: u32,
/// }
///
/// // Parse LLM output with fuzzy matching
/// let data: UserData = tryparse::parse_llm(llm_response)?;
/// ```
pub use tryparse;
/// Embeds an `AgentSkill` directory into the binary at compile time.
///
/// Reads `SKILL.md` from the given path (relative to the crate root),
/// validates the frontmatter, and returns an [`AgentSkillDef`] value
/// ready to pass to [`AgentBuilder::with_skill_def`].
///
/// [`AgentSkillDef`]: agent::AgentSkillDef
/// [`AgentBuilder::with_skill_def`]: agent::AgentBuilder::with_skill_def
///
/// # Examples
///
/// ```ignore
/// use radkit::{agent::Agent, include_skill};
///
/// let agent = Agent::builder()
/// .with_skill_def(include_skill!("./skills/pdf-processing"))
/// .build();
/// ```
pub use include_skill;