(
&self,
workspace: String,
agent_name: String,
agent_dirs: Option<Vec<String>>,
options: Option<PySessionOptions>,
)
| 1315 | /// options: Optional session overrides layered on top of the agent definition |
| 1316 | #[pyo3(signature = (workspace, agent_name, agent_dirs=None, options=None))] |
| 1317 | fn session_for_agent( |
| 1318 | &self, |
| 1319 | workspace: String, |
| 1320 | agent_name: String, |
| 1321 | agent_dirs: Option<Vec<String>>, |
| 1322 | options: Option<PySessionOptions>, |
| 1323 | ) -> PyResult<PySession> { |
| 1324 | let registry = a3s_code_core::subagent::AgentRegistry::new(); |
| 1325 | for dir in agent_dirs.unwrap_or_default() { |
| 1326 | let agents = a3s_code_core::subagent::load_agents_from_dir(std::path::Path::new(&dir)); |
| 1327 | for agent in agents { |
| 1328 | registry.register(agent); |
| 1329 | } |
| 1330 | } |
| 1331 | let def = registry |
| 1332 | .get(&agent_name) |
| 1333 | .ok_or_else(|| PyRuntimeError::new_err(format!("agent '{}' not found", agent_name)))?; |
| 1334 | let opts = options.map(build_rust_session_options).transpose()?; |
| 1335 | let session = self |
| 1336 | .inner |
| 1337 | .session_for_agent(workspace, &def, opts) |
| 1338 | .map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; |
| 1339 | Ok(PySession { |
| 1340 | inner: Arc::new(session), |
| 1341 | }) |
| 1342 | } |
| 1343 | |
| 1344 | /// Create a session pre-configured from a disposable worker spec. |
| 1345 | #[pyo3(signature = (workspace, worker, options=None))] |
nothing calls this directly
no test coverage detected