Skip to main content
Glama

Create session

create_session
Destructive

Start a new agent session and optionally enqueue the first message to begin processing immediately; omit input to create an idle session stub.

Instructions

Create a new session for an agent. When input is provided, the message is enqueued and the agent begins processing — the response returns 202 with the session in processing or queued state. When input is omitted, an idle session stub is created and the response returns 201.

agent_id also accepts the reserved aliases gumball and analytics, which resolve to your personal Gumball and analytics agents (created on first use).

Streaming the response

api.gumloop.com only serves the non-streaming response above. To stream agent output as it's produced, send the same request body (with stream: true) to the streaming host instead:

POST https://ws.gumloop.com/api/v1/agents/{agent_id}/sessions

The response is text/event-stream (Server-Sent Events). With the Python SDK, client.sessions.stream(agent_id, input="...") routes to ws.gumloop.com automatically and yields parsed StreamEvent objects.

If you send stream: true to api.gumloop.com by mistake, the response is a 400 whose body contains the correct streaming host so you can retry against it. Explicit confirmation is required for this exact account operation. Runs can spend credits or trigger downstream actions; never resubmit unknown outcomes automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
inputNoThe first user message for the session. Also accepted as `message` for backwards compatibility. When omitted, an idle session is created with no messages.
streamNoMust be `false` (or omitted) when calling `api.gumloop.com`. Set to `true` only when calling `ws.gumloop.com` (see the streaming section above).
accountNoNamed private Gumloop account; selects private credentials and user/team identity.
confirmNoSet true only when the user asked for exactly this action.
payloadNoComplete JSON request body instead of body flags. Preserves current endpoint fields and values.
agent_idYesID of the agent to start a session on. Also accepts the reserved aliases `gumball` and `analytics`.
metadataNoArbitrary key/value metadata attached to the session. Stored under `metadata.client`.
session_idNoCaller-supplied session ID. When omitted, the server generates one. If provided and the ID already exists, the request returns `409 session_already_exists`.
payload_fileNoRegular local JSON body file, at most 5 MB. Cannot be mixed with body flags or payload.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv3.0.0
    • addedInput schema / $defs / name
      Added value: +{
      +  "description": "Optional display name for the session. Leading and trailing whitespace is removed before the 1-256 character limit is applied, so an empty or whitespace-only value is rejected. A name you supply is kept; the automatic title only fills in sessions created without one. Rename the session later with `PATCH /sessions/{session_id}`.",
      +  "maxLength": 256,
      +  "type": "string"
      +}
    • changedInput schema / properties / confirm / description
      Previous value: -"Must be true for this exact requested account change, agent/flow execution, upload or deletion."New value: +"Set true only when the user asked for exactly this action."
    • addedInput schema / properties / name / $ref
      Added value: +"#/$defs/name"
    • removedInput schema / properties / name / description
      Removed value: -"Optional display name for the session. Leading and trailing whitespace is removed before the 1-256 character limit is applied, so an empty or whitespace-only value is rejected. A name you supply is kept; the automatic title only fills in sessions created without one. Rename the session later with `PATCH /sessions/{session_id}`."
    • removedInput schema / properties / name / maxLength
      Removed value: -256
    • removedInput schema / properties / name / type
      Removed value: -"string"
    • addedInput schema / properties / payload / properties / name / $ref
      Added value: +"#/$defs/name"
    • removedInput schema / properties / payload / properties / name / description
      Removed value: -"Optional display name for the session. Leading and trailing whitespace is removed before the 1-256 character limit is applied, so an empty or whitespace-only value is rejected. A name you supply is kept; the automatic title only fills in sessions created without one. Rename the session later with `PATCH /sessions/{session_id}`."
    • removedInput schema / properties / payload / properties / name / maxLength
      Removed value: -256
    • removedInput schema / properties / payload / properties / name / type
      Removed value: -"string"
  2. First observedv2.0.1

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations (destructive/openWorld/non-idempotent): it discloses status codes for each mode, session state transitions, the streaming host split, the 400 misrouted-stream error containing the correct host, the 409 session_already_exists case, and a credit-spend/confirmation warning with 'never resubmit unknown outcomes automatically'. This is exactly the behavioral context annotations alone cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core action and mode behavior, then uses a labeled streaming section. It is somewhat long, and the trailing confirmation paragraph reads as appended boilerplate, but every section serves the complex, multi-host semantics of this tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description covers the return surface (201/202 states, SSE stream, 400 and 409 errors) and the streaming host distinction. For a 10-parameter tool with nested objects, it supplies what an agent needs to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 90%, so the baseline is 3. The description adds meaning beyond the schema by explaining that agent_id aliases gumball/analytics resolve to personal agents created on first use, and by clarifying that input enqueues a message and starts processing versus creating an idle stub.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Create a new session for an agent') and clearly distinguishes the two operating modes (input provided → 202 processing/queued; input omitted → 201 idle stub). It does not, however, name the sibling tools it competes with (e.g., send_message, queue_session_message), so sibling differentiation is left implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete conditions for the two creation modes and for the streaming host, plus the confirm requirement. It stops short of routing the agent among alternatives like send_message or queue_session_message when a session already exists, so it is strong context without explicit exclusion guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools