Skip to main content
Learn to create a custom agent that can search the web and summarize information.

Overview

In this tutorial, you’ll build a researcher agent that:
  1. Takes a research query
  2. Searches the web for information
  3. Summarizes the findings

Step 1: Create the Agent File

Create agents/researcher.py:

Step 2: Create a Tool

Create tools/web_tools.py:
You can use any search API. Serper is used here as an example. You can also use DuckDuckGo, Bing, or other providers.

Step 3: Set Environment Variables

Add to your .env file:

Step 4: Run the Agent

Option A: Local Run (Fastest)

Option B: As a Worker

Start the worker:
In another terminal, submit a task:

Step 5: Understand the Output

You should see output like:

Understanding Agent Configuration

Let’s break down the agent configuration:

Core Parameters

LLM Configuration

Execution Control


Adding More Tools

Add additional tools to your agent:

Advanced: Custom Instructions

Add custom instructions to guide agent behavior:

Testing Your Agent

Test with different queries:

Next Steps

Agent Configuration

Learn all agent configuration options

Tool Development

Create more sophisticated tools

Agent Authoring

Best practices for agent design

MCP Integration

Connect to MCP servers

Troubleshooting

Agent Not Found

Ensure your agent file is in the agents/ directory and properly imported.

Tool Errors

Check that:
  • Tool is properly decorated with @tool
  • Parameters match the schema
  • API keys are set in .env

LLM Errors

Verify:
  • API key is valid
  • Model name is correct
  • Network connectivity

Next Steps