Strands MCP-Based Learning Support Agent System
An intelligent educational assistant that routes questions to specialized agents for math, science, and web search queries using the Strands framework and Model Context Protocol (MCP).
Overview
Learning Support uses a supervisor agent pattern to intelligently route user questions to specialized sub-agents:
- Math Agent: Handles calculations and mathematical problems using the calculator tool
- Science Agent: Processes science-related queries (physics, chemistry, biology)
- Search Agent: Performs web searches for current events and factual information via MCP fetch server
Architecture
┌─────────────────┐
│ Supervisor │ Routes questions to appropriate specialist
│ Agent │
└────────┬────────┘
│
┌────┴────┬─────────┬──────────┐
│ │ │ │
┌───▼───┐ ┌──▼───┐ ┌───▼────┐ ┌───▼────┐
│ Math │ │Science│ │ Search │ │ Direct │
│ Tool │ │ Tool │ │ Tool │ │ Answer │
└───────┘ └───────┘ └────────┘ └────────┘Project Structure
.
├── agents/
│ ├── factory.py # Agent factory for consistent configuration
│ ├── supervisor.py # Main routing agent
│ ├── math_agent.py # Math specialist agent
│ ├── science_agent.py # Science specialist agent
│ └── search_agent.py # Web search agent
├── tools/
│ ├── math_tool.py # Calculator tool wrapper
│ ├── science_tool.py # Science query tool
│ └── search_tool.py # Web search tool
├── config/
│ ├── settings.py # Configuration and logging setup
│ └── prompts.py # System prompts for each agent
├── utils/
│ └── helpers.py # Response cleaning utilities
└── main.py # CLI entry pointInstallation
- Clone the repository
- Install dependencies:
pip install -r requirements.txt- Create a
.envfile with your configuration (if needed)
Usage
Run the interactive CLI:
python main.pyExample Interactions
> What is 25 * 48?
ROUTING DECISION: math_tool
REASON: Question involves multiplication calculation
SUCCESS: 1200
> What is photosynthesis?
ROUTING DECISION: science_tool
REASON: Biology-related question
SUCCESS: [Science explanation]
> What's the latest news about AI?
ROUTING DECISION: search_tool
REASON: Current events query
SUCCESS: [Search results]Type exit to quit the application.
Features
- Intelligent Routing: Automatically determines the best specialist for each question
- Specialized Agents: Each agent is optimized for its domain
- Clean Logging: Configurable logging system for debugging and monitoring
- Error Handling: Graceful error handling with user-friendly messages
- Extensible: Easy to add new specialist agents and tools
Configuration
Logging
Logging is configured in config/settings.py. Default level is INFO.
Model Selection
The default model is configured in config/settings.py via the DEFAULT_MODEL constant.
Development
Adding a New Specialist Agent
- Create agent in
agents/your_agent.py - Create corresponding tool in
tools/your_tool.py - Add prompt in
config/prompts.py - Update supervisor routing rules
- Export from
agents/__init__.pyandtools/__init__.py
Dependencies
- strands: Core agent framework
- strands-tools: Pre-built tools (calculator, MCP client)
- python-dotenv: Environment variable management
License
[Add your license here]
