When to Use Async
- Long-running tasks — anything that runs longer than 30 seconds, such as order processing, report generation, or bulk data workflows
- Unreliable connections — environments where connections time out or drop before a synchronous response can return
- Queued workflows — cases where you enqueue tasks and handle their results separately
How It Works
1
Start the interaction
Provide a
callback_url when starting the interaction.2
Get an immediate response
Scout responds right away with
202 Accepted and a session_id.3
The agent runs in the background
Scout runs the agent task without holding your connection open.
4
Receive the result
On completion, Scout POSTs the result to your callback URL.
API Reference
Start Async Interaction
Start an interaction that runs in the background and reports its result to a callback URL.Parameters
array
required
The messages to send to the agent. Each message has a
content field: a list of text strings and drive file references.string
required
An HTTPS URL where Scout POSTs the result when the agent finishes. Must be publicly reachable — see Requirements.
Request
Response
Scout returns202 Accepted immediately, before the agent runs.
string
The identifier for this agent session. Use it to correlate the callback with the request that started it.
string
The URL to fetch the full event stream for this session once it completes.
Callback Payload
When the agent finishes, Scout POSTs a JSON payload to yourcallback_url.
string
A unique identifier for this callback delivery. Use it to deduplicate retries — see Retry Behavior.
string
The session this callback reports on, matching the
session_id from the original response.string
Either
succeeded or failed.string
ISO 8601 timestamp of when the agent finished.
string
The URL to fetch the full event stream for the session.
object
Present only when
status is failed. Contains a code and a human-readable message.Fetching Results
The callback payload confirms completion but doesn’t include the agent’s full output. Use theevents_url to retrieve the complete event stream:
Callback Authentication
Every callback includes signature headers so you can confirm the request genuinely came from Scout:Verifying the Signature
1
Parse the header
Extract
t (timestamp) and sig (signature) from the X-Scout-Signature header.2
Build the signature base string
Concatenate the timestamp and the raw request body as
{timestamp}.{raw_request_body}.3
Compute the HMAC
Compute HMAC-SHA256 over the base string using your org secret key.
4
Compare
Compare your computed value against
sig using a constant-time comparison.Example Webhook Handler (Express)
Retry Behavior
Scout uses at-least-once delivery, so the same callback may arrive more than once.- Deduplication — check
callback_event_idbefore processing to avoid duplicate work - Retry schedule — exponential backoff over roughly 24 hours
- Retry triggers — network errors or
5xxresponses from your endpoint
Requirements
callback_urlmust use HTTPS- Private and internal URLs aren’t supported (SSRF protection)
- Your endpoint must respond within 10 seconds