Monitoring Agno(Phidata) Agents and Langtrace

Obinna Okafor

Software Engineer

Feb 27, 2025

We're excited to announce that Langtrace now supports Agno. Agno is a lightweight library for building multi-modal agents, designed with simplicity, speed, and flexibility in mind. Langtrace gives developers visibility into their agents' operations, from reasoning steps and tool calls to memory operations and knowledge retrieval.


The Challenge of Agent Observability

Building sophisticated AI agents involves orchestrating multiple components: large language models, tools, knowledge bases, memory systems, and reasoning capabilities. When these agents don't perform as expected, identifying the root cause can be challenging:

  • Was it a problem with the model's understanding?

  • Did a tool return unexpected data?

  • Was the right context retrieved from the knowledge base?

  • Did the agent follow the expected reasoning steps?

Debugging these issues requires tedious logging and guesswork, slowing down development and hindering production reliability.


Introducing Agno + Langtrace

Agno is a framework for building intelligent agents with memory, knowledge, and reasoning capabilities. Its declarative API makes it easy to build complex agents that can:

  • Maintain conversation memory and user context

  • Access and update knowledge bases (RAG)

  • Perform step-by-step reasoning

  • Use tools to interact with external systems

  • Function in multi-modal environments

With our new integration, Langtrace now provides end-to-end tracing for all these Phidata components, giving you complete visibility into your agents' operations.


What's Being Traced?

The integration automatically traces:

1. Agent Operations
  • Input prompts and output responses

  • Execution timing for each run

  • System messages and instructions

  • Error states and exceptions

2. Tool Calls
  • Tool invocation details

  • Parameters passed to tools

  • Return values

  • Execution timing for individual tools

3. Memory Operations
  • Memory updates

  • Chat history retrievals

  • Session state changes

4. Knowledge Operations
  • Document retrievals from knowledge bases

  • Query contexts

  • Reference metadata

  • RAG pipeline performance

5. Reasoning Steps
  • Step-by-step reasoning processes

  • Action, result, and reasoning for each step

  • Confidence scores

  • Decision paths


Real-World Example: Finance Research Agent

To illustrate the power of this integration, let's look at a financial research agent built with Agno and traced with Langtrace:

from langtrace_python_sdk import langtrace  # Must precede other imports
from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span

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

langtrace.init()

# Create the agent
finance_agent = Agent(
    name="Finance Agent",
    model=OpenAIChat(id="gpt-4o"),
    tools=[
        YFinanceTools(
            stock_price=True,
            analyst_recommendations=True,
            company_info=True,
            company_news=True
        )
    ],
    instructions=["Use tables to display data"],
    show_tool_calls=True,
    markdown=True,
)

@with_langtrace_root_span()
def analyze_stock(symbol: str):
    finance_agent.print_response(
        f"Analyze {symbol}. Show me:\n" +
        "1. Current stock price\n" +
        "2. Analyst recommendations\n" +
        "3. Latest company news\n" +
        "Present the information in a clear, organized format.",
        stream=True
    )

analyze_stock("NVDA")

With Langtrace, you can visualize the entire execution flow:

This integration brings significant benefits across the development lifecycle:

During Development:
  • Faster debugging: Quickly identify where agents are failing

  • Improved iteration: See how changes impact agent behaviour

  • Better understanding: Gain insight into reasoning processes

In Production:
  • Performance monitoring: Track response times and identify bottlenecks

  • Error alerting: Get notified when agents encounter problems

  • Usage analytics: Understand how your agents are being used


Getting Started

To start using the integration, install both packages:

Initialize Langtrace before creating your Agno agents:

from langtrace_python_sdk import langtrace
langtrace.init(api_key="your-api-key")

That's it! Langtrace will automatically trace all your Agno agent operations.

For detailed documentation, visit our Agno integration guide.


Conclusion

Agno provides a powerful framework for building intelligent agents with memory, knowledge, and reasoning capabilities. Its declarative API and comprehensive feature set make it an excellent choice for developing sophisticated AI assistants. When combined with Langtrace's observability capabilities, developers gain deep insights into their agents' operations, enabling them to build more reliable and performant applications.


Additional Resources

Ready to try Langtrace?

Try out the Langtrace SDK with just 2 lines of code.

Ready to deploy?

Try out the Langtrace SDK with just 2 lines of code.

Want to learn more?

Check out our documentation to learn more about how langtrace works

Join the Community

Check out our Discord community to ask questions and meet customers