Agents

Create an agent environment

Changed on

Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.

post/agents/environments

Request

  • Base URL
    https://api.openai.com/v1
  • URL
    https://api.openai.com/v1/agents/environments
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment.

Request body

vault_idsstring[] nullable

The IDs of up to 10 vaults made available to an OpenAI-hosted environment.

Response

The created OpenAI-hosted environment.

type'openai_hosted' | 'self_hosted' required

The kind of execution environment.

idstring required

The ID of the environment.

object'agent.environment' required

The object type. Always agent.environment.

status'pending' | 'ready' | 'connected' | 'disconnected' | 'suspended' | 'expired' | 'failed' required

The public lifecycle status of an execution environment.

Changes