Skip to content

Commit b63dca7

Browse files
committed
feat(core): host-registered dynamic session tools
AgentSession::register_dynamic_tool / unregister_dynamic_tool — lets an embedding app (the a3s-code CLI's login-gated 'runtime' offload tool) add a native tool to a live session; it enters the LLM toolset on the next run, the same way MCP tools surface after add_mcp_server. Idempotent by name. Base: the exact core snapshot a3s-cli 0.5.x pinned (e1b65e8), so the 0.6.0 CLI release ships the combination its tests ran against.
1 parent e1b65e8 commit b63dca7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/src/agent_api.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,21 @@ impl AgentSession {
13391339
&self.tool_executor
13401340
}
13411341

1342+
/// Register a host-provided dynamic tool into the live session. Enables an
1343+
/// embedding app (e.g. the a3s-code CLI's login-gated `runtime` A3S Runtime
1344+
/// offload tool) to add a native tool at runtime; it enters the LLM's toolset
1345+
/// on the next run (`build_agent_loop` re-snapshots `definitions()` per run),
1346+
/// the same way MCP tools surface after `add_mcp_server`. Idempotent by name.
1347+
pub fn register_dynamic_tool(&self, tool: Arc<dyn crate::tools::Tool>) {
1348+
self.tool_executor.register_dynamic_tool(tool);
1349+
}
1350+
1351+
/// Remove a previously host-registered dynamic tool by name (e.g. on logout).
1352+
/// No-op if no tool of that name is registered.
1353+
pub fn unregister_dynamic_tool(&self, name: &str) {
1354+
self.tool_executor.unregister_dynamic_tool(name);
1355+
}
1356+
13421357
/// Remove an MCP server from this session.
13431358
///
13441359
/// Disconnects the server and unregisters all its tools from the executor.

0 commit comments

Comments
 (0)