Skip to main content
PATCH
/
sessions
/
{session_id}
Update a session
curl --request PATCH \
  --url https://api.example.com/sessions/{session_id} \
  --header 'Content-Type: application/json' \
  --header 'x-user-id: <x-user-id>' \
  --data '
{
  "name": "<string>",
  "chat_model_config": {
    "type": "<string>",
    "credential_id": "<string>",
    "model": "<string>",
    "parameters": {}
  }
}
'
{
  "user_id": "<string>",
  "agent_id": "<string>",
  "config": {
    "workspace_id": "<string>",
    "name": "<string>",
    "chat_model_config": {
      "type": "<string>",
      "credential_id": "<string>",
      "model": "<string>",
      "parameters": {}
    }
  },
  "id": "<string>",
  "updated_at": "2023-11-07T05:31:56Z",
  "created_at": "2023-11-07T05:31:56Z",
  "source": "user",
  "source_schedule_id": "<string>",
  "state": {
    "session_id": "<string>",
    "summary": "",
    "context": [
      {
        "name": "<string>",
        "content": [
          {
            "text": "<string>",
            "type": "text",
            "id": "<string>"
          }
        ],
        "id": "<string>",
        "metadata": {},
        "created_at": "<string>",
        "finished_at": "<string>",
        "usage": {
          "input_tokens": 123,
          "output_tokens": 123
        }
      }
    ],
    "reply_id": "<string>",
    "cur_iter": 0,
    "permission_context": {
      "mode": "default",
      "working_directories": {},
      "allow_rules": {},
      "deny_rules": {},
      "ask_rules": {}
    },
    "tool_context": {
      "max_cache_files": 100,
      "max_cache_bytes": 25000,
      "read_file_cache": [
        {
          "lines": [
            "<string>"
          ],
          "updated_at": 123,
          "bytes": 123,
          "file_path": "<string>"
        }
      ],
      "activated_groups": [
        "<string>"
      ]
    },
    "tasks_context": {
      "tasks": [
        {
          "subject": "<string>",
          "description": "<string>",
          "metadata": {},
          "created_at": "<string>",
          "state": "pending",
          "id": "<string>",
          "owner": "<string>",
          "blocks": [
            "<string>"
          ],
          "blocked_by": [
            "<string>"
          ]
        }
      ]
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.agentscope.io/llms.txt

Use this file to discover all available pages before exploring further.

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Path Parameters

session_id
string
required

Query Parameters

agent_id
string
required

Agent the session belongs to.

Body

application/json

Request body for updating an existing session.

Omit any field to keep its current value.

name
string | null

New display name.

chat_model_config
ChatModelConfig · object

New model configuration. Replaces the existing one entirely.

permission_mode
enum<string> | null

New permission mode for the session.

Available options:
default,
accept_edits,
explore,
bypass,
dont_ask

Response

Successful Response

The session record.

user_id
string
required
agent_id
string
required
config
SessionConfig · object
required

Session configuration — set at creation, updatable via PATCH.

id
string

Unique identifier for the credential.

updated_at
string<date-time>
created_at
string<date-time>
source
enum<string>
default:user

The source that created the session.

Available options:
user,
schedule
source_schedule_id
string | null
state
AgentState · object

The agent state that should be saved and loaded from storage.