Why Instrument Your LangChain Agent?
You've built a LangChain agent. It works — most of the time. But when it breaks, you have no idea why.
Maybe:
This guide shows you how to add full observability in 3 minutes.
Step 1: Install the SDK
```bash
pip install trefur
```
Step 2: Initialize Trefur
Add a few lines to your agent setup:
```python
from trefur_observe import TrefurObserve
# Initialize with your API key
trefur = TrefurObserve(api_key="your-api-key")
trefur.instrument()
```
Step 3: Run Your Agent
That's it. Run your LangChain agent as normal — Trefur captures everything:
```python
from langchain.agents import AgentExecutor
# Your existing agent — no changes needed
agent = AgentExecutor.from_agent_and_tools(...)
result = agent.invoke({"input": "What's our refund policy?"})
```
What You Get
Once instrumented, you'll see in the Trefur dashboard:
Example Trace Output
Here's what a typical trace looks like:
```
🤖 Agent: Reasoning about user query...
🔧 Tool: search_knowledge_base(query="refund policy")
📝 LLM: Generating response...
✅ Completed in 2.3s | $0.0042
```
Finding Bugs Fast
Let's say your agent is returning wrong answers. With Trefur:
Next Steps
Get started at [app.trefur.com](https://app.trefur.com).