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.

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 (gpt-image-*, gemini-*-image-preview, dall-e-*) 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, every completion they make is automatically charged at half the standard credit cost. No SDK change required — pricing is set server-side from the user’s account.

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.

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: