Skip to content

Latest commit

 

History

History
64 lines (40 loc) · 2.15 KB

File metadata and controls

64 lines (40 loc) · 2.15 KB

Basic Examples

This directory contains basic examples of using the Capyswarm library.

Examples

  1. hackernews.py

    • Demonstrates how to scrape Hacker News using an Orchestrator and a specialized Agent.
    • Usage: Scrapes the top 5 posts from Hacker News.
  2. hn_analysis.py

    • Demonstrates a hand-off between agents, where one agent collects data and another waits for that data and then analyzes it.
    • Usage: Collects and analyzes the top 5 posts from Hacker News.
  3. weather.py

    • Another demonstration of how to coordinate two agents, where one agent collects data and another waits for that data and then analyzes it.
    • Usage: Gets the weather forecast for Tokyo and recommends suitable outdoor activities for the next 3 days.
Click to view demo video 📽️
weather.webm
  1. hn_mal.py

    • Demonstrates how to scrape two different websites in parallel in two separate instances using an Orchestrator and two specialized Agents.
    • Usage: Scrapes the top 5 posts from Hacker News and the top 5 anime from MyAnimeList.
    • Note: This example requires you to have two different Scrapybara instances running before you run the example.
Click to view demo video 📽️
hn_mal.webm
  1. github_analysis.py

    • Shows how two agents can collaborate on a shared goal simultaneously, analyzing different aspects of a GitHub repository.
    • Usage: Performs a comprehensive analysis of the FastAPI repository with agents sharing insights.
    • Note: Doesn't always work as expected.
  2. repl.py (WIP)

    • Shows how to use context variables within an agent.
    • Usage: Demonstrates maintaining state between agent interactions.

Running the Examples

  1. Set up your environment:

    export SCRAPYBARA_API_KEY="your_api_key"
  2. Run the example:

    uv run examples/basic/<example_name>.py