Praison AI
Enterprise
Agents
Bot
Use Cases
University
Docs
Auditing and logging with HooksConfig
Run
import json from praisonai import Agent, HooksConfig def query_customer(customer_id: str) -> str: """Return customer plan tier.""" return f'Customer {customer_id}: Enterprise' audit_records = [] def audit_tool(event): audit_records.append({'tool': event.tool_name, 'args': event.arguments}) agent = Agent( name='CRMHelper', instructions='Always call query_customer and reply in one sentence.', tools=[query_customer], hooks=HooksConfig(on_tool_call=audit_tool), output='silent', ) print('Answer :', agent.start('Check tier for C-900')) print('Audit JSON:', json.dumps(audit_records))
Press Run. The result appears here.
Esc
Search in
All
Docs
University