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
| Name | Type | Description |
|---|---|---|
review | none | auto_review | Action review mode. Omit to use none. |
metadata | object | Up to 16 string key-value pairs, with keys up to 64 and values up to 512… |
agent | object | Agent configuration. With agent_id, supplied fields override the saved agent… |
agent_id | string | The ID of a saved reusable agent. Omit agent to use its configuration unchanged. |
environment required | object | An inline execution environment or a reference to an environment template. |
vault_ids | array | The IDs of vaults made available to the session. |
input | string | Initial input to submit when the session is created. A string is shorthand for… |
stream | boolean | Whether to stream session events as server-sent events. Defaults to false. |
stream_options | object | Options 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:
{
"name": "openai_api__create_agent_session",
"arguments": {
"environment": "…"
}
}Or connect the OpenAI API server directly, which lists 371 tools including this one:
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 ….