Discussed in #321
Originally posted by sr198 April 21, 2025
Going through the Opik integration example and couples of things stand out.
opik_tracer = OpikTracer()
root_agent = Agent(
name="weather_time_agent",
model="gemini-2.0-flash-exp",
description=("Agent to answer questions about the time and weather in a city."),
instruction=("I can answer your questions about the time and weather in a city."),
tools=[get_weather, get_current_time],
before_agent_callback=opik_tracer.before_agent_callback,
after_agent_callback=opik_tracer.after_agent_callback,
before_model_callback=opik_tracer.before_model_callback,
after_model_callback=opik_tracer.after_model_callback,
before_tool_callback=opik_tracer.before_tool_callback,
after_tool_callback=opik_tracer.after_tool_callback,
)
- The callback params take a single value today - which means, if I want to add my own callback for some guardrail feature then I will have to wrap OpikTracker in my code. Should we allow callbacks to accept lists for chained execution at the framework level?
Agent(
...
before_model_callback=[my_callback, opik_tracer.before_model_callback],
)
- Also can we allow observability integration at a higher/global level, so it’s not repeated per agent.
What do you think?
Discussed in #321
Originally posted by sr198 April 21, 2025
Going through the Opik integration example and couples of things stand out.
opik_tracer = OpikTracer()
root_agent = Agent(
name="weather_time_agent",
model="gemini-2.0-flash-exp",
description=("Agent to answer questions about the time and weather in a city."),
instruction=("I can answer your questions about the time and weather in a city."),
tools=[get_weather, get_current_time],
before_agent_callback=opik_tracer.before_agent_callback,
after_agent_callback=opik_tracer.after_agent_callback,
before_model_callback=opik_tracer.before_model_callback,
after_model_callback=opik_tracer.after_model_callback,
before_tool_callback=opik_tracer.before_tool_callback,
after_tool_callback=opik_tracer.after_tool_callback,
)
Agent(
...
before_model_callback=[my_callback, opik_tracer.before_model_callback],
)
What do you think?