Skip to main content
Glama
agent-mesh

agent-mesh

Official
by UllrAI

Agent Mesh

English · 简体中文

Ask an agent on another machine to do work, answer its follow-up questions, and retrieve the result after a disconnect. Agent Mesh connects private agents through an MQTT 5 broker. Each host makes one outbound connection and keeps its own job history in SQLite. The CLI, six MCP tools, and an on-demand browser workbench use the same local daemon over a Unix socket.

For example, a laptop assistant can discover an agent with access to the orders repository on a VM, request a read-only analysis, and answer “API only” in the original session. The VM owner configures the available methods, working directory and runtime permissions.

How a call works

Local workbench, CLI, or MCP bridge
       │ Unix socket
  caller daemon → MQTT 5 broker → worker daemon → local runtime
       │                                │
     SQLite                           SQLite

Each invocation gets a job_id. A multi-turn method also returns a session_id. A worker can finish a round with a question and release its execution slot while you decide. Answering creates a new job in the same session. Discovery and status use retained MQTT messages; requests and replies expire. SQLite lets either daemon recover the last confirmed state independently of the terminal.

Related MCP server: mcp-a2a-bridge

Try two nodes locally

You need macOS or Linux, Python 3.11+, uv and Mosquitto with its password utility. The demo starts an Echo worker so you can try a full conversation without a model account. On macOS, install the broker with brew install mosquitto. On Ubuntu, use sudo apt install mosquitto mosquitto-clients. The demo listens on 127.0.0.1:18883 by default.

git clone https://github.com/UllrAI/AgentMesh.git
cd AgentMesh
uv sync --locked
uv run python examples/local/setup.py "$HOME/.agent-mesh/demo"

In three terminals, from the checkout, run one of these commands per terminal. The setup script generates fresh credentials, a one-way caller-to-worker ACL, and a broker configuration bound to loopback.

# Terminal 1
mosquitto -c "$HOME/.agent-mesh/demo/mosquitto.conf"

# Terminal 2
. "$HOME/.agent-mesh/demo/env"
uv run agent-mesh serve --config "$HOME/.agent-mesh/demo/worker.yaml"

# Terminal 3
. "$HOME/.agent-mesh/demo/env"
uv run agent-mesh serve --config "$HOME/.agent-mesh/demo/caller.yaml"

On Linux distributions that restrict the Mosquitto service to system configuration paths, use the container command for Terminal 1.

Open the local workbench

The node directory shows the local caller, the worker, and its advertised method.

The workbench opens on the node view. See which nodes the caller has discovered, check their online status, and read what their methods do. Choose a method on the target node to send a request.

With the demo caller daemon running, use a fourth terminal on the same machine.

uv run agent-mesh ui --socket "$HOME/.agent-mesh/demo/caller.sock"

Open the task view to find an earlier request, read its result, or answer a clarifying question. If two jobs have the same question, use the request previews to find the right one. You can switch between views while your tasks continue to run.

The task workbench in dark mode shows a completed request and its result.

The command opens the browser by default. Use --no-open to print the link and open it yourself. The interface uses English or Chinese based on your browser language and follows your system’s light or dark appearance. Press Ctrl+C in the workbench terminal to stop its page server. The caller daemon and accepted tasks continue running. Workbench access details

Use the CLI

In a separate terminal, list the nodes and call the worker. It asks which part of the project to analyze. The CLI prints an answer command containing the question's actual job ID.

export AGENT_MESH_SOCKET="$HOME/.agent-mesh/demo/caller.sock"
uv run agent-mesh list
uv run agent-mesh call worker demo.analyze --prompt 'Analyze the module boundaries' --wait
# Replace QUESTION_JOB_ID with the value printed above.
uv run agent-mesh answer 'QUESTION_JOB_ID' --text 'API only' --wait
uv run agent-mesh jobs

To skip the clarification, provide the scope in the first request.

uv run agent-mesh call worker demo.analyze --params '{"prompt":"Analyze the module boundaries","scope":"API"}' --wait

Find a task again

jobs reads recent outbound tasks from the caller's local database, including when offline. Use job JOB_ID to see the current snapshot and the latest confirmed answer. A needs_input result carries a question and deadline. A succeeded result carries the output. For an independent follow-up in the same conversation, call the original target and method with --session SESSION_ID. Interactive calls wait up to 30 seconds by default. Use --async to return immediately or --wait in a script.

Connect an MCP client

With the caller daemon running, register its stdio bridge. Run these commands from the checkout so the executable path is absolute.

