Navigate to the parent directory of your agent project and use one of the following commands:
Traces on LangDB
When you run queries against your agent, LangDB automatically captures detailed traces of all agent interactions:
Next Steps: Advanced Agno Integration
This guide covered the basics of integrating LangDB with Agno using a Web Search agent example. For more complex scenarios and advanced use cases, check out our comprehensive resources in Guides Section.
from pylangdb.agno import init
# Initialise LangDB
init()
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)
import os
from textwrap import dedent
# Initialize LangDB tracing and import model
from pylangdb.agno import init
init()
from agno.models.langdb import LangDB
# Import Agno agent components
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
# Function to create a LangDB model with selectable model name
def create_langdb_model(model_name="openai/gpt-4.1"):
return LangDB(
id=model_name,
api_key=os.getenv("LANGDB_API_KEY"),
project_id=os.getenv("LANGDB_PROJECT_ID"),
)
web_agent = Agent(
name="Web Agent",
role="Search the web for comprehensive information and current data",
model=create_langdb_model("openai/gpt-4.1"),
tools=[DuckDuckGoTools()],
instructions="Always use web search tools to find current and accurate information. Search for multiple aspects of the topic to gather comprehensive data.",
show_tool_calls=True,
markdown=True,
)
writer_agent = Agent(
name="Writer Agent",
role="Write comprehensive article on the provided topic",
model=create_langdb_model("anthropic/claude-3.7-sonnet"),
instructions="Use outlines to write articles",
show_tool_calls=True,
markdown=True,
)
agent_team = Agent(
name="Research Team",
team=[web_agent, writer_agent],
model=create_langdb_model("gemini/gemini-2.0-flash"),
instructions=dedent("""\
You are the coordinator of a research team with two specialists:
1. Web Agent: Has DuckDuckGo search tools and must be used for ALL research tasks
2. Writer Agent: Specializes in creating comprehensive articles
WORKFLOW:
1. ALWAYS delegate research tasks to the Web Agent first
2. The Web Agent MUST use web search tools to gather current information
3. Then delegate writing tasks to the Writer Agent using the research findings
4. Ensure comprehensive coverage of the topic through multiple searches
IMPORTANT: Never attempt to answer without first having the Web Agent conduct searches.
"""),
show_tool_calls=True,
markdown=True,
)
agent_team.print_response(
"I need a comprehensive article about the Eiffel Tower. "
"Please have the Web Agent search for current information about its history, architectural significance, and cultural impact. "
"Then have the Writer Agent create a detailed article based on the research findings.",
stream=True
)