Praison AI
Enterprise
Agents
Bot
Use Cases
University
Docs
Agent lifecycle and where hooks fire
Run
from praisonai import Agent, HooksConfig def lookup_price(sku: str) -> str: """Return SKU price.""" return f'{sku}: $49' trace = [] def on_tool(req): trace.append(f'TOOL -> {req.tool_name} args={req.arguments}') agent = Agent( name='PricingBot', instructions='Always call lookup_price and reply in one sentence.', tools=[lookup_price], hooks=HooksConfig(on_tool_call=on_tool), output='silent', ) print('Reply:', agent.start('What is the price for PRO-1?')) print('Trace:', trace)
Press Run. The result appears here.
Esc
Search in
All
Docs
University