Skip to content

release(r1): cross-runtime AgentMesh first-class tool wrappers - #184

Merged
Pal Lakatos-Toth (pallakatos) merged 3 commits into
devfrom
feat/release-r1-batch3
May 3, 2026
Merged

Pal Lakatos-Toth (pallakatos) merged 3 commits into
devfrom
feat/release-r1-batch3

Conversation

@pallakatos

Copy link
Copy Markdown
Collaborator

R1 Batch 3 — cross-runtime mesh tool exposure

Stacked on #182 (R1 batch 1) and #183 (R1 batch 2).

Adds a mesh_tools.py module to all 5 Python runtime adapters
(openai-agents, maf-python, langgraph, anthropic, pydantic-ai). Each
exposes build_mesh_tools() returning native Tool objects of the
runtime's framework. Two tools are registered per runtime:

Framework SDKs are imported lazily inside build_mesh_tools() (matches
the existing Foundry-tools pattern in tools.py).

Verification

  • AST syntax check on all 10 modified files: ✅
  • Existing test_tools.py pattern mirrored.
  • No behavioural change to wired runtimes; new public API is purely
    additive.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Pal Lakatos-Toth and others added 2 commits May 3, 2026 23:28
R1 batch 2 — three small, independent release-readiness fixes.

1) mesh_inbox tool description (`mesh-plugin` + `openclaw` plugins):
   adds an explicit "ALWAYS call this tool FIRST whenever your task
   description says a peer agent has sent you data" line. Without this,
   models routinely write a fresh response instead of picking up the
   parent's KNOCK message, breaking inter-agent handoff. Tool semantics
   unchanged — description only.

2) BYO strict-mode reference: adds an intentionally-invalid CR
   (`examples/byo-quickstart/k8s/clawsandbox-strict-demo.yaml` with
   `contractVersion: v999`) plus a §5 walkthrough in the example
   README that flips `controller.byoStrict=true` and observes the
   `BYOContractInvalid` Degraded condition. Production-deployment
   recipe for the strict gate that already exists in the controller.

3) Stale comment cleanup in `controller/src/reconciler/runtime.rs`:
   the LangGraph dispatch was annotated "TS gated as ShapeInvalid"
   from before the TS adapter shipped (PR #182). Updated to reflect
   that both Python and TypeScript flavours are wired end-to-end.

No behavioural change to wired runtimes; no new public API surface.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a `mesh_tools.py` module to all 5 Python runtime adapters
(openai-agents, maf-python, langgraph, anthropic, pydantic-ai). Each
exposes `build_mesh_tools()` returning native Tool objects of the
runtime's framework — `agents.function_tool` for openai-agents,
`agent_framework.ai_function` for MAF, `langchain_core.tools.tool` for
LangGraph, `claude_agent_sdk.tool` for Anthropic, and `pydantic_ai.Tool`
for Pydantic-AI.

Two tools are registered per runtime:

* `mesh_inbox()` — drains pending AgentMesh messages. Description
  carries the explicit "INBOX-FIRST" nudge (matching the
  mesh-plugin / OpenClaw nudge in PR #183) so models reliably pick up
  parent KNOCK messages after a handoff.
* `mesh_send(target_agent, content, skill_id)` — sends an A2A
  TaskEnvelope to a peer agent.

Framework SDKs are imported lazily inside `build_mesh_tools()` (matches
the `tools.py` Foundry-tools pattern), so unit tests that don't have
the SDK installed degrade to the smoke-test path.

Smoke tests added for openai-agents and maf-python (the two adapters
with an existing pytest setup); langgraph / anthropic / pydantic-ai
get the production code now and tests will follow with their pytest
infrastructure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The runtime image-override tests (e.g. openai_agents_default_image_*)
all share a process-global env var. Rust's default test harness runs
multiple threads concurrently, so tests like
`openai_agents_default_image_honours_env_override` would set
"myacr.azurecr.io/openai-agents:pinned" while
`openai_agents_default_image_treats_blank_env_as_unset` happened to
read it, producing a flaky failure that bit PR #184 CI:
  left:  "myacr.azurecr.io/openai-agents:pinned"
  right: "azureclawacr.azurecr.io/azureclaw-runtime-openai-agents:latest"

Added a module-local `ENV_LOCK: Mutex<()>` and have every test that
mutates a *_RUNTIME_IMAGE env var take `_g = ENV_LOCK.lock()...` at
its top. Uses unwrap_or_else(into_inner) so a panicking sibling test
doesn't poison the lock for everyone else.

20 tests instrumented. Full controller test suite: 483 passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pallakatos
Pal Lakatos-Toth (pallakatos) merged commit 0a57a01 into dev May 3, 2026
21 checks passed
@pallakatos
Pal Lakatos-Toth (pallakatos) deleted the feat/release-r1-batch3 branch May 3, 2026 22:08
Pal Lakatos-Toth (pallakatos) added a commit that referenced this pull request May 12, 2026
* release(r1): mesh_inbox INBOX-FIRST nudge + BYO strict-mode demo

R1 batch 2 — three small, independent release-readiness fixes.

1) mesh_inbox tool description (`mesh-plugin` + `openclaw` plugins):
   adds an explicit "ALWAYS call this tool FIRST whenever your task
   description says a peer agent has sent you data" line. Without this,
   models routinely write a fresh response instead of picking up the
   parent's KNOCK message, breaking inter-agent handoff. Tool semantics
   unchanged — description only.

2) BYO strict-mode reference: adds an intentionally-invalid CR
   (`examples/byo-quickstart/k8s/clawsandbox-strict-demo.yaml` with
   `contractVersion: v999`) plus a §5 walkthrough in the example
   README that flips `controller.byoStrict=true` and observes the
   `BYOContractInvalid` Degraded condition. Production-deployment
   recipe for the strict gate that already exists in the controller.

3) Stale comment cleanup in `controller/src/reconciler/runtime.rs`:
   the LangGraph dispatch was annotated "TS gated as ShapeInvalid"
   from before the TS adapter shipped (PR #182). Updated to reflect
   that both Python and TypeScript flavours are wired end-to-end.

No behavioural change to wired runtimes; no new public API surface.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* release(r1): cross-runtime AgentMesh first-class tool wrappers

Adds a `mesh_tools.py` module to all 5 Python runtime adapters
(openai-agents, maf-python, langgraph, anthropic, pydantic-ai). Each
exposes `build_mesh_tools()` returning native Tool objects of the
runtime's framework — `agents.function_tool` for openai-agents,
`agent_framework.ai_function` for MAF, `langchain_core.tools.tool` for
LangGraph, `claude_agent_sdk.tool` for Anthropic, and `pydantic_ai.Tool`
for Pydantic-AI.

Two tools are registered per runtime:

* `mesh_inbox()` — drains pending AgentMesh messages. Description
  carries the explicit "INBOX-FIRST" nudge (matching the
  mesh-plugin / OpenClaw nudge in PR #183) so models reliably pick up
  parent KNOCK messages after a handoff.
* `mesh_send(target_agent, content, skill_id)` — sends an A2A
  TaskEnvelope to a peer agent.

Framework SDKs are imported lazily inside `build_mesh_tools()` (matches
the `tools.py` Foundry-tools pattern), so unit tests that don't have
the SDK installed degrade to the smoke-test path.

Smoke tests added for openai-agents and maf-python (the two adapters
with an existing pytest setup); langgraph / anthropic / pydantic-ai
get the production code now and tests will follow with their pytest
infrastructure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(controller): serialize env-mutating runtime tests

The runtime image-override tests (e.g. openai_agents_default_image_*)
all share a process-global env var. Rust's default test harness runs
multiple threads concurrently, so tests like
`openai_agents_default_image_honours_env_override` would set
"myacr.azurecr.io/openai-agents:pinned" while
`openai_agents_default_image_treats_blank_env_as_unset` happened to
read it, producing a flaky failure that bit PR #184 CI:
  left:  "myacr.azurecr.io/openai-agents:pinned"
  right: "azureclawacr.azurecr.io/azureclaw-runtime-openai-agents:latest"

Added a module-local `ENV_LOCK: Mutex<()>` and have every test that
mutates a *_RUNTIME_IMAGE env var take `_g = ENV_LOCK.lock()...` at
its top. Uses unwrap_or_else(into_inner) so a panicking sibling test
doesn't poison the lock for everyone else.

20 tests instrumented. Full controller test suite: 483 passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Pal Lakatos-Toth <pallakatos@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant