Home / Servers / OpenAI API / create_agent_session

Create an agent session

An MCP tool from the OpenAI API server, hosted on mcp.hjlabs.in.

Create an agent session Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See running sessions. [POST /agents/sessions]

Name on the gateway: openai_api__create_agent_session · may change things.

Parameters

NameTypeDescription
reviewnone | auto_reviewAction review mode. Omit to use none.
metadataobjectUp to 16 string key-value pairs, with keys up to 64 and values up to 512…
agentobjectAgent configuration. With agent_id, supplied fields override the saved agent…
agent_idstringThe ID of a saved reusable agent. Omit agent to use its configuration unchanged.
environment requiredobjectAn inline execution environment or a reference to an environment template.
vault_idsarrayThe IDs of vaults made available to the session.
inputstringInitial input to submit when the session is created. A string is shorthand for…
streambooleanWhether to stream session events as server-sent events. Defaults to false.
stream_optionsobjectOptions for the event stream. Only allowed when stream is true.

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "openai_api__create_agent_session",
  "arguments": {
    "environment": "…"
  }
}

Or connect the OpenAI API server directly, which lists 371 tools including this one:

Run in your terminal
claude mcp add --transport http hj-openai-api https://mcp.hjlabs.in/mcp/openai-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the create an agent session tool with review set to ….

More from OpenAI API