Skip to content

ddps-lab/EdgeAgent

Repository files navigation

EdgeAgent: LangChain MCP Scheduling Middleware

Orchestrating WASM-based MCP Tool Runtimes for AI Agents across Edge-Cloud Continuum

Moohyun Song, Hayoung Kim, Kyoohyun Lee, Jae Gi Son, Kyungyong Lee

The 26th IEEE/ACM International Symposium on Cluster, Cloud and Internet Computing (CCGrid 2026)

Scheduling middleware that dynamically selects execution locations (DEVICE/EDGE/CLOUD) for MCP tool calls in LangChain.

Architecture

The system consists of three layers:

  • LLM Agent Layer: LangChain-based cognitive agent. Aware only of logical tools, operating independently of underlying infrastructure details.
  • Agent Tool Dispatcher: Control plane that intercepts logical tool calls and resolves them to optimal physical instances. Composed of RequestProxy, Tool Registry, Constraint Filter, and Pluggable Scheduler.
  • Unified Execution Layer: Consistent execution environment across Device/Edge/Cloud. Hosts physical tools via containers or the WasmMCP runtime.

Agent Tool Dispatcher

  1. Transparent Relaying (RequestProxy): Exposes invocation stubs generated from the Tool Registry to the LLM, masking the complexity of distributed infrastructure so the agent interacts through a single logical interface.
  2. Metadata Management (Tool Registry): Maps tools to multiple physical endpoints (DEVICE/EDGE/CLOUD). The Profiler continuously collects runtime metrics such as startup latency, I/O throughput, and network overhead to refine profiles.
  3. Constraint-First Filtering: Immediately prunes nodes that violate hard constraints such as data locality and privacy level, reducing the search space before scheduling.
  4. Pluggable Scheduler: Determines the final execution tier for filtered candidates. Extensible interface supporting various scheduling algorithms.

Project Structure

EdgeAgent/
├── edgeagent/                  # Core package
│   ├── types.py                  Location, SchedulingResult, ChainSchedulingResult type definitions
│   ├── profiles.py               Tool characteristic profiles + YAML loading
│   ├── registry.py               Endpoint config + tool-server mapping management
│   ├── middleware.py              MCP client connection, routing, session management
│   ├── request_proxy.py          ProxyTool exposed to LLM (Agent mode only)
│   ├── runner.py                 Scenario execution framework (Agent mode only)
│   ├── scheduler/
│   │   ├── schedulers.py         Scheduler implementations (constraint filtering + location decision)
│   │   └── scoring.py            Cost function calculation
│   └── metrics/
│       ├── metrics.py             Metrics collection
│       ├── callbacks.py           LLM inference latency tracking (Agent mode callbacks)
│       └── validation.py          Scenario result validation
├── config/                     # Per-server config YAMLs
├── scripts/scenarios/          # Scenario execution scripts
├── infra/                      # Infrastructure code
│   ├── cloud/                    AWS IaC (Terraform)
│   ├── edge/                     Edge environment setup scripts (K3S)
│   └── k8s/                      Kubernetes manifests (Knative)
└── wasm_mcp/                   # [Submodule] WASM MCP server framework
    ├── wasm_server/              Rust WASM project
    │   ├── wasmmcp/                MCP framework core
    │   ├── servers/                Rust WASM server implementations (9 servers)
    │   └── shared/                 Shared utilities
    ├── servers/                  Python MCP server implementations
    ├── docker/                   Docker configurations
    └── deploy/                   Image build/deploy scripts

Prerequisites

  • Python >= 3.13.9
  • Node.js >= 18.0
  • Docker & Docker Compose
  • OpenAI API key

Setup

1. Clone and install dependencies

git clone --recurse-submodules https://github.com/ddps-lab/EdgeAgent.git
cd EdgeAgent

pip install -e .                # editable install (or: pip install -r requirements.txt)
pip install -e ".[scenarios]"   # optional: image processing dependencies (Pillow, imagehash)

2. Install MCP servers (for local DEVICE execution)

# Node.js official MCP servers
npm install -g @modelcontextprotocol/server-filesystem@2025.11.25
npm install -g @modelcontextprotocol/server-sequential-thinking@2025.3.20

# Python official MCP servers + wasm_mcp server dependencies
pip install mcp-server-git>=0.6.0
pip install mcp-server-time>=0.6.0
pip install -r wasm_mcp/requirements.txt

3. Set up environment variables

cp .env.example .env
# Edit .env and set your OpenAI API key

4. Prepare test data

# Generate test data locally (fast, no network required)
python scripts/scenarios/setup_test_data.py --generate

# Or download public datasets (requires network)
python scripts/scenarios/setup_test_data.py

Quick Start

Run a scenario in script mode (predefined tool chain):

python scripts/scenarios/run_scenario1_script.py --scheduler brute_force

Run a scenario in agent mode (LLM selects tools autonomously):

python scripts/scenarios/run_scenario1_agent.py --scheduler brute_force

Execution Modes

Mode Description
Agent LLM selects tools autonomously; the scheduler dynamically decides location at each invocation
Script Fixed tool list per scenario; the scheduler determines entire placement before execution
python scripts/scenarios/run_scenario1_agent.py                         # Agent, default: brute_force
python scripts/scenarios/run_scenario1_script.py                        # Script, default: brute_force
python scripts/scenarios/run_scenario1_script.py --scheduler all_device # specify scheduler

Schedulers

Scheduler Description
brute_force Exhaustive search over all location combinations to minimize total cost (default)
static Uses pre-defined tool-location mappings from YAML config
all_device Places all tools on DEVICE
all_edge Places all tools on EDGE
all_cloud Places all tools on CLOUD

Scenarios

Scenario Description Script Agent
S1 Code Review Pipeline run_scenario1_script.py run_scenario1_agent.py
S2 Log Analysis Pipeline run_scenario2_script.py run_scenario2_agent.py
S3 Research Assistant Pipeline run_scenario3_script.py run_scenario3_agent.py
S4 Image Processing Pipeline run_scenario4_script.py run_scenario4_agent.py

Constraint-based Routing

Constraint Behavior
requires_gpu: true Runs only on CLOUD
privacy_sensitive: true Excludes CLOUD (DEVICE or EDGE only)
wasi_compatible: false Excludes EDGE (CONTAINER runtime only)
data_locality: local_data Pins location based on path prefix

Infrastructure

See infra/README.md for cloud (AWS EKS) and edge (K3S) deployment instructions.

License

This project is licensed under the Apache License 2.0. See LICENSE for details.

Citation

If you use this software in your research, please cite:

@inproceedings{song2026edgeagent,
  title={Orchestrating WASM-based MCP Tool Runtimes for AI Agents across Edge-Cloud Continuum},
  author={Song, Moohyun and Kim, Hayoung and Lee, Kyoohyun and Son, Jae Gi and Lee, Kyungyong},
  booktitle={The 26th IEEE/ACM International Symposium on Cluster, Cloud and Internet Computing},
  year={2026}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors