Build & Monitor a Web Search Agent

A powerful web search agent built using SwarmZero framework that enables intelligent web searching capabilities.

Description

This agent utilizes the Tavily API for performing web searches and is built on top of the SwarmZero framework, providing enhanced search capabilities with AI-powered processing.

Prerequisites

Installation

  1. Clone the repository:

git clone https://github.com/swarmzero/examples.git
cd examples/agents/web-search-agent
  1. Install dependencies using Poetry:

poetry install --no-root
  1. Set up environment variables: Create a .env file in the root directory and add your API keys:

TAVILY_API_KEY=your_tavily_api_key_here
AGENTOPS_API_KEY=your_agentops_api_key_here
OPENAI_API_KEY=your_openai_api_key_here

Usage

  1. Activate the Poetry shell:

poetry shell
  1. Run the agent:

poetry run python main.py
  1. Send a message to the agent:

curl -X 'POST' \
  'http://localhost:8000/api/v1/chat' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'user_id=test_user' \
  -F 'session_id=test_web_search_agent' \
  -F 'chat_data={"messages":[{"role":"user","content":"what is swarmzero.ai about?"}]}'
  1. AgentOps will automatically capture the session:

Dependencies

  • swarmzero: Main framework for agent development

  • agentops: Agent operations and monitoring

  • tavily-python: Web search API client

Learn more

Visit SwarmZero to learn more about the SwarmZero framework.

Last updated

Logo

© 2025 SwarmZero Technology Solutions Inc. All rights reserved.