Skip to main content

मल्टी-एजेंट रूटिंग

  1. लक्ष्य: कई isolated एजेंट्स (अलग वर्कस्पेस + agentDir + सेशंस), साथ ही एक चल रहे Gateway में कई चैनल अकाउंट्स (जैसे दो WhatsApps)। 46. इनबाउंड को बाइंडिंग्स के माध्यम से किसी एजेंट तक रूट किया जाता है।

“एक एजेंट” क्या है?

एक एजेंट एक पूर्ण-स्कोप “ब्रेन” है, जिसके पास अपना:
  • वर्कस्पेस (फ़ाइलें, AGENTS.md/SOUL.md/USER.md, स्थानीय नोट्स, पर्सोना नियम)।
  • स्टेट डायरेक्टरी (agentDir) जिसमें auth प्रोफ़ाइल, मॉडल रजिस्ट्री, और प्रति-एजेंट विन्यास होता है।
  • सत्र स्टोर (चैट इतिहास + रूटिंग स्टेट) जो ~/.openclaw/agents/<agentId>/sessions के अंतर्गत होता है।
  1. Auth प्रोफ़ाइल्स प्रति‑एजेंट होती हैं। 48. प्रत्येक एजेंट अपनी स्वयं की चीज़ों से पढ़ता है:
  1. मुख्य एजेंट क्रेडेंशियल्स अपने‑आप साझा नहीं किए जाते। 50. कभी भी agentDir को एजेंट्स के बीच पुन: उपयोग न करें (यह auth/सेशन टकराव पैदा करता है)। If you want to share creds, copy auth-profiles.json into the other agent’s agentDir.
Skills are per-agent via each workspace’s skills/ folder, with shared skills available from ~/.openclaw/skills. See Skills: per-agent vs shared. Gateway एक एजेंट (डिफ़ॉल्ट) या कई एजेंट साइड‑बाय‑साइड होस्ट कर सकता है। Workspace note: each agent’s workspace is the default cwd, not a hard sandbox. Relative paths resolve inside the workspace, but absolute paths can reach other host locations unless sandboxing is enabled. See Sandboxing.

पाथ्स (त्वरित मानचित्र)

  • विन्यास: ~/.openclaw/openclaw.json (या OPENCLAW_CONFIG_PATH)
  • स्टेट डायरेक्टरी: ~/.openclaw (या OPENCLAW_STATE_DIR)
  • वर्कस्पेस: ~/.openclaw/workspace (या ~/.openclaw/workspace-<agentId>)
  • एजेंट डायरेक्टरी: ~/.openclaw/agents/<agentId>/agent (या agents.list[].agentDir)
  • सत्र: ~/.openclaw/agents/<agentId>/sessions

सिंगल-एजेंट मोड (डिफ़ॉल्ट)

यदि आप कुछ नहीं करते, तो OpenClaw एक ही एजेंट चलाता है:
  • agentId का डिफ़ॉल्ट main होता है।
  • सत्रों की कुंजी agent:main:<mainKey> के रूप में होती है।
  • वर्कस्पेस का डिफ़ॉल्ट ~/.openclaw/workspace होता है (या ~/.openclaw/workspace-<profile> जब OPENCLAW_PROFILE सेट हो)।
  • स्टेट का डिफ़ॉल्ट ~/.openclaw/agents/main/agent होता है।

एजेंट हेल्पर

नया अलग-थलग एजेंट जोड़ने के लिए एजेंट विज़ार्ड का उपयोग करें:
फिर इनबाउंड संदेशों को रूट करने के लिए bindings जोड़ें (या विज़ार्ड को करने दें)। सत्यापित करें:

कई एजेंट = कई लोग, कई व्यक्तित्व

कई एजेंटों के साथ, प्रत्येक agentId एक पूरी तरह अलग-थलग पर्सोना बन जाता है:
  • अलग फ़ोन नंबर/खाते (प्रति चैनल accountId)।
  • अलग व्यक्तित्व (प्रति-एजेंट वर्कस्पेस फ़ाइलें जैसे AGENTS.md और SOUL.md)।
  • अलग auth + सत्र (स्पष्ट रूप से सक्षम किए बिना कोई क्रॉस‑टॉक नहीं)।
इससे कई लोग एक ही Gateway सर्वर साझा कर सकते हैं, जबकि उनके AI “ब्रेन” और डेटा अलग-थलग रहते हैं।

एक WhatsApp नंबर, कई लोग (DM विभाजन)

You can route different WhatsApp DMs to different agents while staying on one WhatsApp account. Match on sender E.164 (like +15551234567) with peer.kind: "direct". Replies still come from the same WhatsApp number (no per‑agent sender identity). महत्वपूर्ण विवरण: डायरेक्ट चैट एजेंट की मुख्य सत्र कुंजी में सिमट जाती हैं, इसलिए वास्तविक अलगाव के लिए प्रति व्यक्ति एक एजेंट आवश्यक है। उदाहरण:
नोट्स:
  • DM प्रवेश नियंत्रण प्रति WhatsApp खाता वैश्विक होता है (पेयरिंग/अलाउलिस्ट), प्रति एजेंट नहीं।
  • साझा समूहों के लिए, समूह को एक एजेंट से बाँधें या Broadcast groups का उपयोग करें।

