Langtrace

Send Agno model-call traces to Langtrace.

Integrating Agno with Langtrace

Langtrace traces and monitors the model calls made by an Agno agent.

Prerequisites

  1. Install Dependencies

    Ensure you have the necessary package installed:

    uv pip install agno openai yfinance langtrace-python-sdk
  2. Create a Langtrace Account

    • Sign up for an account at Langtrace.
    • Obtain your API key from the Langtrace dashboard.
  3. Set Environment Variables

    Configure your environment with the Langtrace and OpenAI API keys:

    export LANGTRACE_API_KEY="your-key"
    export OPENAI_API_KEY="your-key"

Sending Traces to Langtrace

Instrument your Agno agent with Langtrace.

from langtrace_python_sdk import langtrace

langtrace.init()

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    name="Stock Price Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[YFinanceTools()],
    instructions="You are a stock price agent. Answer questions in the style of a stock analyst.",
    debug_mode=True,
)

agent.print_response("What is the current price of Tesla?")

Initialize Langtrace before importing Agno or OpenAI modules. This lets Langtrace instrument the model client when it loads.