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 aDeprecationWarningat construction.
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
Passresponse_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 asgpt-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 configuration
Everything the agent panel can set is available throughclient.agents. create takes the whole configuration in one call. After that, settings change through update, and each collection has its own attach/detach pair so one item changes without re-sending the rest.
retrieve returns the whole agent: tools, metadata, abilities, skill_ids, knowledge_sources, triggers and version. Pass that version back on update and the call fails with agent_version_conflict if someone else saved the agent in between; leave it out and the last write wins.
create_trigger and from get_trigger_webhook_url, never in list_triggers or retrieve. delete removes a custom agent; gumball and analytics can be read and chatted with but not configured.
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.
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.
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.
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.
Sources and files
Create file-upload sources and put files into them. Onlydirect_file_uploads sources can be created through the SDK; connected sources are set up in the app.
list_sources(scope=..., source_type=..., team_id=..., page_size=..., cursor=...) and get_source(id) read sources of every type. A source created with require_approval=True is a draft: get_estimate(id).estimate.estimated_credits shows the cost once estimate.status is paused_for_approval, and approve_source(id) starts indexing. Every file’s sha256 lets you diff a local folder against a source; the CLI’s gumloop brain sync does exactly that.
Flows (legacy client)
project_id when creating the client if running automations in a workspace: