You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/examples/deployment_solutions/README.md

2.2 KiB

Deployment Solutions Examples

This directory contains practical examples of different deployment strategies for Swarms agents and multi-agent systems.

Examples Overview

FastAPI + Uvicorn

  • File: fastapi_agent_api_example.py
  • Description: Complete FastAPI application that exposes Swarms agents as REST APIs
  • Use Case: Creating HTTP endpoints for your agents
  • Requirements: requirements.txt

Cron Jobs

  • Directory: cron_job_examples/
  • Description: Various examples of running agents on schedules
  • Use Case: Automated, periodic task execution
  • Examples: Crypto tracking, stock monitoring, data processing

Quick Start

FastAPI Example

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the API server:

    python fastapi_agent_api_example.py
    
  3. Access the API:

  4. Test with curl:

    curl -X POST "http://localhost:8000/agent/run" \
         -H "Content-Type: application/json" \
         -d '{"task": "What are the best top 3 ETFs for gold coverage?"}'
    

Cron Job Examples

Navigate to the cron_job_examples/ directory for various scheduling examples:

  • cron_job_example.py - Basic cron job setup
  • crypto_concurrent_cron_example.py - Concurrent crypto monitoring
  • solana_price_tracker.py - Solana price tracking
  • figma_stock_example.py - Stock monitoring with Figma integration

Testing

Run the test script to verify your setup:

python test_fastapi_example.py

Documentation

For detailed guides and documentation, see:

Requirements

  • Python 3.8+
  • Swarms framework
  • FastAPI and Uvicorn (for API examples)
  • Required API keys for your chosen models

Support

If you encounter issues:

  1. Check the requirements are installed correctly
  2. Verify your API keys are set
  3. Check the documentation for detailed setup instructions
  4. Review the test script output for debugging information