Skip to main content
The Environments Service enables you to manage runtime environments for agent and team execution. Environments provide isolated execution contexts with their own worker pools, configurations, and resources.

Quick Start

Features

Environment Management

Create and configure isolated environments

Worker Registration

Generate commands for worker registration

Auto-Provisioning

Automatic Temporal namespace setup

Status Tracking

Monitor environment provisioning status

List Environments

Retrieve all environments in your organization:
Parameters:
  • status_filter (str, optional): Filter by status: ‘active’, ‘inactive’, ‘provisioning’, ‘ready’, or ‘error’
Returns: List of environment dictionaries

Get Environment

Retrieve a specific environment by ID:
Parameters:
  • environment_id (str, required): Environment UUID
Returns: Dictionary containing environment details

Create Environment

Create a new environment:
Parameters:
  • environment_data (dict, required): Environment configuration
    • name (str): Environment name
    • description (str): Environment description
    • status (str, optional): Environment status (default: ‘active’)
    • configuration (dict, optional): Environment-specific configuration
    • metadata (dict, optional): Additional metadata
Returns: Dictionary containing created environment details
If this is the first environment for your organization, it will trigger the Temporal Cloud namespace provisioning workflow automatically.

Update Environment

Update an existing environment (partial update):
Parameters:
  • environment_id (str, required): Environment UUID
  • environment_data (dict, required): Fields to update (partial update)
    • name (str, optional): Environment name
    • description (str, optional): Description
    • status (str, optional): Environment status
    • configuration (dict, optional): Configuration settings
    • metadata (dict, optional): Additional metadata
Returns: Dictionary containing updated environment details

Delete Environment

Delete an environment:
Parameters:
  • environment_id (str, required): Environment UUID
Returns: None (204 No Content on success)
You cannot delete the default environment. Deleting an environment will stop all workers registered to it.

Worker Registration

Get Worker Command

Get the registration command for workers in an environment:
Parameters:
  • environment_id (str, required): Environment UUID
Returns: Dictionary containing:
  • command (str): Full worker start command
  • worker_token (str): Worker authentication token
  • temporal_namespace (str): Temporal namespace
  • environment_name (str): Environment name
Copy the worker command and run it on your worker machines to register them with the environment.

Worker Registration Example

Complete Example

Here’s a complete example of setting up environments for different stages:

Error Handling

Handle environment-related errors:

Environment Provisioning

Understanding Environment States

Environments go through several states during provisioning:
  1. provisioning: Initial state when environment is created
  2. ready: Temporal namespace is provisioned and ready
  3. active: Environment is active and accepting work
  4. error: Provisioning failed or environment error occurred
  5. inactive: Environment is disabled

Monitoring Provisioning

Best Practices

Environment Strategy

  • Environment Per Stage: Create separate environments for dev, staging, and production
  • Isolated Resources: Use environments to isolate different workloads
  • Naming Convention: Use clear, consistent naming (e.g., “production-us-east”)
  • Default Environment: Reserve the default environment for testing and development

Worker Management

  • Dedicated Workers: Deploy dedicated workers for each environment
  • Worker Scaling: Scale workers based on environment workload
  • Secure Tokens: Treat worker tokens as secrets; rotate regularly
  • Health Monitoring: Monitor worker health and connectivity

Configuration

  • Resource Limits: Set appropriate max_workers and timeout values
  • Metadata: Use metadata to track ownership, cost centers, and stages
  • Status Management: Use status to control environment availability
  • Regular Reviews: Review environment configurations periodically

Security

  • Token Rotation: Regularly rotate worker tokens
  • Access Control: Limit who can create/modify environments
  • Network Isolation: Use network policies to isolate environment workers
  • Audit Logging: Monitor environment changes and access

Use Cases

Multi-Stage Deployment

Multi-Region Setup

Team Isolation

Testing Environments

API Reference

Next Steps

Workers Service

Monitor and manage workers

Agents Service

Deploy agents to environments

Teams Service

Run teams in specific environments

Jobs Service

Schedule jobs to run in environments