async_task_example.py
from dotenv import load_dotenv
load_dotenv()

from xpander_sdk import Task, Backend, on_task
from agno.agent import Agent

@on_task
async def task_handler(task: Task):
    backend = Backend()
    agno_args = await backend.aget_args(task=task)
    agno_agent = Agent(**agno_args)
    
    # Process task asynchronously
    result = await agno_agent.arun(message=task.to_message())
    task.result = result.content
    return task
This example shows non-blocking task processing where multiple tasks can be handled concurrently without blocking other operations. It uses asynchronous backend initialization with aget_args() for optimal resource utilization and automatic task-to-message conversion with proper result handling.

Production Deployment

For creating and deploying agents to production, see the Setup and Deployment Guide.