Why this matters
For humans, tasks and services eliminate “works on my machine” problems. Everyone gets the same setup, every time. For agents, tasks and services are essential to the run loop. When Ona Agent can runnpm test or docker compose up reliably, it can iterate autonomously - try something, verify it works, and continue without human intervention.

Tasks vs Services
Services are long-running processes that stay active throughout your session:- Databases (PostgreSQL, MySQL)
- Backend and frontend servers
- Caching systems (Redis)
- Installing dependencies
- Running tests
- Seeding databases
- Authenticating with cloud providers
Quick example
- Starts PostgreSQL when the environment starts
- Waits until the database is ready
- Seeds the database with test data
- Makes “Run tests” available as a manual action
Triggers
Control when tasks and services run:| Trigger | Services | Tasks | When it runs |
|---|---|---|---|
manual | ✓ | ✓ | On-demand via the CLI or UI |
postDevcontainerStart | ✓ | ✓ | After container starts (first start or rebuild) |
postEnvironmentStart | ✓ | ✓ | Every time the environment starts or resumes |
prebuild | ✗ | ✓ | During prebuild execution (no user secrets available) |
Related: Automations
Tasks and Services run within individual environments. For cross-repository automation at scale (migrations, security scanning, bulk updates), see Automations.Next steps
- Basic configuration - complete schema reference for all fields, commands, triggers, and execution environments
- Examples - common patterns for databases, servers, and CI
- Dynamic configuration - create tasks and services programmatically