रूटिंग नियम (संदेश किसी एजेंट को कैसे चुनते हैं)

बाइंडिंग्स निर्धारित होती हैं और सबसे विशिष्ट नियम जीतता है:
  1. peer मिलान (सटीक DM/समूह/चैनल आईडी)
  2. parentPeer मिलान (थ्रेड इनहेरिटेंस)
  3. guildId + roles (Discord रोल रूटिंग)
  4. guildId (Discord)
  5. teamId (Slack)
  6. डिफ़ॉल्ट एजेंट पर फ़ॉलबैक (agents.list[].default, अन्यथा सूची की पहली प्रविष्टि, डिफ़ॉल्ट: main)
  7. चैनल-स्तरीय मिलान (accountId: "*")
  8. डिफ़ॉल्ट एजेंट पर फ़ॉलबैक (agents.list[].default, अन्यथा सूची की पहली प्रविष्टि, डिफ़ॉल्ट: main)
यदि कोई binding कई match फ़ील्ड सेट करती है (उदाहरण के लिए peer + guildId), तो सभी निर्दिष्ट फ़ील्ड आवश्यक हैं (AND सेमांटिक्स)।

कई खाते / फ़ोन नंबर

Channels that support multiple accounts (e.g. WhatsApp) use accountId to identify each login. Each accountId can be routed to a different agent, so one server can host multiple phone numbers without mixing sessions.

अवधारणाएँ

  • agentId: एक “ब्रेन” (वर्कस्पेस, प्रति-एजेंट auth, प्रति-एजेंट सत्र स्टोर)।
  • accountId: एक चैनल खाता इंस्टेंस (जैसे WhatsApp खाता "personal" बनाम "biz")।
  • binding: (channel, accountId, peer) और वैकल्पिक रूप से guild/team IDs के आधार पर इनबाउंड संदेशों को किसी agentId तक रूट करता है।
  • डायरेक्ट चैट agent:<agentId>:<mainKey> में सिमट जाती हैं (प्रति‑एजेंट “मुख्य”; session.mainKey)।

उदाहरण: दो WhatsApp → दो एजेंट

~/.openclaw/openclaw.json (JSON5):

उदाहरण: WhatsApp दैनिक चैट + Telegram गहन कार्य

चैनल के आधार पर विभाजन: WhatsApp को तेज़ दैनिक एजेंट पर और Telegram को Opus एजेंट पर रूट करें।
नोट्स:
  • यदि किसी चैनल के लिए आपके पास कई खाते हैं, तो बाइंडिंग में accountId जोड़ें (उदाहरण के लिए { channel: "whatsapp", accountId: "personal" })।
  • बाकी को चैट पर रखते हुए किसी एक DM/समूह को Opus पर रूट करने के लिए, उस पीयर के लिए match.peer बाइंडिंग जोड़ें; पीयर मिलान हमेशा चैनल‑व्यापी नियमों से जीतता है।

उदाहरण: वही चैनल, एक पीयर Opus पर

WhatsApp को तेज़ एजेंट पर रखें, लेकिन एक DM को Opus पर रूट करें:
पीयर बाइंडिंग्स हमेशा जीतती हैं, इसलिए उन्हें चैनल‑व्यापी नियम से ऊपर रखें।

WhatsApp समूह से बँधा पारिवारिक एजेंट

एक समर्पित पारिवारिक एजेंट को एक ही WhatsApp समूह से बाँधें, मेंशन गेटिंग और कड़े टूल नीति के साथ:
नोट्स:
  • Tool allow/deny lists are tools, not skills. If a skill needs to run a binary, ensure exec is allowed and the binary exists in the sandbox.
  • अधिक कड़े गेटिंग के लिए, agents.list[].groupChat.mentionPatterns सेट करें और चैनल के लिए समूह अलाउलिस्ट सक्षम रखें।

प्रति‑एजेंट Sandbox और टूल विन्यास

v2026.1.6 से शुरू होकर, प्रत्येक एजेंट का अपना sandbox और टूल प्रतिबंध हो सकता है:
Note: setupCommand lives under sandbox.docker and runs once on container creation. Per-agent sandbox.docker.* overrides are ignored when the resolved scope is "shared". लाभ:
  • सुरक्षा अलगाव: अविश्वसनीय एजेंटों के लिए टूल्स सीमित करें
  • संसाधन नियंत्रण: कुछ एजेंटों को sandbox करें जबकि अन्य को होस्ट पर रखें
  • लचीली नीतियाँ: प्रति एजेंट अलग अनुमतियाँ
Note: tools.elevated is global and sender-based; it is not configurable per agent. If you need per-agent boundaries, use agents.list[].tools to deny exec. For group targeting, use agents.list[].groupChat.mentionPatterns so @mentions map cleanly to the intended agent. विस्तृत उदाहरणों के लिए Multi-Agent Sandbox & Tools देखें।