Skip to main content
Dynamic tasks and services let you create and update environment configuration on the fly - no manual file editing required. This is particularly powerful for agents, who can generate tasks based on what they discover in your codebase.

Why this matters for agents

When Ona Agent explores a new repository, it can:
  • Discover package.json scripts and expose them as tasks
  • Find services in a monorepo and create start commands for each
  • Generate test tasks for different modules it finds
  • Adapt the environment to match the project structure
This makes agents immediately productive in unfamiliar codebases.

Creating tasks and services dynamically

Use the CLI to pipe configuration directly:
echo '{"tasks": {"update_deps": {"name": "Update dependencies", "command": "npm update"}}}' | gitpod automations update -
The - signals reading from stdin. Task and service IDs can only contain alphanumeric characters, underscores, and hyphens (1-128 characters).

Example uses

Expose package.json scripts as tasks:
jq -r '.scripts | to_entries[] | {(.key | gsub("[^a-zA-Z0-9_-]"; "_")): {"name": .key, "command": .value}}' package.json |
jq -s 'add | {"tasks": .}' |
gitpod automations update -
Create services for monorepo components:
find ./components -type d -maxdepth 1 -mindepth 1 |
jq -R '{(. | gsub("[^a-zA-Z0-9_-]"; "_")): {"name": "Start " + ., "command": "cd " + . + " && go run ."}}' |
jq -s 'add | {"services": .}' |
gitpod automations update -
Load configuration from a remote source:
curl https://example.com/automations.json | gitpod automations update -
Only download configuration from sources you trust. Verify integrity before applying.

Control from outside environments

You can manage tasks and services from outside an environment - from your local machine or CI/CD pipelines. This enables:
  • Batch processing: Run tasks across multiple environments in parallel
  • CI/CD integration: Trigger environment tasks from your pipelines
  • Automated testing: Spin up ephemeral environments, run tests, clean up
  • Agent orchestration: Coordinate multiple agents working on different tasks

Example: create, run task, clean up

# Create environment
ENV_ID=$(gitpod environment create https://github.com/your-repo/project --dont-wait --class-id some-env-class-id)

# Run a task
TASK_ID=$(gitpod automations task start build-and-test --environment-id $ENV_ID)

# Stream logs
gitpod automations task logs $TASK_ID --environment-id $ENV_ID

# Check result and clean up
TASK_STATUS=$(gitpod automations task get $TASK_ID --environment-id $ENV_ID -o json | jq -r .status)

if [ "$TASK_STATUS" = "succeeded" ]; then
    gitpod environment delete $ENV_ID
else
    echo "Task failed. Environment left for inspection."
fi
This pattern - create, execute, clean up - is how agents and CI/CD pipelines use Ona environments as ephemeral execution platforms.