Prerequisites
- AgenticAI Core SDK installed and configured.
- A configured LLM provider connection (OpenAI, Anthropic, or Azure OpenAI).
- Python 3.8+ with
async/awaitsupport.
Application components
Build the application
1. Define the application
Create anApp instance with a name and orchestration type:
2. Create agents
Define agents for each domain or function in your application:3. Define tools
Register tools using the@Tool.register decorator. Agents can invoke them during task execution:
4. Set up memory stores
Configure persistent storage for conversation state, user preferences, or application-wide data:5. Configure advanced features
Set application-wide settings such as streaming, file attachments, and filler messages:6. Assemble the application
Combine all components into theApp instance:
7. Implement the orchestrator
SubclassAbstractOrchestrator to define routing logic:
8. Start the application
Launch the MCP server with your orchestrator:Complete example
Best practices
- Agent design: Keep agents focused on specific domains. Write detailed descriptions — the orchestrator uses them for routing. Include prompt guidelines and examples.
- Tool design: Make tools single-purpose with clear descriptions. Handle errors and return meaningful messages.
- Memory management: Choose the right scope (
USER_SPECIFIC,SESSION_LEVEL, orAPPLICATION_WIDE). Define schemas for strict validation in production. Set retention policies that match actual data lifetime. - Orchestration: Implement a
route_to_userfallback for unmatched queries. Maintain context across conversation turns using memory stores.