Retrieve Agent Status
Retrieve Agent Status
GET
Retrieve Agent Status
Poll the status of an API-initiated agent interaction. Once the interaction reaches the
Tool Invocation Part:
File Part:
Error Part:
COMPLETED state, the response includes the full conversation messages and the agent’s final text response.
Request
Headers
URL Parameters
The interaction ID returned from the Start Agent endpoint.
Query Parameters
Your Gumloop user ID. Required if
project_id is not provided.Your team (workspace) ID. Required if
user_id is not provided.Example Request
Response
While Processing (200 OK)
When the agent is still working, the response contains only the interaction metadata:On Completion (200 OK)
When the agent finishes, the response includes the full conversation and a convenienceresponse field:
On Failure (200 OK)
When the agent encounters an error, the response includes anerror_message:
Response Fields
The unique interaction identifier.
The agent’s ID.
Current state of the interaction. One of:
ASYNC_PROCESSING, COMPLETED, FAILED.ISO 8601 timestamp of when the interaction was created.
Full conversation history including the user message and all agent messages with tool call details. Only present when
state is COMPLETED.The agent’s final text response extracted from the last assistant message. This is a convenience field: the same text exists in the
messages array. Only present when state is COMPLETED.Description of what went wrong (truncated to 4096 characters). Only present when
state is FAILED.Error Responses
| Status Code | Error | Description |
|---|---|---|
| 401 | "Authorization header with Bearer token or api_key query parameter is required" | No API key provided. |
| 403 | "unauthorized" | User doesn’t have access to this interaction. |
| 404 | "interaction_not_found" | No interaction found with this ID. |
Interaction States
| State | Description | Action |
|---|---|---|
ASYNC_PROCESSING | The agent is actively processing the request. | Wait and poll again (recommended: every 2-5 seconds). |
COMPLETED | The agent has finished. | Read response for the text reply, or messages for full details. |
FAILED | The agent encountered an error. | Read error_message for details. |
Message Structure
When the interaction completes, themessages array contains the full conversation. Each message has the following structure:
User Message
Assistant Message
Assistant messages containparts instead of content. Each part represents a piece of the response:
Text Part:
Messages are sanitized to include only safe fields. Message-level fields:
id, role, timestamp, parts, content. Part-level fields: id, type, text, reasoning, toolCallId, toolName, toolCallState, result, error, file. Result-level fields: args, result.Polling Best Practices
- Poll interval: 2-5 seconds is recommended. Avoid polling more frequently than every 1 second.
- Timeout: Set a reasonable timeout (e.g., 5-10 minutes) depending on your agent’s expected workload.
- Backoff: Consider exponential backoff if you’re making many concurrent requests.
- Resumable: If your client disconnects, you can resume polling with the same
interaction_id. Each call to/start_agentcreates a new interaction, so there’s no risk of duplicate processing. - Use
responsefor simple integrations: It contains just the agent’s final text. Usemessageswhen you need tool call details or the full conversation.
