Backend.aget_args returns a dictionary of framework-ready keyword arguments for a stored agent. Spread the result directly into an Agno (or other supported framework’s) constructor: the dict already contains the model, system prompt, tools, memory settings, knowledge-base retrievers, and guardrails configured in the Workbench.
@on_task) so the framework agent reflects the latest stored configuration.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
agent_id | str | No¹ | XPANDER_AGENT_ID env var | Agent ID. Required if agent is not provided. |
agent | Agent | No¹ | None | A pre-loaded Agent instance. Takes precedence over agent_id. |
agent_version | int | No | None | Specific version to load. Latest if omitted. |
task | Task | No | None | The current task. When provided, args include task-specific context (input, files, output schema). |
override | dict[str, Any] | No | None | Final overrides merged into the resolved kwargs. |
tools | list[Callable] | No | None | Extra Python callables added to the agent’s tool list. |
is_async | bool | No | True | (async only) Whether you’ll run the framework agent in an async context. Affects how local tools are wrapped. |
auth_events_callback | Callable | No | None | Per-call callback for MCP/OAuth authentication events. See Authentication events. |
agent_id or agent must be resolvable. If neither is passed, the method falls back to XPANDER_AGENT_ID.
Returns dict[str, Any]
A dictionary of framework-ready kwargs. The exact keys depend on the agent’s framework (currently always Agno):
Examples
Inside @on_task
task=task enriches the args with task-specific context (session id, user id, output schema), so memory and structured output work transparently.
Pre-loaded agent (avoid re-fetching)
agent takes precedence over agent_id. This avoids a fresh GET /agents/:id call each time you build framework args.
Override resolved kwargs
override is shallow-merged after the framework dispatcher builds its kwargs, so anything you set wins.
Add extra tools
@register_tool instead.
Authentication events
When an agent uses MCP servers or connectors that require OAuth, the framework emitsauth_event updates while the user authenticates. Register a callback to handle the OAuth URL or token-ready signals:
Per-call callback
Globally with @on_auth_event
auth_events_callback adds a one-off handler on top. See @on_auth_event for details.
Sync version
is_async (sync wrapper hard-codes it to False so local tools are wrapped synchronously). Don’t call from inside a running event loop.
