Skip to content

Commit d7abfd2

Browse files
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

12 files changed

+960
-1086
lines changed

.gitignore

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.DS_Store
2-
scratch/
3-
41
# Byte-compiled / optimized / DLL files
52
__pycache__/
63
*.py[cod]
@@ -23,15 +20,16 @@ parts/
2320
sdist/
2421
var/
2522
wheels/
23+
pip-wheel-metadata/
2624
share/python-wheels/
2725
*.egg-info/
2826
.installed.cfg
2927
*.egg
3028
MANIFEST
3129

3230
# PyInstaller
33-
# Usually these files are written by a python script from a template
34-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
# Usually these files are written by a script go generate an executable file to run the program without
32+
# Python installed.
3533
*.manifest
3634
*.spec
3735

@@ -49,10 +47,9 @@ htmlcov/
4947
nosetests.xml
5048
coverage.xml
5149
*.cover
52-
*.py,cover
50+
*.log
5351
.hypothesis/
5452
.pytest_cache/
55-
cover/
5653

5754
# Translations
5855
*.mo
@@ -75,7 +72,6 @@ instance/
7572
docs/_build/
7673

7774
# PyBuilder
78-
.pybuilder/
7975
target/
8076

8177
# Jupyter Notebook
@@ -86,35 +82,9 @@ profile_default/
8682
ipython_config.py
8783

8884
# pyenv
89-
# For a library or package, you might want to ignore these files since the code is
90-
# intended to run in multiple environments; otherwise, check them in:
91-
# .python-version
92-
93-
# pipenv
94-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97-
# install all needed dependencies.
98-
#Pipfile.lock
99-
100-
# poetry
101-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102-
# This is especially recommended for binary packages to ensure reproducibility, and is more
103-
# commonly ignored for libraries.
104-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105-
#poetry.lock
106-
107-
# pdm
108-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109-
#pdm.lock
110-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111-
# in version control.
112-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
113-
.pdm.toml
114-
.pdm-python
115-
.pdm-build/
116-
117-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
85+
.python-version
86+
87+
# PEP 582; __pypackages__ directory
11888
__pypackages__/
11989

12090
# Celery stuff
@@ -150,21 +120,3 @@ dmypy.json
150120

151121
# Pyre type checker
152122
.pyre/
153-
154-
# pytype static type analyzer
155-
.pytype/
156-
157-
# Cython debug symbols
158-
cython_debug/
159-
160-
# PyCharm
161-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
162-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
163-
# and can be added to the global gitignore or merged into this file. For a more nuclear
164-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
165-
#.idea/
166-
167-
# vscode
168-
.vscode/
169-
.windsurfrules
170-
**/CLAUDE.local.md

0 commit comments

Comments
 (0)