This example demonstrates how to instrument your Agno agent and send traces to LangWatch
Copy
Ask AI
import langwatchimport osfrom agno.agent import Agentfrom agno.models.openai import OpenAIChatfrom agno.tools.duckduckgo import DuckDuckGoToolsfrom openinference.instrumentation.agno import AgnoInstrumentor# Initialize LangWatch and instrument Agnolangwatch.setup( instrumentors=[AgnoInstrumentor()])agent = Agent( name="Research Agent", model=OpenAIChat(id="gpt-4o-mini"), tools=[DuckDuckGoTools(search=True, news=True)], instructions="You are a research agent. Answer questions in the style of a professional researcher.", debug_mode=True,)agent.print_response("What is the latest news about artificial intelligence?")
No OpenTelemetry Setup Needed: You do not need to set any OpenTelemetry environment variables or configure exporters manually—langwatch.setup() handles everything.
Troubleshooting: If you see no traces in LangWatch, ensure your LANGWATCH_API_KEY is set and that the instrumentor is included in langwatch.setup().