Skip to content

feat: add agent routing support via OPENCLAW_AGENT_ID#35

Open
RHMDHDYT wants to merge 1 commit into
freema:mainfrom
RHMDHDYT:feature/agent-routing
Open

feat: add agent routing support via OPENCLAW_AGENT_ID#35
RHMDHDYT wants to merge 1 commit into
freema:mainfrom
RHMDHDYT:feature/agent-routing

Conversation

@RHMDHDYT

Copy link
Copy Markdown

Summary

This PR adds support for routing MCP requests to specific OpenClaw agents using the x-openclaw-agent-id header.

Changes

  • Add agentId parameter to OpenClawClient constructor
  • Add --agent-id CLI option and OPENCLAW_AGENT_ID env var
  • Include x-openclaw-agent-id header in all API requests when set
  • Support agentId in multi-instance configuration (OPENCLAW_INSTANCES)
  • Add tests for agent header injection

Usage

OPENCLAW_AGENT_ID=main npx openclaw-mcp
# or
npx openclaw-mcp --agent-id main

Backward Compatibility

Fully backward compatible — agentId is optional in all contexts.

🤖 Generated with Claude Code

Add support for routing requests to specific OpenClaw agents using
the x-openclaw-agent-id header. This enables MCP clients to target
specific agents rather than relying on default routing.

Changes:
- Add agentId parameter to OpenClawClient constructor
- Add --agent-id CLI option and OPENCLAW_AGENT_ID env var
- Include x-openclaw-agent-id header in all API requests when set
- Support agentId in multi-instance configuration
- Add tests for agent header injection

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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