pub trait SubagentRunner:
Send
+ Sync
+ Debug {
// Required method
fn run_isolated<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
system_prompt: Option<&'life3 str>,
model: Option<&'life4 str>,
tools: &'life5 [String],
cwd: &'life6 Path,
depth: u8,
) -> Pin<Box<dyn Future<Output = Result<ForkResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait;
}Expand description
In-process sub-agent runner — the library-native delegation backend.
When wired into ToolContext via
ToolContext::with_subagent_runner, the subagent tool prefers
this in-process path over shelling out to the oxi CLI binary.
This is essential for library consumers (Oxios) that embed
oxi-agent as a kernel without an oxi subprocess.
The SDK provides a ready-made implementation
(oxi_sdk::SdkSubagentRunner) that wraps an Oxi instance and
creates a fresh Agent for each invocation.
Required Methods§
Sourcefn run_isolated<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
system_prompt: Option<&'life3 str>,
model: Option<&'life4 str>,
tools: &'life5 [String],
cwd: &'life6 Path,
depth: u8,
) -> Pin<Box<dyn Future<Output = Result<ForkResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
fn run_isolated<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
system_prompt: Option<&'life3 str>,
model: Option<&'life4 str>,
tools: &'life5 [String],
cwd: &'life6 Path,
depth: u8,
) -> Pin<Box<dyn Future<Output = Result<ForkResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
Run a single agent task with an isolated (empty) context.
§Arguments
agent_name— Agent definition name (for logging / display).task— The task prompt to execute.system_prompt— Optional system prompt override.model— Optional model ID override (e.g."anthropic/claude-...).tools— Optional tool whitelist (empty = all registered tools).cwd— Working directory for file tools.depth— Current sub-agent nesting depth. The runner sets the forked agent’ssubagent_depthtodepth + 1so the fork’s own subagent tool can enforce a recursion cap without env vars (issue #28 gap 3 — concurrentset_varis UB).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".