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
//! Oxios sub-agent runner — in-process delegation via oxi-sdk 0.54.0+.
//!
//! Wraps [`oxi_sdk::SdkSubagentRunner`] (which wraps an `Oxi` instance)
//! and exposes it as an [`oxi_agent::SubagentRunner`] for the `subagent`
//! tool's in-process path. Each `run_isolated` call builds a fresh `Agent`
//! with an empty context (full isolation from the parent), runs it, and
//! returns only the final text + usage.
//!
//! # Security model
//!
//! The sub-agent built by `SdkSubagentRunner` has **zero tools** — it
//! calls `self.oxi.agent(config).build()` with no `.tool()` / `.coding_tools()`
//! / `.kernel_tools()` registration. A tool-less agent can only do pure
//! text generation: no file access, no bash, no network, no side effects.
//! This makes the sandbox-escape vector from RFC-035 §4.3 currently moot
//! for this runner.
//!
//! **Defense-in-depth upgrade path:** if a future `SdkSubagentRunner`
//! version starts honoring the `_tools` parameter or auto-registers
//! built-in tools, switch this module to delegate through
//! `AgentLifecycleManager::execute_directive` instead (RFC-035 Q2-B),
//! which inherits `allowed_tools`/`network_access`/`max_execution_time_secs`/
//! `access_manager` by construction. The "wrinkle" (ExecutionResult has
//! no token usage) is resolvable by sourcing usage from `AgentEvent::Usage`.
//!
//! # Depth safety
//!
//! The runner sets the forked agent's `subagent_depth` to `depth + 1`.
//! The SDK hardcodes the in-process max to 3 (`subagent.rs:649`), so
//! recursion is bounded without env vars (concurrent `set_var` is UB).
use Arc;
use SdkSubagentRunner;
/// Oxios's in-process sub-agent runner.
///
/// Constructed once at boot from the [`OxiosEngine`]'s `Oxi` instance
/// and shared via `Arc` into every agent build path. When wired into
/// `AgentConfig.subagent_runner`, the `subagent` tool prefers this
/// in-process path over shelling out to the CLI binary.