Skip to main content
The Gumloop Python SDK ships two clients:
  • Gumloop — the modern resource client used for chat completions, agents, sessions, MCP, skills, artifacts, and teams.
  • GumloopClient — the legacy flows client used to start saved automations and poll for outputs. Emits a DeprecationWarning at construction.
Pick Gumloop for new code. Use GumloopClient only if you need run_flow against an existing saved automation.

Installation

Chat completions

client.chat.completions.create(...) is an OpenAI-compatible chat surface that routes to every model Gumloop supports (Anthropic, OpenAI, Google Gemini, OpenRouter routes). The streaming variant returns an iterator of ChatStreamChunk; the unary variant returns a ChatResult.
model must be a concrete model. gumloop-chew — the Auto router — picks a model instead of being one. Use client.models.route(...) (or POST /models/route) to get the model it would choose, then pass that here. Requires a current gumloop package that includes the models resource.

Streaming

Structured output

Pass response_format={"type": "json_schema", "json_schema": {...}} to constrain the response to a JSON Schema. The SDK accepts the same shape the OpenAI API documents.

Image generation

Request an image-generation model such as gpt-image-2.5-flare or gemini-*-image-preview with modalities=["image", "text"]. The response carries image attachments on choices[0].message.images as data URLs. Streaming variants emit partial frames natively for OpenAI gpt-image models.

Tool calling

Pass OpenAI-shape tool definitions; the SDK forwards them unchanged so any LLM that supports function calling can invoke them.

Bring your own provider key

When the calling user has configured their own provider API key (OpenAI, Anthropic, etc.) in Gumloop, billing follows that account’s pricing policy. Usage pricing can waive inference for BYOK; some legacy organizations use a partial discount. See Credits. No SDK change is required.

MCP tools

client.mcp.execute(...) returns an McpExecuteResponse with one result per tool call. MCP execution failures, such as target server authentication errors or upstream connection failures, are reported on each result instead of being raised as APIStatusError. Gumloop request errors, such as missing credentials, invalid request bodies, or endpoint permission failures, can still raise APIStatusError.
decoded_content is a Python SDK convenience property. Raw REST responses include the underlying content array.

Agent versions

Every agent keeps an immutable history of its configuration. client.agents.list_versions(...) pages through those snapshots newest-first, and client.agents.get_version(...) returns one version’s full configuration plus the structured diff against the version before it.
Both calls require configuration access on the agent, and they are read-only — deploying or restoring a version has to happen in the app.

Evaluations

client.agents.list_evaluations(...) pages through an agent’s graded chats newest-first, client.agents.get_evaluation_metrics(...) returns grade and tag counts over a window, and client.agents.run_evaluations(...) queues evaluations for finished sessions. client.agents.get_evaluation_options() lists the criterion types, priorities, and limits the config accepts.
Listing and metrics need read access on the agent and cover the chats you can see. Running evaluations needs edit access and consumes one credit per session; pass dry_run=True to see the cost and the sessions that would be skipped (unfinished, or already queued) without queuing anything. Results from an organization evaluation enforced on the agent are listed with list_evaluations(agent_id, organization_evaluation_id=...).

Organization evaluations

client.evaluations manages rubrics an organization admin defines once and applies to teams, people, or individual agents (Enterprise plan, Manage evaluations permission). A new evaluation starts disabled: set its targets, then enable it. Run it over past sessions with run(...); grading is asynchronous, so poll each returned result id.
client.evaluations.options() returns the allowed values for every enum field (grades, statuses, target types, session types, criterion priorities) and the size limits.

Company Brain

client.brain.search(...) runs a hybrid (semantic + keyword) search across the knowledge sources indexed in your Company Brain and returns ranked results scoped to what you can access. Brain is available on the Pro and Enterprise plans, and each search consumes credits.
Each result carries document_id, source, title, content, url, score, updated_at, owner_name, owner_email, parent_title, and metadata. Omit source_type to search every source you can access; valid values are notion, google_drive, slack, github, confluence, direct_file_uploads, and gumloop_artifacts.

Flows (legacy client)

Optionally add a project_id when creating the client if running automations in a workspace: