Skip to content

Connect Gumloop to AI Agents: Orchestrate sessions and export data

Learn how to connect Gumloop to AI Agents using Truto's tools endpoint. Orchestrate sessions, poll workflow states, and safely export data autonomously.

Uday Gajavalli Uday Gajavalli · · 8 min read
Connect Gumloop to AI Agents: Orchestrate sessions and export data

You want to connect Gumloop to your AI agents so your autonomous systems can independently launch workflow sessions, poll for agent states, generate artifacts, and export data. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to hand-write custom integrations.

Giving a Large Language Model (LLM) read and write access to your automation pipelines is an engineering headache. You either spend weeks building, hosting, and maintaining a custom connector, or you use a managed infrastructure layer that handles the boilerplate for you. If your team uses ChatGPT, check out our guide on connecting Gumloop to ChatGPT, or if you are building on Anthropic's models, read our guide on connecting Gumloop to Claude. For developers building custom autonomous workflows, you need a programmatic way to fetch these tools and bind them to your agent framework. If you are comparing solutions, explore our guide on the best unified APIs for LLM function calling.

This guide breaks down exactly how to fetch AI-ready tools for Gumloop, bind them natively to an LLM using LangChain (or frameworks like LangGraph, CrewAI, or Vercel AI SDK), and execute complex orchestration workflows. For a deeper look at the architecture behind this approach, refer to our research on architecting AI agents and the SaaS integration bottleneck.

The Engineering Reality of Custom Gumloop Connectors

Building AI agents is easy. Connecting them to external SaaS APIs is hard. Giving an LLM access to external data sounds simple in a prototype. You write a Node.js function that makes a fetch request and wrap it in an @tool decorator. In production, this approach collapses entirely.

If you decide to build a custom integration for Gumloop, you own the entire API lifecycle. Gumloop's API introduces several specific integration challenges that break standard LLM assumptions.

Async Session Lifecycles and Status Codes

Gumloop workflows are heavily asynchronous. When you create a session for an agent, the API response varies based on your payload. Understanding how to handle long-running SaaS API tasks in AI agent tool-calling workflows is critical here. If you provide an input parameter, the session begins immediately, and the API returns a 202 Accepted with a state of processing or queued. If you omit the input, the API creates an idle stub and returns a 201 Created. An AI agent must understand this semantic difference. It must know when it needs to immediately start polling for completion versus when it needs to send a follow-up message to initialize the workflow. Hand-coding this logic requires extensive prompt engineering. Truto handles this by injecting clear state-transition rules directly into the tool schemas.

Two-Step Artifact Resolution

When a Gumloop agent generates a file, the API does not simply return the file bytes in a JSON response. Artifact retrieval is a strict two-step process. First, you query the API to get an artifact record containing metadata (filename, media type) and a signed download URL. Second, your system must follow that URL to download the opaque binary payload. LLMs are notoriously bad at handling binary streams and multi-step HTTP redirects. If you build this manually, your agent will hallucinate the file contents or fail to parse the binary buffer. Truto's tool abstractions provide clean interfaces that guide the LLM through this specific retrieval pattern.

Strict Schema Boundaries for Data Exports

The Gumloop data export endpoint is unforgiving. When initiating an export job for enterprise organizations, the API demands highly specific scoping parameters based on the data type. If you are exporting workflows or agents, you must provide at least one scope parameter like workspace_ids, include_all_workspaces, or include_personal_workspaces. If the LLM omits these, the API throws a hard 400 error. However, if the agent is exporting credit_logs, these parameters are not required. Manually mapping these conditional requirements into a JSON Schema for an LLM is error-prone. Truto normalizes these validation rules into the tool definitions automatically.

Rate Limits and Header Normalization

When orchestrating high-volume workflows, you will hit API limits. It is a factual reality that Truto does not retry, throttle, or apply automatic backoff on rate limit errors. When the upstream Gumloop API returns an HTTP 429 Too Many Requests, Truto passes that exact error directly back to your agent. However, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. Your agent framework is strictly responsible for reading these headers and executing a backoff strategy.

Fetching Gumloop Tools via Truto

Every integration on Truto operates on a concept of Resources and Methods, mapping standard CRUD operations to the underlying product's endpoints. Truto exposes these endpoints as Proxy APIs, handling authentication and pagination.

For AI agents, Truto translates these Methods into standardized tools via the /integrated-account/<id>/tools endpoint. Your framework can fetch these tools dynamically.

Here is how you fetch and bind these tools using the Truto SDK:

import { ChatOpenAI } from "@langchain/openai";
import { TrutoToolManager } from "@trutohq/truto-langchainjs-toolset";
 
// Initialize the LLM
const llm = new ChatOpenAI({
  modelName: "gpt-4o",
  temperature: 0,
});
 
// Initialize the Truto Tool Manager
const trutoTools = new TrutoToolManager({
  trutoAccessToken: process.env.TRUTO_API_KEY,
});
 
async function initializeAgent() {
  // Fetch tools for the connected Gumloop account
  const tools = await trutoTools.getTools("your_gumloop_integrated_account_id");
  
  // Bind the tools to the LLM
  const agentWithTools = llm.bindTools(tools);
  
  return agentWithTools;
}

By leveraging this endpoint, your agent automatically inherits schema updates, descriptions, and operational context without you maintaining massive boilerplate files.

Gumloop Hero Tools for AI Agents

To build effective orchestration workflows, you need high-leverage operations. Here are the core hero tools available for the Gumloop integration.

create_a_gumloop_session

This tool initiates a new Gumloop session for a specific agent. It handles the critical 201 vs 202 response logic depending on whether you provide initial input. This is the entry point for all dynamic workflow execution.

"Start a new session for the data enrichment agent (ID: agt_123). Provide the initial input payload with the target company domain 'acme.com'."

get_single_gumloop_session_by_id

This tool retrieves the current state, messages, and participants of an active session. Because Gumloop processes workflows asynchronously, your agent must use this tool to poll the session state until it transitions out of processing or queued.

"Check the status of session sess_abc890. If it is still processing, wait. If it is completed, summarize the final messages."

create_a_gumloop_session_message

When a session requires intermediate input or you want to prompt a running agent further, this tool dispatches follow-up messages. It is essential for multi-turn conversational agents that interact with ongoing Gumloop skills.

"Send a follow-up message to session sess_abc890 providing the requested API key to continue the workflow."

list_all_gumloop_artifacts

This tool lists all files and artifacts produced by a specific Gumloop agent or scoped to a particular session. It returns the metadata and signed download URLs necessary to extract the final outputs of a workflow.

"List all artifacts generated by session sess_abc890. Retrieve the download URL for the file named 'enriched_leads.csv'."

create_a_gumloop_flow_run

This tool triggers a saved Gumloop flow run directly via the start pipeline endpoint. This is ideal for background batch processes where conversational interaction is not required.

"Trigger a run for the weekly reporting flow. Use the flow ID flow_999 and pass today's date as the execution variable."

create_a_gumloop_export_datum

This tool initiates a heavy data export job for enterprise organizations. It strictly enforces the required scoping parameters, ensuring the agent does not trigger a 400 error when requesting workspace-level data.

"Initiate a data export job for all agent interactions across the organization. Ensure the 'include_all_workspaces' flag is set to true."

To see the complete tool inventory and schema details, visit the Gumloop integration page.

Building Multi-Step Workflows

An AI agent's true power lies in its ability to chain tools together autonomously. When orchestrating Gumloop, an agent typically follows an asynchronous execution loop: initialize the session, poll for state changes, handle intermediate requirements, and extract the final artifacts.

Here is a conceptual architecture of this multi-step flow:

sequenceDiagram
    participant UserApp as User Application
    participant AIAgent as AI Agent
    participant TrutoProxy as Truto API Proxy
    participant GumloopAPI as Gumloop API
    
    UserApp->>AIAgent: Prompt: "Run the enrichment workflow and get the results"
    AIAgent->>TrutoProxy: create_a_gumloop_session(agent_id, input)
    TrutoProxy->>GumloopAPI: POST /sessions
    GumloopAPI-->>TrutoProxy: 202 Accepted (State: processing)
    TrutoProxy-->>AIAgent: Return session_id
    
    loop State Polling with Backoff
        AIAgent->>TrutoProxy: get_single_gumloop_session_by_id(session_id)
        TrutoProxy->>GumloopAPI: GET /sessions/:id
        GumloopAPI-->>TrutoProxy: State: processing / complete
        TrutoProxy-->>AIAgent: State update
    end
    
    AIAgent->>TrutoProxy: list_all_gumloop_artifacts(session_id)
    TrutoProxy->>GumloopAPI: GET /artifacts?session_id=...
    GumloopAPI-->>TrutoProxy: Signed URLs
    TrutoProxy-->>AIAgent: Artifact metadata
    AIAgent->>UserApp: Return final processed results

When writing your execution loop, you must actively handle rate limits. Truto will surface 429 errors directly. Your agent framework must catch this error, read the ratelimit-reset header, and sleep the thread accordingly.

async function executeToolWithBackoff(toolCall, maxRetries = 3) {
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      // Execute the tool call against Truto
      const result = await toolCall.invoke();
      return result;
    } catch (error) {
      if (error.status === 429) {
        // Read standard IETF rate limit headers passed through Truto
        const resetTime = error.headers.get('ratelimit-reset');
        const sleepMs = resetTime ? (parseInt(resetTime) * 1000) - Date.now() : 2000 * attempt;
        
        console.log(`Rate limited. Sleeping for ${sleepMs}ms`);
        await new Promise(resolve => setTimeout(resolve, sleepMs));
        continue;
      }
      // Rethrow non-429 errors
      throw error;
    }
  }
  throw new Error("Max retries exceeded for tool execution");
}

Workflows in Action

Here are two concrete examples of how an AI agent uses these tools to execute real-world operations in Gumloop.

1. Orchestrating an Asynchronous Research Session

An operations team needs the agent to launch a deep-research workflow using a specific Gumloop skill and retrieve the final summarized report.

"Launch the Market Research agent for 'Quantum Computing Startups'. Wait for the session to finish, then download the final artifact and summarize it for me."

  1. The agent calls create_a_gumloop_session with the specific agent_id and the input string 'Quantum Computing Startups'.
  2. The agent enters a loop, periodically calling get_single_gumloop_session_by_id to monitor the state property.
  3. Once the state transitions to completed, the agent calls list_all_gumloop_artifacts filtered by the session_id.
  4. The agent reads the signed URL from the response, fetches the file content internally, and presents the summary to the user.

2. Exporting Audit Logs for Compliance

An IT administrator asks their Slack-based AI agent to pull the recent credit logs and agent interaction history for a compliance review.

"Export all the credit logs and agent interaction data for our entire organization from Gumloop and give me the status of the export job."

  1. The agent calls create_a_gumloop_export_datum with data_type set to credit_logs.
  2. The agent makes a second call to create_a_gumloop_export_datum with data_type set to agent_interactions, ensuring it includes the include_all_workspaces: true parameter to avoid a 400 validation error.
  3. The agent receives the data_export_id for both jobs.
  4. The agent calls get_single_gumloop_data_export_by_id to verify the initial status of the jobs and informs the user that the exports are initializing.

Moving Fast with Managed Tooling

Connecting AI agents to automation platforms like Gumloop requires strict adherence to asynchronous lifecycles, rigorous schema validation, and defensive error handling. Building this translation layer from scratch drains engineering resources and introduces severe technical debt as upstream APIs evolve.

By utilizing Truto's /tools endpoint, you offload schema maintenance, authentication, and endpoint normalization. Your LLMs receive perfectly formatted tool definitions that guide them naturally through Gumloop's specific API quirks, ensuring predictable execution in production.

FAQ

How does Truto handle Gumloop rate limits?
Truto does not retry or throttle rate limits. When Gumloop returns an HTTP 429, Truto passes the error directly to your agent, alongside standardized IETF rate limit headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) so your code can manage backoff.
Can I use these Gumloop tools with LangChain or CrewAI?
Yes. Truto's /tools endpoint returns standard tool schemas that can be bound to any modern framework, including LangChain, LangGraph, CrewAI, and the Vercel AI SDK.
How do agents handle Gumloop's asynchronous sessions?
The tools provide clear descriptions for state transitions. Agents use the create_a_gumloop_session tool to start a workflow, then use get_single_gumloop_session_by_id in a polling loop until the state transitions from processing to completed.
Does Truto automatically download Gumloop artifacts?
No. The list_all_gumloop_artifacts tool returns metadata and a signed download URL. Your agent framework is responsible for securely following the URL to download the opaque binary payload.

More from our Blog