
agentic_architecture
从3文件扩展到5文件的模块化数学智能体架构。
Repository Info
About This Server
从3文件扩展到5文件的模块化数学智能体架构。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Math Agent Chrome Extension
This project is a modular, agentic math problem solver that connects a Chrome extension frontend to a Python backend. The backend uses an agentic architecture with four main components: Perceive, Memory, Decision, and Action. Users can enter math problems (and a Gemini API key if needed) in the extension, and receive answers powered by your AI agent.
Youtube Demo - https://youtu.be/gpT0NJ1UFFg
Table of Contents
- Features
- Architecture Overview
- Setup Instructions
- Python Backend
- Chrome Extension
- How It Works
- Agentic Architecture Explained
- Usage
- Troubleshooting
- Contributing
- License
Features
- Solve math problems from your browser using a Chrome extension
- Modular agentic backend with clear separation of concerns
- Optional Gemini API key support for advanced reasoning
- Clean, modern UI
- Easy to extend and maintain
Architecture Overview
- Frontend: Chrome extension (popup) for user input and result display
- Backend: Python Flask server running the agentic math solver
- Agentic Core: Four main components—Perceive, Memory, Decision, Action—each with a clear responsibility
Setup Instructions
1. Python Backend
a. Install dependencies:
pip install flask flask-cors
b. Project structure:
agentic_architecture/
│
├── flask_server.py # Main backend server (contains agent logic)
├── perceive.py # Perceive component
├── memory.py # Memory component
├── decision.py # Decision component
├── action.py # Action component
├── models.py # Pydantic models (if used)
└── other files ...
c. Start the backend:
python flask_server.py
By default, the server runs on http://localhost:5000.
2. Chrome Extension
a. Project structure:
chrome_extension/
│
├── manifest.json
├── popup.html
├── popup.js
└── icons
b. Load the extension:
- Go to
chrome://extensions/in Chrome. - Enable "Developer mode".
- Click "Load unpacked" and select the
chrome_extensionfolder.
How It Works
- User enters a math problem (and optionally a Gemini API key) in the extension popup.
- The extension sends the problem and key to the Flask backend via HTTP POST.
- The backend instantiates the agent, passing the problem and Gemini key.
- The agent processes the problem using its four core components:
- Perceive: Parses and interprets the input.
- Memory: Stores and retrieves relevant information.
- Decision: Determines the best course of action.
- Action: Executes the chosen operation (e.g., calculation, reasoning).
- The result is returned to the extension and displayed to the user.
Agentic Architecture Explained
The backend agent is designed around four modular components:
1. Perceive
- Role: Receives and interprets user input.
- Responsibilities:
- Parses mathematical expressions.
- Understands user commands.
- Prepares data for further processing.
2. Memory
- Role: Stores and retrieves information.
- Responsibilities:
- Maintains calculation history.
- Stores error patterns or user preferences.
- Provides context for decision-making.
3. Decision
- Role: Chooses the best action based on input and memory.
- Responsibilities:
- Selects the appropriate mathematical operation.
- Verifies calculations and checks consistency.
- Handles errors and fallback logic.
4. Action
- Role: Executes the chosen operation.
- Responsibilities:
- Performs calculations (add, subtract, multiply, etc.).
- Executes reasoning steps.
- Returns results to the user.
This separation makes the agent easy to extend, test, and maintain.
Usage
- Start the backend server:
python flask_server.py - Load the Chrome extension.
- Click the extension icon, enter your math problem (and Gemini key if needed), and click "Solve".
- View the result instantly in the popup!
Troubleshooting
- "Could not connect to backend":
Make sure the Flask server is running and accessible athttp://localhost:5000. - "Invalid expression or error in calculation":
Ensure you are entering a valid math expression (e.g.,2 + 3 * 4). - Gemini API errors:
Double-check your Gemini API key and network connection.
Contributing
Contributions are welcome! Please open issues or pull requests for improvements, bug fixes, or new features.
License
MIT License
Let me know if you want to add more details, usage examples, or diagrams!
Quick Start
Clone the repository
git clone https://github.com/palashbaranwal/agentic_architectureInstall dependencies
cd agentic_architecture
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.