Headless Agent Trigger API

The Headless Agent Trigger API lets you run Mattr agents without a UI. By triggering agents from your backend, workflows, or system events, you can treat them as background workers or programmatically called functions.

Quick Start: Your First Trigger

  1. Identify the Agent: Obtain the unique agentId for the agent you wish to execute.

  2. Authenticate: Generate an Agent API Key and Secret in the Authentication tab of your Agent Config.

  3. Prepare the Request: Set your headers with x-api-key and x-api-key-secret.

  4. Execute: Send a POST request with a message to start the run.

JSON

{
  "message": "Summarize the attached document"
}

Base URL

https://api-builder-dev.uptiq.dev
  • Format: JSON

  • Authentication is required for all requests

How It Works (At a Glance)

Every agent execution is triggered in one of two ways:

  1. Start a new execution using a message

  2. Resume an existing execution using resume data

Everything else—payloads, documents, reasoning mode—is optional control.

Authentication

Each request must include exactly one authentication method.

Option 1: Agent API Key (Server-to-Server)

Recommended for backend and service-to-service integrations.

How to get keys

  1. Open your agent’s Agent Config

  2. Go to the Authentication tab

  3. Create an Agent API Key and Secret

Headers

Option 2: Widget Key

Used for first-party or widget-based integrations.

Headers

Triggering an Agent

Endpoint

Path Parameters

Name

Description

agentId

Unique ID of the agent to execute

Required Input Rule

Every request must include at least one of the following:

  • message → start a new execution

  • resumeData → resume an existing execution

If both are missing, the request fails.

Error

{ "error": "Message or resume data is required" }

Basic Usage

Minimal Execution

Start a new agent run using a simple instruction.

{

"message": "Summarize the attached document"

}

Passing Structured Data (Payload)

You can pass structured data alongside a message.

{

"message": "Generate quarterly report",

"payload": {

"quarter": "Q4",

"year": 2024

}

}

When a payload is provided, the agent automatically receives:

  • The natural language instruction

  • The structured data context

This is useful for system-driven workflows and data-backed tasks.

Attaching Documents

Agents can read documents during execution.

Common use cases:

  • PDF analysis

  • Report summarization

  • Risk or compliance checks

{

"message": "Analyze financial risk",

"documents": [

{

"signedUrl": "<signed-url>",

"fileName": "balance-sheet.pdf",

"mimeType": "application/pdf"

}

]

}

Notes:

  • Documents are optional

  • They are acknowledged at execution start

  • They can influence reasoning, retrieval, or summarization

Resuming an Execution

If an agent's execution pauses or fails, you can resume it rather than starting over.

{

"resumeData": {

"lastStep": "analysis"

},

"executionId": "exec_123"

}

This allows agents to:

  • Continue from a known step

  • Avoid reprocessing large inputs

  • Recover gracefully from interruptions

Execution Mode

By default, agent execution is asynchronous.

Async (Default)

  • Best for long-running or background taskstask

  • The request returns immediately

Sync

  • Waits for the agent to finish

  • Useful for real-time UI or immediate responses

{

"message": "Check eligibility",

"executionMode": "sync"

}

Choosing How the Agent Thinks

You can control how much reasoning power the agent uses with options.mode.

{

"options": {

"mode": "balanced"

}

}

Available Modes

Mode

When to Use

advanced (default)

Complex reasoning, multi-step logic, high accuracy

balanced

Best balance of speed, cost, and intelligence

qa

Simple question–answer tasks

custom

Full client-controlled reasoning

You usually don’t need to set this—the default works well for most use cases.

Model Selection (Optional)

When using qa or custom mode, you can explicitly choose a reasoning model.

{

"options": {

"mode": "qa"

},

"agentStrategy": {

"reasoningModelId": "your-model-id"

}

}

If no model is provided, the system selects one automatically.

How Models Are Chosen (Behind the Scenes)

Mattr dynamically selects the best available reasoning model based on:

  • Environment configuration

  • Feature flags

  • Safe fallback defaults

If a configured model is unavailable, the system automatically falls back to a safe alternative.

Model resolution never blocks execution.

Advanced Strategy Configuration

You can override execution strategies when needed.

{

"options": {

"strategyConfig": {

"initialStrategy": "IntelligentPlanner",

"autoSelectStrategy": false,

"allowStrategySwitch": false

}

}

}

If not provided, sensible defaults are applied automatically.

Full Request Schema

{

"message": "string",

"resumeData": {},

"payload": {},

"documents": [],

"context": "string",

"executionId": "string",

"executionMode": "async | sync",

"options": {

"mode": "advanced | balanced | qa | custom",

"runInlineEvaluation": true,

"strategyConfig": {

"initialStrategy": "IntelligentPlanner",

"autoSelectStrategy": false,

"allowStrategySwitch": false

}

},

"agentStrategy": {

"reasoningModelId": "string"

}

}

Responses

Success (200)

{

"executionId": "exec_123"

}

Response content may vary based on agent behavior and execution mode.

Errors

400 – Validation Error

{ "error": "Message or resume data is required" }

401 – Unauthorized

{ "error": "Invalid or missing agent API key" }

403 – Forbidden

{

"message": "You're not authorized to perform this action.",

"requestId": "<execution-id>"

}

500 – Internal Server Error

{

"message": "Something went wrong. Please try again later.",

"requestId": "<execution-id>"

}

Operational Notes

  • Execution is asynchronous by default

  • Execution IDs are auto-generated if not provided

  • Optional fields are safely defaulted server-side

  • This endpoint is not idempotent

  • Model selection is dynamic and fault-tolerant

Last updated