MCPcopy Index your code
hub / github.com/AI45Lab/Code / session_for_agent

Method session_for_agent

core/src/agent_api.rs:398–405  ·  view source on GitHub ↗

Create a session pre-configured from an [`AgentDefinition`]. Maps the definition's `permissions`, `prompt`, `model`, and `max_steps` directly into [`SessionOptions`], so markdown/YAML-defined subagents can be used by delegation and advanced control-plane flows without manual wiring. The mapping follows the same logic as the built-in `task` tool: - `permissions` → `permission_checker` - `prompt`

(
        &self,
        workspace: impl Into<String>,
        def: &crate::subagent::AgentDefinition,
        extra: Option<SessionOptions>,
    )

Source from the content-addressed store, hash-verified

396 /// `extra` can supply additional overrides (e.g. `planning_enabled`) that
397 /// take precedence over the definition's values.
398 pub fn session_for_agent(
399 &self,
400 workspace: impl Into<String>,
401 def: &crate::subagent::AgentDefinition,
402 extra: Option<SessionOptions>,
403 ) -> Result<AgentSession> {
404 agent_sessions::create_session_for_agent(self, workspace, def, extra)
405 }
406
407 /// Create a session from a reproducible disposable worker recipe.
408 ///

Calls 1

create_session_for_agentFunction · 0.85