Skip to main content
In this guide, weโ€™ll build a research assistant agent that can search the web, analyze information, and create reports. By the end, youโ€™ll understand the core concepts of building agents with Slide. ๐Ÿ’ป Code Examples

Basic Agent

Minimal agent setup

Streaming

Real-time responses

With Tools

Add capabilities
Requirements: Python 3.11 or higher

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:
Choosing between .stream() and .run():
  • Use agent.stream(thread) for:
    • Chat interfaces and real-time UIs
    • Watching the agent work (great for debugging)
    • Progressive UI updates as content generates
  • Use await agent.run(thread) for:
    • Batch processing and automation
    • Testing (when you just need the final result)
    • Simple scripts where streaming isnโ€™t needed
Most interactive applications will want .stream() - itโ€™s what makes agents feel alive!
3

Run Your Agent

When you run the agent, hereโ€™s what happens:
  1. Thread Creation: A conversation thread is created to hold messages
  2. Message Processing: The agent receives your message and plans its approach
  3. Tool Usage: The agent uses web search tools to find information
  4. Response Generation: The agent synthesizes findings into a response

Understanding What Happened

When you stream, you get real-time events showing everything your agent does:
Non-streaming alternative: If you just want the final result without watching the process:
This is useful for batch processing or automation where you donโ€™t need real-time updates.

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:
You can also give your agent specific tools:

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

The purpose parameter significantly affects agent behavior. Be specific:
Only give your agent the tools it needs:
Always handle potential errors:
Your agent can handle various file types out of the box. For enhanced capabilities:
  • Scanned PDFs: Install poppler for OCR support
This is optional - your agent will work fine without it for most use cases.