---
title: "Retrieve an agent environment"
method: GET
path: "/agents/environments/{environment_id}"
tags: ["Agents"]
---

# Retrieve an agent environment

`GET /agents/environments/{environment_id}`

## Request

- Base URL: `https://api.openai.com/v1`
- URL: `https://api.openai.com/v1/agents/environments/{environment_id}`
- Auth: HTTP bearer

Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle).

## Path parameters

- `environment_id` string, required

## Response `200`

The requested environment.

- PublicEnvironmentResource: Safe metadata for a first-class execution environment.
  - `type` 'openai_hosted' | 'self_hosted', required: The kind of execution environment.
  - `id` string, 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.
  - `files` HostedEnvironmentFileResource[], required: Files installed in the environment, without their contents.
    - union: Metadata for a file materialized in an OpenAI-hosted execution environment.
      - object: A file copied from the OpenAI Files API.
        - `type` 'file_id', required: The type of the object. Always `file_id`.
        - `id` string, required: The session-scoped ID of the file in the execution environment.
        - `file_id` string, required: The ID of the uploaded file.
        - `path` string, required: The file's absolute path inside the environment.
        - `size_bytes` integer, required: The decoded file size in bytes.
      - object: A file supplied inline when the session was created.
        - `type` 'inline', required: The type of the object. Always `inline`.
        - `id` string, required: The session-scoped ID of the file in the execution environment.
        - `path` string, required: The file's absolute path inside the environment.
        - `size_bytes` integer, required: The decoded file size in bytes.
  - `skills` HostedSkillResource[], required: Skills installed in the environment, without their archive contents.
    - union: A skill installed in an OpenAI-hosted environment.
      - object: A skill installed from the Skills API.
        - `type` 'skill_reference', required: The type of the object. Always `skill_reference`.
        - `skill_id` string, required: The referenced skill ID.
        - `version` string, required: The concrete skill version installed for this session.
        - `name` string, required: The installed skill name.
        - `description` string, required: The installed skill description.
      - object: A skill installed from an inline ZIP archive.
        - `type` 'inline', required: The type of the object. Always `inline`.
        - `name` string, required: The installed skill name.
        - `description` string, required: The installed skill description.
  - `plugins` HostedPluginResource[], required: Plugins installed in the environment, without their archive contents.
    - `type` 'inline', required: The type of the object. Always `inline`.
    - `name` string, required: The installed plugin name.
    - `description` string, required: The installed plugin description.

## Other responses

- `400`: The request was invalid.
- `401`: Authentication or project context was missing.
- `403`: The API key lacks the required permission.
- `404`: The requested session or event was not found.
- `409`: The request conflicted with the current session state.
- `500`: An internal error occurred.
- `503`: The service is temporarily unavailable.

## Changes

- **2026-10-08** `c686bf249e4c`: 1 warning
  - added the new `suspended` enum value to the `status` response property for the response status `200`
- **2026-10-08** `4ce25559b07f`: 1 warning
  - added the new `ready` enum value to the `status` response property for the response status `200`
- **2026-09-25** `d86203de41ae`: 1 info
  - added the non-success response with the status `403`
- **2026-09-10** `f2dae1a9aced`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openai/apis/openai-api-4/changes/agents/environments/:environment_id/get.md)

---

[API](https://skmtc.dev/openai/apis/openai-api-4.md) - [All operations](https://skmtc.dev/openai/apis/openai-api-4/llms.txt) - [OpenAPI document](https://skmtc.dev/openai/apis/openai-api-4/revisions/c18e6d2a2006?raw)
