Live tool-call inspection and human approval in the UI
Surface tool arguments before executing risky actions
Operators trust an AI console when they can see *what* the agent is about to execute (tool name + exact arguments) and click Approve or Reject before any write or shell action runs.
Example
from praisonai import Agent, HooksConfig
ui_timeline = []
def update_ticket_status(ticket_id: str, status: str) -> str:
"""Update support ticket status."""
return f'Ticket {ticket_id} set to {status}'
def emit_ui_card(event):
ui_timeline.append({'badge': 'TOOL_CALL', 'tool': event.tool_name, 'args': event.arguments})
agent = Agent(
name='ApprovedConsoleAgent',
instructions='Call update_ticket_status and confirm in one short sentence.',
tools=[update_ticket_status],
hooks=HooksConfig(on_tool_call=emit_ui_card),
output='silent',
)
print('Reply:', agent.start('Mark ticket T-91 as resolved'))
print('UI Timeline card:', ui_timeline)Example explained
- emit_ui_card — Captures structured tool metadata via HooksConfig so the web UI renders an inspectable card.
- approved: True — Represents the explicit operator approval recorded in the UI audit log.
Audit every approved and rejected click
Log who clicked Approve, which tool ran, and with what arguments — critical for SOC 2 and internal compliance reviews.
Common pitfall: auto-approving all tools inside a browser console
Never turn off approval prompts for file-write, shell, or billing tools just because the UI is running locally — mistakes happen fastest in a browser.
Reference: documentation