मुख्य सामग्री पर जाएं
मल्टी-एजेंट सेटअप में हर एजेंट वैश्विक सैंडबॉक्स और टूल नीति को ओवरराइड कर सकता है। यह पेज प्रति-एजेंट कॉन्फ़िगरेशन, प्राथमिकता नियमों और उदाहरणों को कवर करता है।

सैंडबॉक्सिंग

बैकएंड और मोड — पूरा सैंडबॉक्स संदर्भ।

सैंडबॉक्स बनाम टूल नीति बनाम उन्नत

डिबग करें कि “यह क्यों ब्लॉक है?”

उन्नत मोड

विश्वसनीय प्रेषकों के लिए उन्नत exec।
प्रमाणीकरण एजेंट के अनुसार scoped होता है: हर एजेंट का अपना agentDir auth store ~/.openclaw/agents/<agentId>/agent/auth-profiles.json पर होता है। एजेंटों के बीच agentDir का कभी पुनः उपयोग न करें। जब एजेंटों के पास स्थानीय प्रोफ़ाइल नहीं होती, तो वे डिफ़ॉल्ट/मुख्य एजेंट की auth profiles को पढ़ सकते हैं, लेकिन OAuth refresh tokens को द्वितीयक एजेंट स्टोर में क्लोन नहीं किया जाता। यदि आप credentials को मैन्युअल रूप से कॉपी करते हैं, तो केवल पोर्टेबल स्थिर api_key या token profiles कॉपी करें।

कॉन्फ़िगरेशन उदाहरण

{
  "agents": {
    "list": [
      {
        "id": "main",
        "default": true,
        "name": "Personal Assistant",
        "workspace": "~/.openclaw/workspace",
        "sandbox": { "mode": "off" }
      },
      {
        "id": "family",
        "name": "Family Bot",
        "workspace": "~/.openclaw/workspace-family",
        "sandbox": {
          "mode": "all",
          "scope": "agent"
        },
        "tools": {
          "allow": ["read", "message"],
          "deny": ["exec", "write", "edit", "apply_patch", "process", "browser"],
          "message": {
            "crossContext": {
              "allowWithinProvider": false,
              "allowAcrossProviders": false
            }
          }
        }
      }
    ]
  },
  "bindings": [
    {
      "agentId": "family",
      "match": {
        "provider": "whatsapp",
        "accountId": "*",
        "peer": {
          "kind": "group",
          "id": "120363424282127706@g.us"
        }
      }
    }
  ]
}
परिणाम:
  • main एजेंट: होस्ट पर चलता है, पूरा टूल एक्सेस।
  • family एजेंट: Docker में चलता है (प्रति एजेंट एक container), केवल read और मौजूदा-बातचीत वाले संदेश भेजना।
{
  "agents": {
    "list": [
      {
        "id": "personal",
        "workspace": "~/.openclaw/workspace-personal",
        "sandbox": { "mode": "off" }
      },
      {
        "id": "work",
        "workspace": "~/.openclaw/workspace-work",
        "sandbox": {
          "mode": "all",
          "scope": "shared",
          "workspaceRoot": "/tmp/work-sandboxes"
        },
        "tools": {
          "allow": ["read", "write", "apply_patch", "exec"],
          "deny": ["browser", "gateway", "discord"]
        }
      }
    ]
  }
}
{
  "tools": { "profile": "coding" },
  "agents": {
    "list": [
      {
        "id": "support",
        "tools": { "profile": "messaging", "allow": ["slack"] }
      }
    ]
  }
}
परिणाम:
  • डिफ़ॉल्ट एजेंटों को coding tools मिलते हैं।
  • support एजेंट केवल-संदेश है (+ Slack tool)।
{
  "agents": {
    "defaults": {
      "sandbox": {
        "mode": "non-main",
        "scope": "session"
      }
    },
    "list": [
      {
        "id": "main",
        "workspace": "~/.openclaw/workspace",
        "sandbox": {
          "mode": "off"
        }
      },
      {
        "id": "public",
        "workspace": "~/.openclaw/workspace-public",
        "sandbox": {
          "mode": "all",
          "scope": "agent"
        },
        "tools": {
          "allow": ["read"],
          "deny": ["exec", "write", "edit", "apply_patch"]
        }
      }
    ]
  }
}

कॉन्फ़िगरेशन प्राथमिकता

जब वैश्विक (agents.defaults.*) और एजेंट-विशिष्ट (agents.list[].*) दोनों configs मौजूद हों:

सैंडबॉक्स config

एजेंट-विशिष्ट सेटिंग्स वैश्विक को ओवरराइड करती हैं:
agents.list[].sandbox.mode > agents.defaults.sandbox.mode
agents.list[].sandbox.scope > agents.defaults.sandbox.scope
agents.list[].sandbox.workspaceRoot > agents.defaults.sandbox.workspaceRoot
agents.list[].sandbox.workspaceAccess > agents.defaults.sandbox.workspaceAccess
agents.list[].sandbox.docker.* > agents.defaults.sandbox.docker.*
agents.list[].sandbox.browser.* > agents.defaults.sandbox.browser.*
agents.list[].sandbox.prune.* > agents.defaults.sandbox.prune.*
agents.list[].sandbox.{docker,browser,prune}.* उस एजेंट के लिए agents.defaults.sandbox.{docker,browser,prune}.* को ओवरराइड करता है (जब सैंडबॉक्स scope "shared" पर resolve होता है, तो इसे अनदेखा किया जाता है)।

टूल प्रतिबंध

फ़िल्टरिंग क्रम यह है:
1

टूल profile

tools.profile या agents.list[].tools.profile
2

प्रदाता टूल profile

tools.byProvider[provider].profile या agents.list[].tools.byProvider[provider].profile
3

वैश्विक टूल नीति

tools.allow / tools.deny
4

प्रदाता टूल नीति

tools.byProvider[provider].allow/deny
5

एजेंट-विशिष्ट टूल नीति

agents.list[].tools.allow/deny
6

एजेंट प्रदाता नीति

agents.list[].tools.byProvider[provider].allow/deny
7

सैंडबॉक्स टूल नीति

tools.sandbox.tools या agents.list[].tools.sandbox.tools
8

उप-एजेंट टूल नीति

tools.subagents.tools, यदि लागू हो।
  • हर स्तर टूल्स को और प्रतिबंधित कर सकता है, लेकिन पहले के स्तरों से deny किए गए टूल्स को वापस grant नहीं कर सकता।
  • यदि agents.list[].tools.sandbox.tools सेट है, तो यह उस एजेंट के लिए tools.sandbox.tools को बदल देता है।
  • यदि agents.list[].tools.profile सेट है, तो यह उस एजेंट के लिए tools.profile को ओवरराइड करता है।
  • प्रदाता टूल keys या तो provider (जैसे google-antigravity) या provider/model (जैसे openai/gpt-5.4) स्वीकार करती हैं।
यदि उस chain में कोई भी स्पष्ट अनुमति-सूची run को बिना callable tools के छोड़ देती है, तो OpenClaw prompt को model पर सबमिट करने से पहले रुक जाता है। यह जानबूझकर है: agents.list[].tools.allow: ["query_db"] जैसे missing tool के साथ configure किया गया एजेंट तब तक स्पष्ट रूप से fail होना चाहिए जब तक query_db register करने वाला Plugin enabled न हो, न कि text-only एजेंट के रूप में जारी रहे।
टूल नीतियां group:* shorthands का समर्थन करती हैं, जो कई टूल्स में expand होते हैं। पूरी सूची के लिए टूल groups देखें। प्रति-एजेंट उन्नत overrides (agents.list[].tools.elevated) specific agents के लिए उन्नत exec को और प्रतिबंधित कर सकते हैं। विवरण के लिए उन्नत मोड देखें।

एकल एजेंट से माइग्रेशन

{
  "agents": {
    "defaults": {
      "workspace": "~/.openclaw/workspace",
      "sandbox": {
        "mode": "non-main"
      }
    }
  },
  "tools": {
    "sandbox": {
      "tools": {
        "allow": ["read", "write", "apply_patch", "exec"],
        "deny": []
      }
    }
  }
}
पुराने agent.* कॉन्फ़िगरेशन openclaw doctor द्वारा माइग्रेट किए जाते हैं; आगे के लिए agents.defaults + agents.list को प्राथमिकता दें।

टूल प्रतिबंध उदाहरण

{
  "tools": {
    "allow": ["read"],
    "deny": ["exec", "write", "edit", "apply_patch", "process"]
  }
}

सामान्य गलती: “non-main”

agents.defaults.sandbox.mode: "non-main" session.mainKey (डिफ़ॉल्ट "main") पर आधारित है, एजेंट id पर नहीं। समूह/चैनल सत्रों को हमेशा अपनी कुंजियाँ मिलती हैं, इसलिए उन्हें non-main माना जाता है और उन्हें sandbox किया जाएगा। यदि आप चाहते हैं कि कोई एजेंट कभी sandbox न हो, तो agents.list[].sandbox.mode: "off" सेट करें।

परीक्षण

बहु-एजेंट sandbox और टूल कॉन्फ़िगर करने के बाद:
1

Check agent resolution

openclaw agents list --bindings
2

Verify sandbox containers

docker ps --filter "name=openclaw-sbx-"
3

Test tool restrictions

  • ऐसा संदेश भेजें जिसके लिए प्रतिबंधित टूल चाहिए।
  • सत्यापित करें कि एजेंट अस्वीकृत टूल का उपयोग नहीं कर सकता।
4

Monitor logs

tail -f "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/logs/gateway.log" | grep -E "routing|sandbox|tools"

समस्या निवारण

  • जाँचें कि कहीं कोई वैश्विक agents.defaults.sandbox.mode तो नहीं है जो इसे ओवरराइड कर रहा है।
  • एजेंट-विशिष्ट कॉन्फ़िगरेशन को प्राथमिकता मिलती है, इसलिए agents.list[].sandbox.mode: "all" सेट करें।
  • टूल फ़िल्टरिंग क्रम जाँचें: वैश्विक → एजेंट → sandbox → उप-एजेंट।
  • प्रत्येक स्तर केवल और प्रतिबंधित कर सकता है, अनुमति वापस नहीं दे सकता।
  • लॉग से सत्यापित करें: [tools] filtering tools for agent:${agentId}
  • एजेंट-विशिष्ट sandbox कॉन्फ़िगरेशन में scope: "agent" सेट करें।
  • डिफ़ॉल्ट "session" है, जो प्रति सत्र एक कंटेनर बनाता है।

संबंधित