A config-driven, plug-and-play worker agent template built on LangGraph + FastMCP.
Project description
๐ค Universal Worker Agent Template
A config-driven, plug-and-play worker agent template.
Clone the folder, edit config.yaml, and you have a brand new specialized agent โ no code changes needed.
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Main Agent โ
โ (calls workers via MCP tool calls) โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP (stdio / SSE)
โโโโโโโโโโโผโโโโโโโโโโโ
โ main.py โ โโโโ FastMCP bridge
โ execute_task(...) โ exposes 1 tool
โโโโโโโโโโโฌโโโโโโโโโโโ
โ asyncio
โโโโโโโโโโโผโโโโโโโโโโโ
โ core/agent.py โ โโโโ LangGraph ReAct loop
โ LangGraph + Ollama โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ MCP clients (stdio)
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โโโโโโผโโโโโ โโโโโผโโโโโ โโโโผโโโโโโโ
โFS Serverโ โ Web โ โ Custom โ
โ (npx) โ โ Search โ โ Server โ
โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโ
| Component | File | Responsibility |
|---|---|---|
| Config | config.yaml |
Defines everything โ identity, model, tools, server port |
| Config loader | core/config_loader.py |
Parses YAML into typed dataclasses |
| ReAct Agent | core/agent.py |
Loads MCP tools, runs LangGraph loop |
| MCP Bridge | main.py |
Exposes execute_task() as an MCP server |
Quick Start
1. Install uv (if not already installed)
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Install dependencies
uv sync
This creates a .venv and installs all dependencies from pyproject.toml automatically.
For development extras (ruff, mypy, pytest):
uv sync --all-extras
3. Configure your agent
Edit config.yaml โ the only file you need to touch:
agent:
name: "FileMaster"
description: "A specialized worker that organizes files and manages directory structures."
system_prompt: "You are an expert at organizing and refactoring local files."
model:
provider: "ollama" # Supported: "ollama", "openai", "gemini"
model_name: "llama3.2" # any model loaded in Ollama
# api_key: "your-api-key-here" # Uncomment if using openai or gemini (or set API_KEY env var)
mcp_clients:
- name: "filesystem-server"
command: "npx"
args:
["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/Dev/Project"]
server:
transport: "stdio" # or "sse"
port: 8001
4. Run as a subprocess (stdio) โ standard MCP
uv run worker-agent
5. Run as an HTTP server (SSE) โ call it from a browser or remote agent
uv run worker-agent --transport sse --port 8001
Cloning a New Worker
- Copy the whole folder:
cp -r Agent_a Agent_researcher
- Edit only
config.yamlin the copy:- Change
agent.name,agent.description,agent.system_prompt - Swap out
mcp_clientsfor the tools this worker needs - Change
server.portso it doesn't conflict
- Change
- Install & run:
cd Agent_researcher uv sync uv run worker-agent
Example Worker Configs
File Specialist
agent:
name: "FileMaster"
description: "A specialized worker that organizes files and manages directory structures."
system_prompt: "You are an expert at organizing and refactoring local files."
mcp_clients:
- name: "filesystem-server"
command: "npx"
args:
["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/Dev/Project"]
Web Researcher
agent:
name: "SearchPro"
description: "A research agent to summarize technical documentation found on the web."
system_prompt: "You specialize in deep web research and summarizing technical docs."
model:
provider: "openai"
model_name: "gpt-4o-mini"
api_key: "sk-..."
mcp_clients:
- name: "brave-search"
command: "npx"
args: ["-y", "@modelcontextprotocol/server-brave-search"]
Local Python MCP Server
mcp_clients:
- name: "my-server"
command: "python"
args: ["D:/DEV/mcp/server.py"]
How the Main Agent Calls This Worker
In your Main Agent's MCP config:
{
"mcpServers": {
"file-worker": {
"command": "uv",
"args": ["--directory", "D:/DEV/mcp/Agent_a", "run", "worker-agent"]
}
}
}
Dynamic Configuration (Multiple Workers)
If your Main Agent needs multiple specialized workers, you do not need to clone the entire repository multiple times. You can create several configuration YAML files (e.g., web_worker.yaml, file_worker.yaml) and pass them dynamically using the WORKER_AGENT_CONFIG environment variable.
{
"mcpServers": {
"web-worker": {
"command": "uv",
"args": ["--directory", "D:/DEV/mcp/Agent_a", "run", "worker-agent"],
"env": {
"WORKER_AGENT_CONFIG": "D:/DEV/mcp/Agent_a/web_worker.yaml"
}
},
"file-worker": {
"command": "uv",
"args": ["--directory", "D:/DEV/mcp/Agent_a", "run", "worker-agent"],
"env": {
"WORKER_AGENT_CONFIG": "D:/DEV/mcp/Agent_a/file_worker.yaml"
}
}
}
}
Or run it directly with uvx and an environment variable if the package is published:
# Linux/macOS
WORKER_AGENT_CONFIG="./custom_config.yaml" uvx worker-agent
# Windows (PowerShell)
$env:WORKER_AGENT_CONFIG="./custom_config.yaml"; uvx worker-agent
The worker exposes one tool:
execute_task(instruction: str) โ str
The Main Agent calls it like any other MCP tool. The worker handles reasoning, tool use, and error recovery internally, returning only the final result.
Project Structure
Agent_a/
โโโ config.yaml โ The only file you edit per clone
โโโ main.py โ MCP bridge (FastMCP)
โโโ pyproject.toml โ All deps & build config (hatchling)
โโโ README.md
โโโ core/
โโโ __init__.py
โโโ agent.py โ LangGraph ReAct loop
โโโ config_loader.py โ YAML โ typed dataclasses
Development Commands
# Install in dev mode with all extras
uv sync --all-extras
# Run from the project directory
uv run worker-agent
uv run worker-agent --transport sse --port 8001
# Build a distributable wheel + sdist
uv build
# Publish to PyPI
uv publish
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file worker_agent-1.0.4.tar.gz.
File metadata
- Download URL: worker_agent-1.0.4.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c14160bf19c2456e4e0dac2be441b4421d3570ad67c0ab8291425d433807be23
|
|
| MD5 |
81dedefb0468632549f6489413b3fb63
|
|
| BLAKE2b-256 |
9f08ff6625c996b3e2b81ce6cb13b0a42735dcc23f5d4093eb9e8a362c343fa8
|
File details
Details for the file worker_agent-1.0.4-py3-none-any.whl.
File metadata
- Download URL: worker_agent-1.0.4-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ace1014e696d0068c5ae2749b940239d5c12e06bf125691f398e8c9b4493c7
|
|
| MD5 |
1b62e8bb724486307196a86d9bc5232b
|
|
| BLAKE2b-256 |
2986c2dbf9385c3ce9174c25772d556b909e48860522e95bc08e341d70405cdf
|