suna/backend
marko-kraemer f9afb09ffe CLAUDE SONNET 4. 2025-05-22 21:18:39 +02:00
..
.github/workflows
agent Merge branch 'dat-lequoc-gemini-flash' into feat/improve-model-selector 2025-05-22 20:32:15 +02:00
agentpress save all browser states 2025-05-19 01:06:44 +02:00
sandbox feat: improve model selector and fixes 2025-05-21 22:59:56 +02:00
services feat: improve model selector and fixes 2025-05-21 22:59:56 +02:00
supabase
utils CLAUDE SONNET 4. 2025-05-22 21:18:39 +02:00
.env.example
.gitignore
Dockerfile
MANIFEST.in
README.md :Merge branch 'main' into pr/ravisojitra/301 2025-05-17 21:11:53 +00:00
api.py
docker-compose.yml chore(backend): add more dramatiq workers 2025-05-20 14:19:59 +00:00
fly.production.toml
fly.staging.toml
poetry.lock Add Dramatiq, Pika, and Prometheus client dependencies for background task processing 2025-05-16 10:33:42 -07:00
pyproject.toml Add Dramatiq, Pika, and Prometheus client dependencies for background task processing 2025-05-16 10:33:42 -07:00
requirements.txt gemini + fix syntax bug in prompts 2025-05-21 18:19:46 +02:00
run_agent_background.py refactor(api): streamline sandbox handling 2025-05-18 03:23:46 +02:00

README.md

Suna Backend

Running the backend

Within the backend directory, run the following command to stop and start the backend:

docker compose down && docker compose up --build

Running Individual Services

You can run individual services from the docker-compose file. This is particularly useful during development:

Running only Redis and RabbitMQ

docker compose up redis rabbitmq

Running only the API and Worker

docker compose up api worker

Development Setup

For local development, you might only need to run Redis and RabbitMQ, while working on the API locally. This is useful when:

  • You're making changes to the API code and want to test them directly
  • You want to avoid rebuilding the API container on every change
  • You're running the API service directly on your machine

To run just Redis and RabbitMQ for development:```bash docker compose up redis rabbitmq

Then you can run your API service locally with the following commands

# On one terminal
cd backend
poetry run python3.11 api.py

# On another terminal
cd frontend
poetry run python3.11 -m dramatiq run_agent_background

Environment Configuration

When running services individually, make sure to:

  1. Check your .env file and adjust any necessary environment variables
  2. Ensure Redis connection settings match your local setup (default: localhost:6379)
  3. Ensure RabbitMQ connection settings match your local setup (default: localhost:5672)
  4. Update any service-specific environment variables if needed

Important: Redis Host Configuration

When running the API locally with Redis in Docker, you need to set the correct Redis host in your .env file:

  • For Docker-to-Docker communication (when running both services in Docker): use REDIS_HOST=redis
  • For local-to-Docker communication (when running API locally): use REDIS_HOST=localhost

Important: RabbitMQ Host Configuration

When running the API locally with Redis in Docker, you need to set the correct RabbitMQ host in your .env file:

  • For Docker-to-Docker communication (when running both services in Docker): use RABBITMQ_HOST=rabbitmq
  • For local-to-Docker communication (when running API locally): use RABBITMQ_HOST=localhost

Example .env configuration for local development:

REDIS_HOST=localhost (instead of 'redis')
REDIS_PORT=6379
REDIS_PASSWORD=

RABBITMQ_HOST=localhost (instead of 'rabbitmq')
RABBITMQ_PORT=5672