{"id":"f20cfdd6-e206-43bb-86b9-ff714df42aad","slug":"agent-system","kind":"mcp","name":"Agent-System","summary":"A modular agent system featuring intent detection, agent-to-agent communication, prompt engineering, and a Gradio web interface for building and deploying AI agents with tools like web search, documen","owner":"FBR65","repoUrl":"https://github.com/FBR65/Agent_System","license":"AGPL-3.0","licenseTier":"strong-copyleft","trust":"community","stars":0,"match":null,"fewStars":true,"format":"mcp","createdAt":"2025-06-21T15:45:38.000Z","addedAt":"2026-10-21T19:08:57.699Z","logoUrl":"https://avatars.githubusercontent.com/u/115529371?u=e71a044af33c00ea7df6b1bee2e69f9d7232b60d&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["databases","search","files-documents"],"tags":["agents","ai","database","document-processing","gradio","intent-detection","modular","prompt-engineering"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-24T11:53:10.863Z","sample":false,"url":"https://conduits.dev/tools/agent-system","language":"Python","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# Agent_System\n\n[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](License.md)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![uv](https://img.shields.io/badge/managed%20with-uv-purple.svg)](https://github.com/astral-sh/uv)\n\nA sophisticated multi-agent system that combines the Model Context Protocol (MCP) with Agent-to-Agent (A2A) communication for intelligent text processing, web interaction, and automated workflows.\n\n## 🌟 Features\n\n### 🤖 Intelligent Multi-Agent System\n- **Smart Agent Coordination**: Automatic detection of user intent and routing to appropriate agents\n- **A2A Communication**: Direct agent-to-agent communication for complex workflows\n- **MCP Integration**: Standards-compliant Model Context Protocol implementation\n\n### 🔧 Core Services (MCP Tools)\n- **Web Search & Weather**: DuckDuckGo integration with weather-specific queries\n- **Website Content Extraction**: Headless browser-based text extraction\n- **Time & Date Services**: NTP-synchronized accurate time information\n- **File Processing**: Multi-format document conversion to PDF\n- **Data Anonymization**: Intelligent PII detection and removal\n\n### 🎯 Specialized Agents (A2A)\n- **Text Optimizer**: Professional email generation and tone adjustment\n- **Grammar Corrector (Lektor)**: German/English grammar and spelling correction\n- **Sentiment Analysis**: Emotion detection and sentiment scoring\n- **Query Refactoring**: LLM-optimized query reformulation\n- **User Interface Agent**: Intelligent request interpretation and routing\n- **Prompt Engineer**: Advanced prompt optimization and intent detection with A2A orchestration\n\n### 🌐 User Interfaces\n- **Gradio Web Interface**: User-friendly browser-based interaction\n- **RESTful API**: Programmatic access to all services\n- **CLI Integration**: Command-line tool compatibility\n\n## 🏗️ Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    A2A-MCP System                          │\n├─────────────────────────────────────────────────────────────┤\n│  Gradio Interface (Port 7860)                              │\n│  ├── File Upload & Processing                              │\n│  ├── Natural Language Input                                │\n│  └── Tonality Selection                                    │\n├─────────────────────────────────────────────────────────────┤\n│  User Interface Agent (Intelligent Router)                 │\n│  ├── Intent Detection                                      │\n│  ├── Agent Selection                                       │\n│  └── Response Coordination                                 │\n├─────────────────────────────────────────────────────────────┤\n│  MCP Server (Port 8000)                     A2A Registry   │\n│  ├── Web Search & Weather                   ├── Optimizer  │\n│  ├── Website Extraction                     ├── Lektor     │\n│  ├── Time/Date Services                     ├── Sentiment  │\n│  ├── File Conversion                        ├── Query Ref  │\n│  └── Anonymization                          └── UI Agent   │\n├─────────────────────────────────────────────────────────────┤\n│  Backend Services                                          │\n│  ├── Selenium WebDriver                                    │\n│  ├── DuckDuckGo Search                                     │\n│  ├── NTP Time Sync                                         │\n│  ├── PDF Conversion                                        │\n│  └── LLM Integration (Ollama)                              │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Python 3.11+\n- [Ollama](https://ollama.ai/) with `qwen2.5:latest` model\n- Modern web browser (for Gradio interface)\n\n### Installation\n\nThis project uses [uv](https://github.com/astral-sh/uv) for fast and reliable dependency management.\n\n1. **Install uv** (if not already installed):\n   ```bash\n   # On macOS/Linux\n   curl -LsSf https://astral.sh/uv/install.sh | sh\n   \n   # On Windows\n   powershell -c \"irm https://astral.sh/uv/install.ps1 | iex\"\n   \n   # Or via pip\n   pip install uv\n   ```\n\n2. **Clone the repository**:\n   ```bash\n   git clone <repository-url>\n   cd Agent_System\n   ```\n\n3. **Install dependencies with uv**:\n   ```bash\n   # Create virtual environment and install dependencies\n   uv sync\n   \n   # Activate the environment\n   source .venv/bin/activate  # On Unix/macOS\n   # or\n   .venv\\Scripts\\activate     # On Windows\n   ```\n\n4. **Configure environment**:\n   ```bash\n   # Copy and edit configuration files\n   cp .env.example .env\n   cp .env.a2ap.example .env.a2ap              # If needed\n   cp .env.mcp.example .env.mcp                # If needed\n   cp .env.prompt_engineer.example .env.prompt_engineer  # If needed\n   ```\n\n5. **Start Ollama** (if not running):\n   ```bash\n   ollama serve\n   ollama pull qwen2.5:latest\n   ollama pull google/gemma3:latest  # For sentiment analysis\n   ```\n\n### Quick Launch\n\nStart all services with the integrated launcher:\n\n```bash\npython launcher.py\n```\n\nThis will automatically start:\n- **MCP Server** on `http://localhost:8000`\n- **Gradio Interface** on `http://localhost:7860`\n- **A2A Agent Registry** (embedded)\n\n## 🎯 Usage Examples\n\n### Web Interface\n\n1. **Open your browser** to `http://localhost:7860`\n2. **Try these example requests**:\n\n```\n\"Wie wird das Wetter morgen in Berlin?\"\n→ Automatic web search with weather optimization\n\n\"Korrigiere diesen Text: Das ist ein sehr schlechte Satz mit viele Fehler.\"\n→ Grammar correction via Lektor agent\n\n\"Optimiere diesen Text für eine professionelle E-Mail: Das Produkt ist Schrott!\"\n→ Professional email generation via Optimizer agent\n\n\"Analysiere das Sentiment: Ich bin so glücklich über dieses großartige Produkt!\"\n→ Sentiment analysis with emotion detection\n\n\"Wie spät ist es jetzt?\"\n→ NTP-synchronized time retrieval\n```\n\n### API Usage\n\n```python\nimport httpx\n\n# Direct MCP tool call\nasync with httpx.AsyncClient() as client:\n    response = await client.post(\n        \"http://localhost:8000/mcp/call-tool\",\n        json={\n            \"name\": \"duckduckgo_search\",\n            \"arguments\": {\"query\": \"weather Berlin\", \"max_results\": 5}\n        }\n    )\n    print(response.json())\n```\n\n### Agent Integration\n\n```python\nfrom agent_server.user_interface import process_input\n\n# Intelligent request processing\nresult = await process_input(\"Mache diesen Text freundlicher: Ihre Anfrage wurde abgelehnt.\")\nprint(result.final_result)\n```\n\n## 🔧 Configuration\n\n### Modular Configuration System\n\nThe system uses a modular configuration approach with separate files for different components:\n\n- **`.env`** - Main system configuration (server, models, debugging)\n- **`.env.a2ap`** - Agent-to-Agent Protocol settings (communication, discovery, delegation)\n- **`.env.mcp`** - Model Context Protocol settings (context management, optimization)\n- **`.env.prompt_engineer`** - Prompt Engineering agent settings (optimization strategies, templates, quality metrics)\n\nThe `core/config_manager.py` module provides centralized access to all configuration values with type-safe getters and automatic loading of all configuration files.\n\n### Environment Variables\n\n```bash\n# LLM Configuration\nBASE_URL=http://localhost:11434/v1\nAPI_KEY=ollama\nUSER_INTERFACE_MODEL=qwen2.5:latest\nOPTIMIZER_MODEL=qwen2.5:latest\nLEKTOR_MODEL=qwen2.5:latest\nSENTIMENT_MODEL=qwen2.5:latest\nQUERY_REF_MODEL=qwen2.5:latest\n\n# Server Configuration\nSERVER_HOST=localhost\nSERVER_PORT=8000\nSERVER_SCHEME=http\nGRADIO_HOST=127.0.0.1\nGRADIO_PORT=7860\n\n# Debug Options\nDEBUG_AGENT_RESPONSES=false\nDEBUG_A2A_CALLS=false\n\n# Service Configuration\nANONYMIZER_USE_LLM=false\nANONYMIZER_LLM_ENDPOINT=\nANONYMIZER_LLM_API_KEY=\nANONYMIZER_LLM_MODEL=\n```\n\n### Model Requirements\n\nEnsure these models are available in Ollama:\n```bash\nollama pull qwen2.5:latest  # Primary model for all agents\n# Or configure different models per agent in .env\n```\n\n## 📚 Available Tools & Agents\n\n### MCP Tools\n\n| Tool | Description | Parameters |\n|------|-------------|------------|\n| `get_current_time` | NTP-synchronized UTC time | None |\n| `duckduckgo_search` | Web search with weather optimization | `query`, `max_results` |\n| `extract_website_text` | Extract main content from URLs | `url` |\n| `anonymize_text` | Remove PII from text | `text` |\n| `convert_to_pdf` | Convert files to PDF format | `input_filepath`, `output_directory` |\n\n### A2A Agents\n\n| Agent | Purpose | Input | Output |\n|-------|---------|-------|--------|\n| **Optimizer** | Professional text optimization | Raw text + tonality | Polished professional text |\n| **Lektor** | Grammar & spelling correction | Text with errors | Corrected text |\n| **Sentiment** | Emotion & sentiment analysis | Any text | Sentiment score + emotions |\n| **Query Ref** | LLM query optimization | User query | Optimized query |\n| **User Interface** | Intelligent request routing | Natural language | Coordinated response |\n| **Prompt Engineer** | Advanced prompt optimization | User query | Optimized prompt + execution plan |\n\n### Supported File Types\n\n#### Text Processing\n- `.txt`, `.md`, `.py`, `.csv`, `.log`, `.json`, `.xml`, `.html`\n\n#### PDF Conversion\n- **Text files**: All above formats\n- **Images**: `.jpg`, `.png`, `.gif`, `.bmp`, `.tiff`, `.webp`\n- **Office docs**: `.docx`, `.xlsx`, `.pptx` (requires LibreOffice)\n\n## 🔄 Workflows\n\n### Intelligent Text Processing\n```\nUser Input → Intent Detection → Agent Selection → Processing → Response\n     ↓              ↓              ↓              ↓          ↓\n\"Fix grammar\" → Text Processing → Lektor Agent → Correction → Clean Text\n```\n\n### Professional Email Generation\n```\nComplaint Text → Optimizer Agent → Professional Email → Lektor Check → Final Email\n```\n\n### Multi-Step Analysis\n```\nRaw Text → Query Refactor → Optimization → Grammar Check → Sentiment Analysis\n```\n\n## 🛠️ Development\n\n### Project Structure\n\n```\nAgent_System/\n├── core/                   # Core system components\n│   └── config_manager.py   # Modular configuration manager\n├── agent_server/           # A2A agents\n│   ├── user_interface.py   # Main coordination agent\n│   ├── optimizer.py        # Text optimization\n│   ├── lektor.py          # Grammar correction\n│   ├── sentiment.py       # Sentiment analysis\n│   └── query_ref.py       # Query refactoring\n├── mcp_services/          # MCP service implementations\n│   ├── mcp_search/        # DuckDuckGo integration\n│   ├── mcp_website/       # Web scraping\n│   ├── mcp_time/         # NTP time services\n│   ├── mcp_anonymizer/   # Data anonymization\n│   └── mcp_fileconverter/ # PDF conversion\n├── .env                   # Main configuration\n├── .env.a2ap             # A2A Protocol configuration\n├── .env.mcp              # Model Context Protocol configuration\n├── .env.prompt_engineer  # Prompt Engineering configuration\n├── mcp_main.py           # MCP server\n├── launcher.py           # Service orchestrator\n├── gradio_interface.py   # Web UI\n├── a2a_server.py        # A2A registry\n├── pyproject.toml        # uv project configuration\n└── uploaded_files/      # File upload storage\n```\n\n### Development with uv\n\n```bash\n# Install development dependencies\nuv sync --dev\n\n# Add new dependency\nuv add package-name\n\n# Remove dependency\nuv remove package-name\n\n# Update dependencies\nuv lock --upgrade\n\n# Run specific scripts\nuv run python launcher.py\nuv run python mcp_main.py\n```\n\n### Adding New Agents\n\n1. **Create agent file** in `agent_server/`:\n```python\nfrom pydantic_ai import Agent\nfrom pydantic import BaseModel\n\nclass MyAgentResponse(BaseModel):\n    result: str\n\nasync def my_agent_a2a_function(messages: list) -> MyAgentResponse:\n    # Implementation\n    pass\n```\n\n2. **Register in A2A server**:\n```python\n# In a2a_server.py\nregistry.register_a2a_agent(\"my_agent\", my_agent_a2a_function)\n```\n\n3. **Add to user interface** agent routing logic\n\n### Adding MCP Tools\n\n1. **Implement service** in `mcp_services/`\n2. **Add endpoint** in `mcp_main.py`\n3. **Register tool** in MCP configuration\n\n## 🧪 Testing\n\n### Manual Testing\n```bash\n# Test individual agents\npython agent_server/sentiment.py\npython agent_server/optimizer.py\npython demo_prompt_engineer.py\n\n# Test MCP server\ncurl http://localhost:8000/health\n\n# Test full workflow\npython a2a_server.py\n```\n\n### Example Test Cases\n```python\n# Sentiment analysis\nawait sentiment_agent(\"I love this amazing product!\")\n\n# Text optimization\nawait optimizer_agent(\"Das Produkt ist Schrott!\", tonality=\"professionell\")\n\n# Grammar correction\nawait lektor_agent(\"Das ist ein sehr schlechte Satz.\")\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\n3. Commit changes: `git commit -m 'Add amazing feature'`\n4. Push to branch: `git push origin feature/amazing-feature`\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the **GNU Affero General Public License v3.0 (AGPLv3)** - see the [License.md](License.md) file for details.\n\n### AGPLv3 Summary\n\n- ✅ **Commercial use** - You can use this software commercially\n- ✅ **Modification** - You can modify the source code\n- ✅ **Distribution** - You can distribute the software\n- ✅ **Patent use** - Express grant of patent rights from contributors\n- ✅ **Private use** - You can use the software privately\n\n**Requirements:**\n- 📋 **License and copyright notice** - Include the license and copyright notice\n- 📋 **State changes** - Document significant changes made to the software\n- 📋 **Disclose source** - Provide source code when distributing\n- 📋 **Network use is distribution** - **Users interacting with the software over a network must be able to download the source code**\n\nThe AGPLv3 ensures that any network service using this code must provide the source code to its users, maintaining the open-source nature even in SaaS deployments.\n\n## 🙏 Acknowledgments\n\n- [Pydantic AI](https://github.com/pydantic/pydantic-ai) for the agent framework\n- [Model Context Protocol](https://modelcontextprotocol.io/) for the standards\n- [Gradio](https://gradio.app/) for the web interface\n- [Ollama](https://ollama.ai/) for local LLM support\n\n---\n\n**Built with ❤️ for intelligent multi-agent workflows**\n"}