codex mcp add agent-mesh -- "$PWD/.venv/bin/agent-mesh" mcp --socket "$HOME/.agent-mesh/demo/caller.sock"
claude mcp add agent-mesh -- "$PWD/.venv/bin/agent-mesh" mcp --socket "$HOME/.agent-mesh/demo/caller.sock"

The bridge exposes mesh_list, mesh_inspect, mesh_invoke, mesh_answer, mesh_job_status and mesh_jobs. An asynchronous submit returns a job ID. The host can use a bounded wait on that ID and deliver the result or question in the originating conversation. To install the CLI independently of the checkout, run uv tool install git+https://github.com/UllrAI/AgentMesh.git.

Use a real worker

The target owner chooses which methods to expose and their working directory, concurrency, execution timeout and permissions. Adapters support Codex, Claude Code and fixed local commands. The fixed-command adapter accepts a JSON request on stdin and can integrate another runtime with a known execution interface. The deployment guide includes a complete worker configuration, a tested Codex profile, the handler contract and service setup.

Use a different broker account, socket and database for each agent. The example ACL grants caller → worker; this grant covers every method the worker exposes. Put methods with different caller permissions on separate logical agents. The broker can read the messages it forwards. Use TLS with certificate verification over public networks.

Development and verification

uv sync --locked
uv run pytest -q
uv build

Install Mosquitto and its password utility to run the real-broker tests. The suite covers dropped replies, retained-message filtering, duplicate delivery, concurrent answers and killing a worker daemon mid-job. Live Codex checks and Claude Code checks with a scripted model backend are documented separately.

Documentation

The implementation uses Python, SQLite, Eclipse Paho via aiomqtt, and the official MCP Python SDK. The package version and the wire protocol version are independent.

Copyright 2026 UllrAI. Apache License 2.0.

Available Tools

6 tools
mesh_answerA

用提问轮的 job_id 和答复文本异步答复。用返回的新 job_id 查询答复轮进展。

Inputs: text (required), job_id (required). Returns: object

mesh_inspectB
Read-only

查看指定 Agent 的 Card 和方法输入约定。

Inputs: agent_id (required). Returns: object

mesh_invokeC

异步提交新任务或继续指定会话。按目标方法的输入约定填写 params。

用户需要结果或澄清时,用本次返回的 job_id 调用 mesh_job_status。

Inputs: method (required), params (required), target (required), session_id, +1 more. Returns: object

mesh_jobsB
Read-only

按提交时间倒序列出本地出站任务。适用于找回先前提交的任务。

Inputs: limit. Returns: object

mesh_job_statusA
Read-only

查询指定轮及其澄清答复进展。

用户在等结果或问题时,用刚提交返回的 job_id,并设置短于宿主工具时限的 wait_timeout_s(例如宿主允许 60 秒时等 50 秒)。省略或传 0 则不等待执行结束。 若返回 needs_input,先依据已有上下文作答,仍需用户决定时把该任务的问题转交给用户。

Inputs: job_id (required), wait_timeout_s. Returns: object

mesh_listB
Read-only

列出 Agent、在线状态和能力。可按方法筛选。

Inputs: method. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation4/5

    The tools split cleanly along resource lines: discovery (mesh_list, mesh_inspect), task execution (mesh_invoke), and job lifecycle (mesh_jobs, mesh_job_status, mesh_answer). mesh_invoke and mesh_answer could be momentarily confused since both advance a task asynchronously, but the descriptions make the distinction (new/continued task vs. replying to a clarification round) clear. mesh_jobs vs. mesh_job_status is also distinct enough (list vs. single-job poll).

    Naming Consistency4/5

    All names share a consistent mesh_ prefix and snake_case formatting, which makes scanning easy. However, the pattern is mixed: list/inspect/invoke/answer are verb_noun, while mesh_jobs and mesh_job_status are noun phrases rather than actions. This is a minor deviation, not a readability problem.

    Tool Count5/5

    Six tools is well within the sweet spot for an agent-discovery-and-invocation server, and each maps to a distinct step in the workflow (discover, inspect contract, invoke, monitor, answer, list past jobs). No tool feels redundant or decorative.

    Completeness4/5

    The core lifecycle is covered: enumerate agents, inspect their method contracts, submit tasks, poll status, answer clarifications, and recover prior outbound jobs. The notable gap is task control — there is no cancel/abort operation for a running job, and no way to enumerate supported methods or manage agent registration. Agents can work around these, but cancellation is a real missing primitive.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers