What We’re Building
We’ll create an agent that can:- Search for information on any topic
- Analyze and summarize findings
- Save research reports to files
- Remember previous conversations
1
Set Up Your Project
First, create a new project directory:Install the required packages:
2
Create Your First Agent
Create a file called
agent.py
:3
Run Your Agent
- Thread Creation: A conversation thread is created to hold messages
- Message Processing: The agent receives your message and plans its approach
- Tool Usage: The agent uses web search tools to find information
- Response Generation: The agent synthesizes findings into a response
Understanding What Happened
Let’s add some visibility into the agent’s process:Add Persistence to Your Agent
Let’s upgrade the agent to maintain conversation history:Interactive Research Session
Let’s create an interactive version where you can have a conversation:Understanding Tools
Let’s explore what tools your agent can use:Debugging Your Agent
Basic Logging
Enable detailed logging to see what your agent is doing:Advanced tracing with Weave
For comprehensive debugging and observability, Slide integrates with Weights & Biases Weave. Weave provides:- Visual traces of every agent action and decision
- LLM call tracking with inputs, outputs, and token usage
- Tool execution monitoring to see which tools were called and their results
- Performance insights to identify bottlenecks
- Error tracking with full context
Weave traces are invaluable for debugging complex agent behaviors. You can see exactly what prompts were sent to the LLM, what tools were called, and how the agent made its decisions.
Next steps
You’ve built your first agent! Here’s what to explore next:Adding More Tools
Give your agent more capabilities
Streaming Responses
Build real-time interactive agents
Testing Your Agent
Ensure your agent behaves correctly
Deploy to Slack
Turn your agent into a Slack agent
Tips for Success
Clear Purpose Statements
Clear Purpose Statements
The
purpose
parameter significantly affects agent behavior. Be specific:Tool Selection
Tool Selection
Only give your agent the tools it needs:
Error Handling
Error Handling
Always handle potential errors:
Processing Complex Files
Processing Complex Files
Your agent can handle various file types out of the box. For enhanced capabilities:
- Scanned PDFs: Install
poppler
for OCR support - Unusual file formats: Install
libmagic
for better detection