Skip to main content

all_tools_with_runtime

Function all_tools_with_runtime 

pub fn all_tools_with_runtime(
    config: Arc<Config>,
    security: &Arc<SecurityPolicy>,
    risk_profile: &RiskProfileConfig,
    agent_alias: &str,
    runtime: Arc<dyn RuntimeAdapter>,
    memory: Arc<dyn Memory>,
    composio_key: Option<&str>,
    composio_entity_id: Option<&str>,
    browser_config: &BrowserConfig,
    http_config: &HttpRequestConfig,
    web_fetch_config: &WebFetchConfig,
    workspace_dir: &Path,
    agents: &HashMap<String, AliasedAgentConfig>,
    fallback_api_key: Option<&str>,
    root_config: &Config,
    canvas_store: Option<CanvasStore>,
    is_subagent_caller: bool,
    tui_env: Option<HashMap<String, String>>,
    sop_engine: Option<Arc<Mutex<SopEngine>>>,
    sop_audit: Option<Arc<SopAuditLogger>>,
    live_config: Option<LiveConfigHandle>,
) -> Result<AllToolsResult>
Expand description

Create the full tool registry on a dedicated builder thread.

The registry build is the deepest synchronous subtree reachable from session/new and from every turn path. Built inline it consumed the RPC caller’s stack down to a few KiB of the 2 MiB session/new regression budget, so any change deepening it overflowed Windows debug builds. The build now runs on a thread with its own explicit stack; the caller’s stack pays only the cheap per-call prep below.

Ordering and panic semantics are unchanged: the caller blocks until the registry is built (as the inline build did), and a builder panic is resumed on the caller’s thread. A scoped thread keeps the borrowed parameters (browser_config/http_config/web_fetch_config/agents/ root_config) semantically independent at the API boundary while avoiding deep clones on the caller’s limited stack.