Skip to main content
Copy and adapt these examples for your projects. These patterns work for both humans and agents - when Ona Agent sees these tasks available, it can use them as part of its run loop.

Database provisioning

Start PostgreSQL and seed it with development data:
services:
  postgresql:
    name: PostgreSQL
    description: Development database
    triggeredBy:
      - postDevcontainerStart
    commands:
      start: docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:15
      ready: docker exec postgres pg_isready -U postgres

tasks:
  seed:
    name: Seed database
    triggeredBy:
      - manual
    command: ./scripts/seed-dev-db.sh

Build and test pipeline

Chain tasks with dependencies:
tasks:
  build:
    name: Build
    command: yarn && yarn build

  test:
    name: Run tests
    dependsOn:
      - build
    command: yarn test

  setup:
    name: Full setup
    dependsOn:
      - build
      - test
    triggeredBy:
      - postDevcontainerStart
    command: echo "Ready to develop"
Agents can run test knowing it will build first.

Cloud authentication

Authenticate with AWS using Ona’s identity provider:
tasks:
  aws-auth:
    name: AWS Auth
    triggeredBy:
      - postEnvironmentStart
    command: gitpod idp login aws --role arn:aws:iam::123456789:role/dev-role

Preview server

Serve your application for testing:
services:
  preview:
    name: Preview server
    triggeredBy:
      - postDevcontainerStart
    commands:
      start: |
        npm install
        npm run build
        npx serve -p 3000 ./build
      ready: curl -sf http://localhost:3000 > /dev/null
Agents can share this preview URL when demonstrating changes.

Jupyter notebook

Start Jupyter for data science work:
services:
  jupyter:
    name: Jupyter Notebook
    triggeredBy:
      - manual
    commands:
      start: |
        pip install jupyter pandas numpy matplotlib
        jupyter notebook --ip=0.0.0.0 --no-browser
      ready: curl -sf http://localhost:8888 > /dev/null

Storybook

Component development with hot reload:
services:
  storybook:
    name: Storybook
    triggeredBy:
      - manual
    commands:
      start: yarn storybook
      ready: curl -sf http://localhost:6006 > /dev/null

Parallel database testing

Test against multiple database versions:
services:
  pg14:
    name: Postgres 14
    commands:
      start: docker run -d --name pg14 -p 5432:5432 postgres:14
      ready: docker exec pg14 pg_isready

  pg15:
    name: Postgres 15
    commands:
      start: docker run -d --name pg15 -p 5433:5432 postgres:15
      ready: docker exec pg15 pg_isready

tasks:
  test-compat:
    name: Compatibility tests
    triggeredBy:
      - manual
    command: |
      DATABASE_URL=postgres://localhost:5432 npm test
      DATABASE_URL=postgres://localhost:5433 npm test

Troubleshooting environment

Manual task for debugging production issues:
tasks:
  troubleshoot:
    name: Setup troubleshooting
    triggeredBy:
      - manual
    command: |
      sudo apt-get update && sudo apt-get install -y htop iftop
      ./scripts/setup-vpn.sh