Everstack
API ReferenceOpenai agents restCreate Session

Create Session

POST/v1/openai-agents/sessions
POST/v1/openai-agents/sessions

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Request Body

JSON request bodies are capped at 2 MiB.

PropertyTypeRequiredDescription
connection_idstringYes
idempotency_keystringYes
modelstringYes
instructionsstringNo
environmentobjectYes
inputobjectNo
toolsobject[]No

Responses

201 Success

PropertyTypeDescription
idstring
providerstring
connection_idstring
conversation_idstring
upstream_session_idstring
upstream_environment_idstring
sandbox_idstring
modelstring
environmentobject
statusstring
readinessstring
cleanup_statusstring
environment_cleanup_statusstring
last_errorstring
created_atstring
updated_atstring

400 Invalid request

PropertyTypeDescription
errorobject

403 Permission denied

PropertyTypeDescription
errorobject

404 Not found

PropertyTypeDescription
errorobject

409 Creation outcome is pending recovery

PropertyTypeDescription
errorobject

500 Internal error

PropertyTypeDescription
errorobject

503 Unavailable

PropertyTypeDescription
errorobject

Request

curl -X POST "http://localhost:8089/v1/openai-agents/sessions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"connection_id":"string","idempotency_key":"string","model":"string","instructions":"string","environment":{"type":"none","workspace_directory":"string"},"tools":[{"type":"string","resource_id":"string","name":"string"}]}'
const response = await fetch("http://localhost:8089/v1/openai-agents/sessions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "connection_id": "string",
  "idempotency_key": "string",
  "model": "string",
  "instructions": "string",
  "environment": {
    "type": "none",
    "workspace_directory": "string"
  },
  "tools": [
    {
      "type": "string",
      "resource_id": "string",
      "name": "string"
    }
  ]
}),
});
const data = await response.json();
import requests

response = requests.post(
    "http://localhost:8089/v1/openai-agents/sessions",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
  "connection_id": "string",
  "idempotency_key": "string",
  "model": "string",
  "instructions": "string",
  "environment": {
    "type": "none",
    "workspace_directory": "string"
  },
  "tools": [
    {
      "type": "string",
      "resource_id": "string",
      "name": "string"
    }
  ]
},
)
data = response.json()

Response

{
  "id": "string",
  "provider": "string",
  "connection_id": "string",
  "conversation_id": "string",
  "upstream_session_id": "string",
  "upstream_environment_id": "string",
  "sandbox_id": "string",
  "model": "string",
  "environment": {
    "type": "none",
    "workspace_directory": "string"
  },
  "status": "string",
  "readiness": "string",
  "cleanup_status": "string",
  "environment_cleanup_status": "string",
  "last_error": "string",
  "created_at": "string",
  "updated_at": "string"
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}