Skip to content
中文

Create Session

Call Create agent first and replace the example agent ID with its returned ID.

POST/agent/v1/sessions◐ Partial

Official Claude documentation ↗

Request body

  • modelstringoptional

    A model ID from the Praxis model catalog (praxis.model.models.list), or a model_config object. Unlike Anthropic, Claude model IDs absent from the catalog are rejected.

  • agentstring | objectrequired

    The agent the session runs: an agent ID string, or an object {type: "agent", id, version?}. An ID alone, or an object without version, pins the agent's active_version when the session is created (the version chosen with agents.versions.apply, not necessarily the newest saved one); version pins that exact version. Unlike Managed Agents, the only inline override is the system prompt (type agent_with_overrides); to change the model, tools, MCP servers or skills, save a version instead.

    Expand sub-fields (4)
    • idstringrequired

      The ID of the agent the session runs.

    • typestringrequired

      Reference type: agent, or agent_with_overrides when the reference carries inline overrides.

      values agentagent_with_overrides
    • versionnumberoptional

      The specific agent version to pin; omit for active_version at session creation, which need not be the newest saved version.

    • systemstringoptional

      Replacement system prompt for this session, up to 100,000 characters; null clears it, omitting keeps the agent's.

  • environment_idstringoptional

    ID of the environment the session runs in; it determines the container's base environment.

  • titlestringoptional

    Human-readable session title.

  • metadataobjectoptional

    Custom metadata key-value pairs for the session.

  • budgetobjectoptional

    Spending cap for the session.

    Expand sub-fields (2)
    • max_list_costobjectrequired

      Largest list-price cost the session may reach: {amount, currency: "USD"} where amount is in US dollars, an integer or up to 2 decimals on input ("0.50") and exactly 2 decimals on output ("20.00").

    • typestringrequired

      Budget kind; always limit. Any other value, including max_list_cost, returns 400.

      values limit
  • initial_eventsarrayoptional

    Initial events sent to the session in order at creation; user.message and user.define_outcome are supported, up to 50.

  • resourcesarrayoptional

    Resources (e.g. repositories, files) to mount into the session's container.

  • vault_idsarrayoptional

    Vault IDs for stored credentials the agent can use during the session.

  • cwdstringoptional
    default "/home/user/workspace"

    Session working directory on any machine. Must be an absolute path within /home/user with no . or .. segments. Repeated and trailing slashes are normalized. Invalid values return 400 invalid_request_error with Invalid cwd.

  • More parameters (4)
    • workspacestringoptional

      Praxis extension: where the session's work happens. shared (default) opens it in the project's own folder; isolated asks for a session-owned git worktree when a named project's folder is a git repository, so concurrent desks in one project never touch each other's files. An explicit cwd is always taken as given, and a project that is not a git repository is always shared.

      values sharedisolated
    • computer_idstringoptional

      Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined.

    • time_zonestringoptional
      default "UTC"

      Praxis extension: the session's IANA time zone name (e.g. Asia/Shanghai) — the clock the runtime environment block renders for every turn. Absent means UTC. Only IANA names are accepted; fixed offsets ("+08:00") and unknown names return 400. Never stored in metadata.

    • thinkingobjectoptional

      Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.

      Expand sub-fields (1)
      • effortstringrequired

        Thinking level for this session. The model must support the chosen effort; none requires can_disable. Null on thinking restores inheritance from the agent and model.

        values lowmediumhighxhighmaxnone

Returns

201

Create with optional model (an ID string in models.allowed; only the default if no list) and thinking ({effort: "low|medium|high|xhigh|max|none"} or null), saved before initial_events execute. Omitted or null thinking inherits the agent default, then the model default. Efforts must be in model.thinking.efforts; none requires can_disable. Invalid selections return 400 invalid_request_error. The response includes thinking and model.thinking: {efforts, can_disable, default_effort}; unknown capability and an unspecified default_effort are null. Example: {"agent":"agent_123", "model":"deepseek-v4-flash","thinking":{"effort":"xhigh"}}. These selection fields belong only to /agent/v1. Create an agent first and replace agent_123 with its returned id. Omit environment_id: a service agent uses the environment_id of the version the session runs (light for a new agent); a general agent uses its explicit or agent-default computer_id Computer. Select node22 or a tenant-owned cloud environment for a sandbox recipe. For service agents, explicit environment_id: null allocates no machine, so codemode, bash and other machine tools are unavailable; omission returns the environment_id of that version. A bare agent id, or an object without version, pins the agent's active_version (the version chosen with agents.versions.apply, not necessarily the newest saved one). Unlike Managed Agents, the only inline agent override is system ({type: "agent_with_overrides", id, system}); to change the model, tools, MCP servers or skills, save a version instead. budget ({type: "limit", max_list_cost: {amount, currency: "USD"}}, amount in US dollars as an integer or up to 2 decimals such as "0.50", returned with exactly 2 decimals, default "20.00", null for no limit) and vault_ids (at most 50, owned by the organization and not archived) are supported. File resources are persisted, up to 500 per session; sandbox synchronization is not implemented in this batch. An archived agent returns 409 Agent is archived; unarchive it to start new sessions. Existing sessions keep working.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Request

