Commit d7abfd2
committed
feat: Implement Dynamic Agent Orchestrator with MCP
This commit introduces a complete application for a dynamic agent orchestrator.
Key features:
1. **MCP Server (`app.py`):** Exposes a single generic capability ("dynamic_task_executor"). It manages the application lifecycle.
2. **Internal Logical Agent (`internal_agent.py`):** Orchestrates tasks by communicating with an internal LLM. It follows a Reason-Act-Observe loop, making decisions to call tools or respond directly.
3. **Dynamic Tool Management (`tool_manager.py`, `tools.json`):** Low-level tools are defined in an external `tools.json` file and loaded at runtime. The `ToolRegistry` class manages these definitions and maps them to executable Python functions (`tool_functions.py`).
4. **Mock Internal LLM (`llm_client.py`):** A mock client that simulates an LLM with tool-calling capabilities (OpenAI-like). This allows for testing the agent's logic without a live LLM.
5. **Configuration (`config.py`, `.env.example`):** Manages settings like LLM endpoints and API keys through environment variables.
6. **Asynchronous Design:** Core operations are asynchronous.
7. **Example Tools (`tool_functions.py`):** Includes mock implementations for database queries, REST API calls, and web scraping.
8. **Testing (`app.py` local tests):** The `app.py` includes an integrated test runner to verify the end-to-end logic from the tool invocation down to the agent and mock tool execution.
9. **Documentation (`README.md`):** Provides setup, testing, and running instructions. Docstrings and comments are included in the code.
The application is structured for extensibility, allowing new tools to be added by updating the `tools.json` configuration and providing their Python implementations without changing the core agent or server logic.1 parent d0443a1 commit d7abfd2
File tree
12 files changed
+960
-1086
lines changed- dynamic_mcp_agent
12 files changed
+960
-1086
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | 2 | | |
6 | 3 | | |
| |||
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | | - | |
34 | | - | |
| 31 | + | |
| 32 | + | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | | - | |
| 50 | + | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | 53 | | |
57 | 54 | | |
58 | 55 | | |
| |||
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
78 | | - | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
| |||
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
118 | 88 | | |
119 | 89 | | |
120 | 90 | | |
| |||
150 | 120 | | |
151 | 121 | | |
152 | 122 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
0 commit comments