Agent Rag Tracing
- Build an agentic RAG app using LlamaIndex’s ReAct agent framework
- Instrument and trace the agentic RAG app with Phoenix
- Inspect the trace data in Phoenix to understand the agent’s decision-making process
Notebook Walkthrough
We will go through key code snippets on this page. To follow the full tutorial, check out the notebook above.Build Query Engine Tools using Chroma
Create the two databases that your agent will use to answer questions using Chroma, a vector database that will store the company policies and employees.Company Policies Database
Employees Database
Add as Tools
LlamaIndex’s ReAct agent framework allows you to add tools to the agent. Here you’ll add the two tools that will be used to answer questions.Create ReAct Agent
LlamaIndex provides a ReAct agent framework that allows you to create an agent that can use tools to answer questions. Here you’ll create an agent that can use the two tools you created earlier to answer questions.Test Your Agent
Now you can test your agent with various queries and see how it uses the tools to gather information and provide comprehensive answers.View Traces in Phoenix
After running your agent, you can inspect the trace data in Phoenix to understand:- How the agent broke down complex queries into sub-tasks
- Which tools were used and in what order
- The reasoning process behind the agent’s decisions
- The quality and relevance of retrieved information
- Performance metrics and latency
- Expand the agent’s capabilities by adding more tools (e.g., SQL databases, external APIs)
- Implement more sophisticated reasoning patterns
- Add evaluation metrics to measure the agent’s performance
- Scale the system to handle more complex queries and larger datasets
- Analyze the trace data to optimize the agent’s decision-making process

