@on_task handler runs whether the input came from a Slack message, a webhook, a cron trigger, or another agent. You enable channels per agent in Xpander Chat under the agent’s Channels tab.
REST API
The default channel. Every agent is reachable through xpander’s REST API as soon as it’s deployed:
Full endpoint reference: REST API → Agents.
Slack
Deploys your agent as a bot in your Slack workspace. Any DM or channel mention routes to your agent’s@on_task handler. The user who sends the message becomes the user_id on the task, so user memories work out of the box.
Set up in Xpander Chat under the agent’s Channels tab. Each Slack workspace is one connected account; Xpander Chat walks through OAuth.
Channel progress preferences
Slack, Teams and Telegram use a status line by default. Channel bindings accept nullableverbose_task_progress (NULL inherits the bot preference); bot settings accept the same key. Explicit verbose opt-in wins over the legacy stream_task_progress: false setting. Clients should write the new preference and preserve existing legacy values. This affects channel presentation only; REST invocation SSE events remain unchanged.
Webhooks
Enable
In Xpander Chat, open the Channels tab and enable Webhook. The Webhook row shows your payload URL (with agent ID and API key embedded).Make requests
All webhook requests are POST tohttps://webhook.xpander.ai/:
Optional parameters:
Any additional fields in the request body are passed to the agent as context.
When the same parameter appears in multiple places, query parameters take priority over body parameters, which take priority over defaults.
Sync vs async
Synchronous (default): blocks until the agent finishes and returns the full result.asynchronous=true to return immediately. Best for long-running tasks, file processing, or when you don’t need the result inline.
{"status": "Started"} immediately. Check the task in Xpander Chat for the result.
Upload files
Upload files usingmultipart/form-data. The agent automatically processes them: OCR for images, text extraction for PDFs, transcription for audio.
Extract data from responses
Usegetter with dot notation to extract a specific field from the agent’s response instead of the full object:
"Q4 revenue increased 15%".
Behind a load balancer with an idle timeout, an AWS ALB answers 504 after 60 seconds by default, a synchronous call or a key-based webhook whose turn runs longer never returns. Use the asynchronous form and poll the task for turns that may take more than a minute.
Map dynamic parameters
Useparams_mapping as a query parameter to extract values from nested payload fields and map them to webhook parameters. Useful for Telegram bots, WhatsApp, and other messaging platforms where identifiers are nested:
task_id, user_id, user_email, user_first_name, user_last_name, prompt.
Pass MCP OAuth tokens
If your agent uses skills served over MCP with OAuth authentication, pass pre-authenticated user tokens viauser_tokens to bypass the interactive OAuth flow during webhook execution:
graph.items for entries with type: "mcp".
Error codes
MCP (Model Context Protocol)
Agents are reached over MCP through two endpoints, neither of which is configured per agent in Xpander Chat:- The API’s MCP endpoint,
https://api.xpander.ai/mcp/, is the xpander API over MCP: the same control plane and data plane calls, listing and invoking agents, reading tasks and threads, reaching skills, custom functions, workspace files and schedules. It is not an agent. It signs in with OAuth 2.1; an API key is not accepted. Client setup is on Model Context Protocol. - The Omni endpoint,
https://omni.xpander.ai/mcp, is Omni, the built-in agent, behind one address. Through it a client does everything you can do in Xpander Chat: find and task your organization’s agents, assemble skills and agents, start cloud sessions, ask what a run did. It signs in with OAuth in the browser. See Omni in your MCP client.
Scheduled tasks (cron)
A cron expression that creates a task on a schedule. The task input is whatever you configure in Xpander Chat: a fixed prompt or a templated one with placeholders. The agent’s@on_task handler runs as if a user invoked it.
Agent-to-agent (A2A)
A2A lets other agents (inside or outside your organization) discover and invoke this agent via Google’s Agent2Agent protocol. This is how multi-agent teams compose: a manager agent delegates to specialist agents by calling them as skills.Enable
In Xpander Chat, open the Channels tab, enable A2A, then:- Click Agent card to see the agent’s A2A identity: its Agent A2A URL, name, and version. This is what external agents use to discover and call it.
- Click Manage API keys to generate credentials. External agents authenticate with these keys on every call. Generate one per external agent or team to keep access scoped and revocable.
Call an agent from code
From a parent agent’s handler, calling a child agent looks like calling any other skill. The child appears inagent.tools.list once it’s been added as a dependency in Xpander Chat:
- The child agent runs its full loop. It has its own skills, instructions, memory, and knowledge bases. The parent only sees the final output as a skill result.
- Each agent has its own A2A URL. External systems (agents on other platforms) can discover and call your agent at
https://a2a.xpander.ai/ag_YOUR_AGENT_ID/using the A2A protocol. - API keys are per external agent. Generate a separate key for each external caller so you can revoke access independently. The keys are scoped to the A2A channel; they can’t be used to invoke the agent through REST or webhooks.
Cross-platform delegation
The A2A protocol is designed for agents on different platforms to call each other. An agent built on LangChain, AutoGen, or any other A2A-compatible agent loop can invoke your xpander agent at its A2A URL using a standard A2A request, and vice versa.Picking a channel
A common combination:- REST for programmatic access and backend integrations.
- Slack for the team.
- MCP for individual developers in their IDE or Claude Desktop.
- Webhooks for inbound triggers from external systems (GitHub, Stripe, Zapier).
- Cron for scheduled routine work.
- A2A for delegation from a manager agent or cross-platform invocation.
@on_task handler. There’s no per-channel cost in the SDK.
Things to watch for
Channels can collide in subtle ways. A scheduled task that fires every minute while a Slack user is mid-conversation creates two concurrent invocations against the same agent and sometimes the same session. If your handler isn’t idempotent, you’ll see weird interleavings in the conversation history. Either scope cron tasks to dedicated agents, or design handler logic that tolerates concurrent runs against the same session.Next steps
REST API reference
Sync, async, and stream endpoints.
MCP guide
Full MCP setup walkthrough with screenshots.
Webhooks guide
Full webhook reference with the tester in Xpander Chat.
Scheduled tasks
Cron-driven invocations.

