Skip to content

Feature: Per-agent provider environment overrides for multi-machine setups #15

Description

@shannon0430

Problem

In multi-machine setups where different agents run on different physical machines (each with their own OpenClaw gateway), OpenGoat currently only supports a single gateway URL per provider. All agents using the openclaw provider are dispatched to the same gateway.

Example scenario:

  • Machine A runs Agent-A (main), Agent-B, and Agent-C via OpenClaw gateway at ws://127.0.0.1:18789
  • Machine B runs Agent-D via a separate OpenClaw gateway at ws://10.0.0.2:18789
  • Both machines are connected via Tailscale

Currently, the openclaw provider config (~/.opengoat/providers/openclaw/config.json) sets OPENCLAW_GATEWAY_URL globally. There's no way to route Agent-D's tasks to Machine B's gateway while keeping other agents on Machine A.

Proposed Solution

Allow per-agent provider environment overrides in the agent's config.json:

{
  "runtime": {
    "provider": {
      "id": "openclaw",
      "env": {
        "OPENCLAW_GATEWAY_URL": "ws://10.0.0.2:18789",
        "OPENCLAW_GATEWAY_PASSWORD": "..."
      }
    }
  }
}

Implementation

The change is minimal — in ProviderService.resolveProviderEnv(), merge the agent-level runtime.provider.env map on top of the shared provider config:

shared provider env  <  agent-level provider.env  <  process.env

This maintains backward compatibility (no env field = current behavior) while enabling per-agent gateway routing.

Use Case

This is essential for multi-agent organizations where:

  • A specialized agent runs on a dedicated machine (security isolation)
  • Another agent runs on a separate machine (performance optimization)
  • The orchestrator agent manages task delegation from a central machine

All agents share the same OpenGoat task board, but execution is distributed across machines.

Alternatives Considered

Approach Downside
Multiple provider registrations (e.g., openclaw-remote) Requires code changes to provider registry, less elegant
Separate task-cron per machine Loses centralized task board, operational complexity
SSH wrapper via OPENCLAW_CMD Hacky, applies globally, not per-agent
Running OpenGoat on each machine independently No shared task board, defeats the purpose

Environment

  • OpenGoat v2026.2.23
  • OpenClaw v2026.3.2
  • macOS, Tailscale for inter-machine networking

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions