Listeners
Listen carefully
FloAI has now callbacks that you can listen to. There are three types of callbacks we support right now:
Agent Callback: For agent related events (use decorator
@flo_agent_callback
)ToolCallback: For tool related events (
@flo_tool_callback
)RouterCallback: For router related events (
@flo_router_callback
)Global Callback: For all the above events (
@flo_call_back
)
You can import them from flo_ai.callbacks
Example of using a callback
Define your callback
from flo_ai.callbacks import flo_agent_callback
@flo_agent_callback
def agent_callback(response: FloCallbackResponse):
print('------------- START AGENT CALLBACK -----------')
print(response)
print('------------- END AGENT CALLBACK -----------')
Register the callback to the session
session.register_callback(agent_callback)
And thats it !
Last updated
Was this helpful?