Working with Agno

Unlock full observability for CrewAI agents and tasks—capture LLM calls, task execution, and agent interactions with LangDB’s init().

LangDB’s Agno integration provides end-to-end tracing for your Agno agent pipelines.

Installation

Install the LangDB client with Agno feature flag:

pip install pylangdb[agno]

Quick Start

Export Environment Variables

Set your LangDB credentials:

export LANGDB_API_KEY="<your_langdb_api_key>"
export LANGDB_PROJECT_ID="<your_langdb_project_id>"

Initialize Tracing

Import and run the initialize before configuring your Agno Code:

from pylangdb.agno import init
# Initialise LangDB
init()

Configure your Agno code

import os
from pylangdb.agno import init
init()

from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.models.langdb import LangDB

# Configure LangDB-backed model
langdb_model = LangDB(
    id="openai/gpt-4",
    api_key=os.getenv("LANGDB_API_KEY"),
    project_id=os.getenv("LANGDB_PROJECT_ID"),
)

# Create and run your agent
agent = Agent(
    name="Web Agent",
    role="Search the web for information",
    model=langdb_model,
    tools=[DuckDuckGoTools()],
    instructions="Answer questions using web search",
)

response = agent.run("What is LangDB?")
print(response)

All Agno interactions from invocation through tool calls to final output are traced with LangDB

Last updated

Was this helpful?