TheDocumentation Index
Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt
Use this file to discover all available pages before exploring further.
Backend module is the bridge between your code and an agent stored in the xpander.ai platform. It does three things:
- Resolves runtime arguments for your AI framework:
aget_args(agent_id=...)returns kwargs you can spread directly into Agno (or another supported framework’s) agent constructor. - Invokes agents directly:
ainvoke_agent(agent_id=..., prompt=...)is shorthand for “load the agent, create a task.” Useful when you don’t need framework-level control. - Reports externally executed runs:
areport_external_task(...)lets you log a run that happened outside the platform (e.g. in a queue worker or another runtime) so it shows up in the same task history and metrics as platform-managed runs.
Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
configuration | Configuration | None | SDK configuration. Falls back to env vars. |
XPANDER_API_KEY, XPANDER_ORGANIZATION_ID, and XPANDER_BASE_URL from the environment.
Methods
| Method | What it does |
|---|---|
ainvoke_agent / invoke_agent | Load an agent and create a task in one call. Returns a Task. |
aget_args / get_args | Resolve framework-specific kwargs (model, system prompt, tools, memory, …) from a stored agent configuration. |
areport_external_task / report_external_task | Record an external execution (run outside the platform) so it appears in task history. |
Typical pattern
@on_task listens for incoming task events from the platform; the handler resolves framework args for the current task, builds an Agno agent, runs it, and stores the result on the task. The platform records status, metrics, and tool calls automatically.
Environment variable shortcut
SetXPANDER_AGENT_ID and you can omit agent_id from every Backend call:

