Backend-as-a-Service SDK for building and managing AI agents
The xpander.ai SDK is a comprehensive Backend-as-a-Service (BaaS) platform for building, deploying, and managing AI agents at scale. It provides five core modules that work together to create powerful AI agent applications.
This is the Python SDK documentation. The SDK has been completely refactored to provide a modular, Backend-as-a-Service architecture for enterprise AI agent development.
pip install xpander-sdk# With optional dependenciespip install xpander-sdk[agno] # For Agno framework supportpip install xpander-sdk[dev] # For development
Copy
Ask AI
from xpander_sdk import Agents, Tasks, ToolsRepository, KnowledgeBases# SDK automatically uses environment variables# Set XPANDER_API_KEY and XPANDER_ORGANIZATION_ID# Initialize modules directlyagents = Agents()tasks = Tasks()tools = ToolsRepository()knowledge = KnowledgeBases()
from xpander_sdk import Agents# Initialize modules (automatically uses environment variables)agents = Agents()# List all agentsagent_list = await agents.alist()# Load a specific agentagent = await agents.aget("agent-id")# Create and execute a tasktask = await agent.acreate_task( prompt="Analyze this data", file_urls=["https://example.com/data.csv"], events_streaming=True)# Stream task eventsasync for event in task.aevents(): print(f"Event: {event.type} at {event.time}") if event.type == "task_finished": print(f"Result: {event.data.result}") break
from xpander_sdk import Agents# Initialize modulesagents = Agents()# List all agentsagent_list = agents.list()# Load a specific agentagent = agents.get("agent-id")# Create and execute a tasktask = agent.create_task( prompt="Analyze this data", file_urls=["https://example.com/data.csv"])# Check task statusprint(f"Task Status: {task.status}")print(f"Task Result: {task.result}")