suna/backend
sharath f3a2ce8de7
fix(run_agent_background): update Redis operation handling to use asyncio tasks
2025-06-05 02:00:39 +00:00
..
.github/workflows
agent feat(context-compression): add ExpandMessageTool for message expansion and integrate into agent run process 2025-05-29 13:47:31 +00:00
agentpress fix(thread_manager): reduce maximum message content length from 300k to 200k characters to prevent context overload 2025-05-29 15:50:29 +00:00
docs chore(dev): fix issues 2025-05-25 15:21:20 +05:30
sandbox feat: rework file upload and caching 2025-05-25 19:10:40 +02:00
services feat: send welcome email to users 2025-06-03 23:04:27 +05:30
supabase chore(dev): ui fixes 2025-05-25 23:48:54 +05:30
utils feat(sentry): enhance Sentry integration with user tracking and error handling improvements 2025-05-27 10:04:17 +00:00
.env.example feat(backend): langfuse traces 2025-05-21 00:39:28 +00:00
.gitignore delete user sandboxes script 2025-05-02 15:50:33 +02:00
Dockerfile chore(docker): remove frontend image build step from CI workflow and expose port 8000 in backend Dockerfile 2025-05-25 16:58:09 +00:00
MANIFEST.in
README.md ci(docker): enhance CI workflow for staging and production deployments, add resource limits in docker-compose.prod.yml 2025-05-27 16:21:11 +00:00
api.py feat: send welcome email to users 2025-06-03 23:04:27 +05:30
docker-compose.prod.yml fix(prod): change process count 2025-06-05 07:23:49 +05:30
docker-compose.yml ci(docker): enhance CI workflow for staging and production deployments, add resource limits in docker-compose.prod.yml 2025-05-27 16:21:11 +00:00
poetry.lock feat(sentry): integrate Sentry SDK for error tracking and update Pillow version 2025-05-27 08:26:27 +00:00
pyproject.toml feat(sentry): integrate Sentry SDK for error tracking and update Pillow version 2025-05-27 08:26:27 +00:00
requirements.txt hotfix: mailtrap version fix 2025-06-03 23:44:08 +05:30
run_agent_background.py fix(run_agent_background): update Redis operation handling to use asyncio tasks 2025-06-05 02:00:39 +00:00
sentry.py feat(sentry): enhance Sentry integration with user tracking and error handling improvements 2025-05-27 10:04:17 +00:00
test_image_compression.py chore(dev): fix issues 2025-05-25 15:21:20 +05:30

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

Production Setup

For production deployments, use the following command to set resource limits

docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d