Skip to main content
The Environments Service provides comprehensive management of execution environments through the Kubiya platform. Environments define isolated execution contexts for your agents and workflows, including worker registration and resource allocation.

Environments: detailed guide

This page focuses on the environment-specific parts of the SDK: creation, configuration, status management, and worker registration. If you haven’t set up a ControlPlaneClient yet, see the Client Quick Start at Client Overview for initialization and authentication instructions.

Create an environment example

The following example demonstrates creating an environment using the Control Plane SDK:

Core Operations

List Environments

Retrieve a list of environments with optional status filtering:
Parameters: Environment statuses:

Get Environment Details

Fetch a single environment’s details by UUID:

Create Environment

Create a new environment:
Environment configuration fields: Execution environment fields:

Update Environment

Update an existing environment’s configuration (partial update - only provided fields are updated):

Delete Environment

Permanently remove an environment by UUID:

Worker Registration

Get Worker Command

Get the worker registration command for an environment. This returns the kubiya worker start command with the worker token:
This command can be used to register new workers with the environment, enabling them to execute tasks.

Error Handling

The Environments Service raises EnvironmentError for API errors:

Best Practices

  • Use descriptive environment names (e.g., production, staging, development)
  • Monitor environment status, especially during provisioning
  • Keep track of environment UUIDs for worker registration
  • Use separate environments for different deployment stages
  • Check environment status before routing tasks to workers
  • Handle provisioning status appropriately in automation scripts

Common Patterns

Set Up Multiple Environments

Environment Health Check