Call Sigma agents with the API (Beta)
Call Sigma agents with the API (Beta)
- This documentation describes one or more public beta features that are in development. Beta features are subject to quick, iterative changes; therefore the current user experience in the Sigma service can differ from the information provided in this page. This page should not be considered official published documentation until Sigma removes this notice and the beta flag on the corresponding feature(s) in the Sigma service. For the full beta feature disclaimer, see Beta features.
- Sigma agents are a premium feature. While Sigma agents are in beta, anyone in your organization with access to a workbook can use agents. To maintain access to Sigma agents after the beta, contact your Sigma Account Executive.
- The use of AI features is subject to the following disclaimer.
You can run a Sigma agent programmatically with the Sigma REST API and use the reply in your own application, instead of interacting with the agent through a chat element or action in a workbook.
For example, you can use the API to embed a Sigma agent in a custom chat interface in your own application or call an agent from a script or an automated pipeline.
Call the endpoint from your application’s backend, using the non-streaming response for simple integrations or the streaming response to power a live chat experience.
Call the endpoint from a scheduled job or pipeline step, using the non-streaming response and, optionally, responseFormat to get output you can parse and act on programmatically.
The API runs the agent with the calling user’s permissions and row-level security, using the same instructions, data sources, and tools configured for the agent in the workbook.
User requirements
To call an agent using the API, you must have the following:
- Client credentials with the REST API scope
- The client credentials must be assigned to a user with at least Can view access to the workbook containing the agent that you want to run.
Limitations
- You cannot interact with a warehouse agent using this API endpoint. Instead, use the API endpoints associated with your data platform.
- Some action tools do not run when called programmatically. For a list of action tools that run when called by an agent run programmatically, see About automated action sequences.
- Only one system message can be specified per conversation.
What you can do with the agent API
The agent API is a stateless, chat-completion-style endpoint. With it, you can do any of the following:
- Send a full conversation and get the agent’s next reply, including any text, tool calls, and tool results.
- Continue a multi-turn conversation by replaying the previous output as part of the next request’s messages.
- Retrieve the agent response as a structured JSON schema, instead of free-form text.
- Limit a run with a maximum number of tool-calling steps (
maxTurns) or a maximum number of output tokens (maxOutputTokens). - Run the agent against a tagged version of the workbook, instead of the latest published version.
- Attach caller-defined metadata to a run, which is logged to the
ai_usagetable (if configured) in your data platform for tracking and auditing. - Stream the agent’s reply as a sequence of events instead of waiting for the full turn to complete.
Decide whether to retrieve a streaming response
By default, the agent API returns a single JSON response after the agent finishes its turn. Set stream to true in the request to instead receive a sequence of events as the agent works.
Decide which response type fits your use case by reviewing the following table:
Get started calling an agent with the API
To get started calling an agent with the API:
-
Identify the agents that you have access to. You can call the List agents endpoint to retrieve the list of all agents that you can access in your Sigma organization, including the
workbookIdandagentIdof each agent. -
Decide whether to modify the default request with optional details, such as:
- Send your user prompt as a message with
"role": "user"in themessageslist. - Determine whether your use case needs a streaming or non-streaming response.
- Determine whether you want to receive a response as text or structured JSON.
- Specify arbitrary metadata to be logged to the
AI_USAGEtable. - Include previous conversation output as context in the
messageslist. See Continue a conversation.
- Send your user prompt as a message with
Run an agent
To run an agent, send a POST request to the Run a Sigma agent endpoint.
- Include the
workbookIdandagentIdfor the agent. - Specify relevant content in the request.
- If you want to add system-level context to the agent instructions, such as “never tell the user what source you are querying”, include that as a
systemmessage. - Store the returned
runIdalongside your own logs so you can correlate a run with a support request if needed.
The response includes the agent’s reply in output, along with usage details about the run, such as the number of turns and tokens consumed.
Continue a conversation
Chat history is not currently stored for agents, so to continue a conversation with an agent, provide the context about the current conversation when making a request to run the agent.
To continue a conversation, append the previous response’s output to the messages array and send the full history again on the next call:
Retrieve structured output
If you want to structure the output returned by the agent, you can specify a desired JSON output structure when you make a request:
That request returns a response like the following:

