CallContext.request_confirmation():
request_confirmation() is called from a before_tool_callback, the tool execution is paused and a confirmation request event is yielded. The caller must approve or reject before execution continues.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Gate dangerous tool executions with CallContext.request_confirmation(). Pause and require approval before delete, drop, or other risky operations.
CallContext.request_confirmation():
from orxhestra.tools import CallContext
async def confirm_dangerous(ctx, tool_name: str, tool_args: dict) -> None:
if tool_name in ("delete_file", "drop_table"):
call_ctx = CallContext(ctx)
call_ctx.request_confirmation()
request_confirmation() is called from a before_tool_callback, the tool execution is paused and a confirmation request event is yielded. The caller must approve or reject before execution continues.
agent = LlmAgent(
name="SafeAgent",
model=model,
tools=[delete_file, drop_table, search],
before_tool_callback=confirm_dangerous,
)
Was this page helpful?