curl
# Call Create agent first and replace the example agent ID with its returned ID.
curl https://api.deepraxis.com/agent/v1/sessions \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent":"agent_123","title":"文档测试"}'
Python
# Call Create agent first and replace the example agent ID with its returned ID.
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.post(
    f"{opts['base_url']}/v1/sessions",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
    json={"agent":"agent_123","title":"文档测试"},
)
print(resp.status_code, resp.json())
TypeScript
// Call Create agent first and replace the example agent ID with its returned ID.
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions`, {
  method: "POST",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({"agent":"agent_123","title":"文档测试"}),
});
console.log(resp.status, await resp.json());

Response 201

{
  "id": "sesn_3b59c989a48e4702a4290fc32fdb1074",
  "type": "session",
  "cwd": "/home/user/workspace",
  "forked_from": null,
  "model": {
    "id": "deepseek-flash",
    "thinking": {
      "efforts": [
        "low",
        "high",
        "max"
      ],
      "canDisable": true,
      "defaultEffort": "high"
    }
  },
  "thinking": null,
  "permission_mode": null,
  "agent": {
    "id": "agent_f4a1c1ec-7609-4e09-97de-0410e5ace3f0",
    "type": "agent",
    "name": "文档助手",
    "description": null,
    "system": "用一句话简短回答。",
    "model": {
      "id": "deepseek-flash"
    },
    "version": 1,
    "tools": [],
    "skills": [],
    "mcp_servers": [],
    "multiagent": null,
    "kind": "service",
    "bindings": []
  },
  "environment_id": "light",
  "time_zone": "UTC",
  "title": "文档测试",
  "metadata": {},
  "created_at": "2026-10-24T05:58:53.812Z",
  "updated_at": "2026-10-24T05:58:55.228Z",
  "archived_at": null,
  "status": "idle",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "cache_read_input_tokens": 0,
    "list_cost": {
      "amount": "0.000000",
      "currency": "USD"
    },
    "runtime_cost": {
      "amount": "0.000000",
      "currency": "USD"
    }
  },
  "stats": {},
  "budget": {
    "type": "limit",
    "max_list_cost": {
      "amount": "20.00",
      "currency": "USD"
    }
  },
  "resources": [],
  "vault_ids": [],
  "outcome_evaluations": [],
  "deployment_id": null,
  "external_user_id": null,
  "source": "api"
}

Response

HTTP 201

Successful response

application/json

Name Type Description
id string Session id (sesn_...). Pass it as session_id in every session call.
agent object Resolved agent definition for a session. Snapshot of the agent at session creation time.
agent.id string Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls.
agent.description null | string Free-text description of what the agent is for; null when none was set.
agent.mcp_servers array<object> Praxis extension: HTTP, SSE or trusted stdio MCP servers paired with mcp_toolset entries and saved with the agent version.
agent.model object Model identifier and configuration.
agent.multiagent null | object Resolved coordinator topology with full agent definitions for each roster member.
agent.name string Display name of the agent, as set on create or update. It is a label, not a unique key.
agent.skills array<object> Custom skills attached to the agent, each {type: "custom", skill_id, version?}: skill_id comes from skills.create or skills.list, at most 20 skills, no repeated skill_id. Omit version, or send "latest", to use the skill's newest version at the moment a session starts; a pinned version stays fixed. type anthropic returns 400: upload the skill and attach it as custom. On update, omit the field to keep the list, send an array to replace it, or send [] or null to clear it.
agent.system null | string System prompt given to the model at the start of every session of this agent; null when none was set.
agent.tools array<object> Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. Custom calls emit agent.custom_tool_use and wait for user.custom_tool_result. Keep bash enabled to use codemode, skill and subagents.
agent.type string Always agent. An agent definition.
agent.version number The latest saved version of the agent, the editable head; it differs from active_version after a save with apply false. Starts at 1 and increments each time the agent is modified.
archived_at null | string A timestamp in RFC 3339 format
budget null | object A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.
budget.max_list_cost object A monetary amount in a specific currency.
budget.type string Budget kind; always limit. Any other value, including max_list_cost, returns 400 budget.type must be "limit".
created_at string A timestamp in RFC 3339 format
environment_id string Execution environment of this session. A service session created without environment_id uses the default environment saved in the agent version (light for a new agent); null means it was created without a machine; Computer sessions may omit this field.
metadata object Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics.
outcome_evaluations array<object> Per-outcome evaluation state. One entry per define_outcome event sent to the session.
outcome_evaluations[].completed_at null | string A timestamp in RFC 3339 format
outcome_evaluations[].description string What the agent should produce.
outcome_evaluations[].explanation null | string Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.
outcome_evaluations[].iteration number 0-indexed revision cycle the outcome is currently on.
outcome_evaluations[].outcome_id string Server-generated outc_ ID for this outcome.
outcome_evaluations[].result string Current evaluation state. pending before the agent begins work; running while producing or revising; evaluating while the grader scores; satisfied/max_iterations_reached/failed/interrupted are terminal.
outcome_evaluations[].type string Always outcome_evaluation. Record of one outcome evaluation.
resources array<object> Resources attached to the session, at most 500; each is a file reference mounted into the session's machine.
resources[].id string Resource id, the resource_id of sessions.resources calls.
resources[].created_at string A timestamp in RFC 3339 format
resources[].mount_path string | null | string Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
resources[].type string Always github_repository. A GitHub repository resource; not supported on this platform. / Always file. A file resource: an uploaded file mounted into the session's machine. / Always memory_store. A memory store resource; not supported on this platform.
resources[].updated_at string A timestamp in RFC 3339 format
resources[].url string Repository URL.
resources[].checkout null | object Branch or commit to check out.
resources[].file_id string Id of the uploaded file; it must exist and belong to your tenant.
resources[].memory_store_id string The memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].access null | string Access mode for an attached memory store.
resources[].description string Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
resources[].instructions null | string Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
resources[].name null | string Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
stats object Timing statistics for a session.
stats.active_seconds number Cumulative time in seconds the session spent in running status. Excludes idle time.
stats.duration_seconds number Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
status string SessionStatus enum - rescheduling - Transient error occurred, retrying automatically. - running - Agent is actively executing. - idle - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - terminated - Session has ended, either due to an error or completion.
title null | string Title of the session, set on create or through sessions.update; null when none was set.
type string Always session. A session, one conversation of an agent on a machine.
updated_at string A timestamp in RFC 3339 format
usage object Cumulative token usage for a session across all turns.
usage.active_seconds number Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike stats.active_seconds, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.
usage.cache_creation object Prompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokens number Total tokens read from prompt cache.
usage.input_tokens number Total input tokens consumed across all turns.
usage.list_cost null | object Session total list-price cost in USD as a decimal string with exactly 6 decimals. Includes models, runtime and all other charged products attributed to this session; child-thread model cost is already included. The budget reads the same total. In-flight work may finish after the limit is reached.
usage.output_tokens number Total output tokens generated across all turns.
usage.server_tool_use null | object Cumulative count of server-executed tool invocations, broken down by tool.
usage.cost_by_product object USD list-price cost by product, as decimal strings with exactly 6 decimals. Values sum to list_cost.amount. router.llm is the larger of the live model meter and charged model facts; all other products use charged facts only.
usage.subagent_cost_micro_usd integer Child-thread model cost in integer micro-USD, already included in list_cost. This is a subset, not an additional charge; it excludes child-thread runtime.
vault_ids array<string> Vault IDs attached to the session at creation. Empty when no vaults were supplied.
deployment_id null | string Deployment ID when the session was created from a deployment reference. Null otherwise.
cwd string Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory.
workspace object Praxis extension: where this session's work happens. shared and isolated are the two kinds; an isolated session also names its path and branch.
workspace.kind string Kind of background task: bash for a command started with run_in_background, monitor for a monitor watch.
workspace.path string The worktree's own folder; present only when kind is isolated.
workspace.branch string The worktree's branch; present only when kind is isolated.
computer_id string Praxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected.
model object Praxis extension: the currently selected session model.
model.id string Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource.
model.thinking object | null Supported thinking controls, or null when capability is unknown or unavailable. efforts lists selectable strengths; can_disable permits none; default_effort is nullable.
thinking object | null Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.
thinking.effort string Thinking level saved for this session: low, medium, high, xhigh, max, or none to turn thinking off. Null or absent means the session inherits the agent default and then the model default.
forked_from object | null Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1.
forked_from.session_id string Id of the parent session this session was forked from; it is left unchanged by the fork.
forked_from.message_id string message_id of the agent message in the parent session up to which the conversation was copied.
external_user_id string | null End-user identifier associated with the session, or null when none is recorded. Own-face extension; use external_user_id on sessions.list to find this user's sessions.
source string | null Origin of the session: kit, iframe, hosted, api or automation; null when unavailable. Own-face extension; use source on sessions.list to filter by origin.