惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
I
InfoQ
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
B
Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
V
Visual Studio Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
docs(feishu): add dynamicAgentCreation and per-user isola...
chengoak · 2026-05-23 · via Recent Commits to openclaw:main

@@ -404,38 +404,186 @@ See [Get group/user IDs](#get-groupuser-ids) for lookup tips.

404404405405

---

406406407+

## Per-user agent isolation (Dynamic Agent Creation)

408+409+

Enable `dynamicAgentCreation` to automatically create **isolated agent instances** for each DM user. Each user gets their own:

410+411+

- Independent workspace directory

412+

- Separate `USER.md` / `SOUL.md` / `MEMORY.md`

413+

- Private conversation history

414+

- Isolated skills and state

415+416+

This is essential for public bots where you want each user to have their own private AI assistant experience.

417+418+

<Note>

419+

**Account limitation**: `dynamicAgentCreation` currently works with the **default Feishu account only**. Named/multi-account setups are not yet fully supported — dynamic bindings are created without `accountId`, so messages to named accounts may still route to `agent:main`. Track progress in [Issue #42837](https://github.com/openclaw/openclaw/issues/42837).

420+

</Note>

421+422+

### Quick setup

423+424+

```json5

425+

{

426+

channels: {

427+

feishu: {

428+

dmPolicy: "open",

429+

allowFrom: ["*"],

430+

dynamicAgentCreation: {

431+

enabled: true,

432+

workspaceTemplate: "~/.openclaw/workspace-{agentId}",

433+

agentDirTemplate: "~/.openclaw/agents/{agentId}/agent",

434+

},

435+

},

436+

},

437+

session: {

438+

// Critical: makes each user's DM their "main session"

439+

// Automatically loads USER.md / SOUL.md / MEMORY.md

440+

// For stronger isolation, use "per-channel-peer" instead

441+

dmScope: "main",

442+

},

443+

}

444+

```

445+446+

### How it works

447+448+

When a new user sends their first DM:

449+450+

1. The channel generates a unique `agentId` = `feishu-{user_open_id}`

451+

2. Creates a new workspace at `workspaceTemplate` path

452+

3. Registers the agent and creates a binding for this user

453+

4. The workspace helper ensures bootstrap files (`AGENTS.md`, `SOUL.md`, `USER.md`, etc.) on first access

454+

5. Routes all future messages from this user to their dedicated agent

455+456+

### Configuration options

457+458+

| Setting | Description | Default |

459+

| -------------------------------------------------------- | ------------------------------------------ | ------------------------------------ |

460+

| `channels.feishu.dynamicAgentCreation.enabled` | Enable automatic per-user agent creation | `false` |

461+

| `channels.feishu.dynamicAgentCreation.workspaceTemplate` | Path template for dynamic agent workspaces | `~/.openclaw/workspace-{agentId}` |

462+

| `channels.feishu.dynamicAgentCreation.agentDirTemplate` | Agent directory name template | `~/.openclaw/agents/{agentId}/agent` |

463+

| `channels.feishu.dynamicAgentCreation.maxAgents` | Maximum number of dynamic agents to create | unlimited |

464+465+

Template variables:

466+467+

- `{agentId}` - the generated agent ID (e.g., `feishu-ou_xxxxxx`)

468+

- `{userId}` - the sender's Feishu open_id (e.g., `ou_xxxxxx`)

469+470+

### Session scope

471+472+

`session.dmScope` controls how direct messages are mapped to agent sessions. This is a **global setting** that affects all channels.

473+474+

| Value | Behavior | Best for |

475+

| -------------------- | --------------------------------------------------------- | ------------------------------------------------------------------ |

476+

| `"main"` | Each user's DM maps to their agent's main session | Single-user bots where you want `USER.md` / `SOUL.md` to auto-load |

477+

| `"per-channel-peer"` | Each (channel + user) combination gets a separate session | Public multi-user bots needing stronger isolation |

478+479+

**Tradeoff**: Using `"main"` enables automatic bootstrap file loading (`USER.md`, `SOUL.md`, `MEMORY.md`), but means all DMs across all channels share the same session key pattern. For public multi-user bots where isolation matters more than bootstrap auto-loading, consider `"per-channel-peer"` and manage bootstrap files manually.

480+481+

<Note>

482+

`"per-account-channel-peer"` is not recommended with `dynamicAgentCreation` because dynamic bindings are created without `accountId`. Use it only with manual bindings.

483+

</Note>

484+485+

```json5

486+

{

487+

session: {

488+

// For single-user personal bots: enables auto bootstrap loading

489+

dmScope: "main",

490+491+

// For public multi-user bots: stronger isolation

492+

// dmScope: "per-channel-peer",

493+

},

494+

}

495+

```

496+497+

### Typical multi-user deployment

498+499+

```json5

500+

{

501+

channels: {

502+

feishu: {

503+

appId: "cli_xxx",

504+

appSecret: "xxx",

505+

dmPolicy: "open",

506+

allowFrom: ["*"],

507+

groupPolicy: "open",

508+

requireMention: true,

509+

dynamicAgentCreation: {

510+

enabled: true,

511+

workspaceTemplate: "~/.openclaw/workspace-{agentId}",

512+

agentDirTemplate: "~/.openclaw/agents/{agentId}/agent",

513+

},

514+

},

515+

},

516+

session: {

517+

// Choose dmScope based on your isolation needs:

518+

// "main" for bootstrap auto-loading, "per-channel-peer" for stronger isolation

519+

dmScope: "main",

520+

},

521+

bindings: [], // Empty - dynamic agents auto-bind

522+

}

523+

```

524+525+

### Verification

526+527+

Check gateway logs to confirm dynamic creation is working:

528+529+

```

530+

feishu: creating dynamic agent "feishu-ou_xxxxxx" for user ou_xxxxxx

531+

workspace: /Users/you/.openclaw/workspace-feishu-ou_xxxxxx

532+

feishu: dynamic agent created, new route: agent:feishu-ou_xxxxxx:main

533+

```

534+535+

List all created workspaces:

536+537+

```bash

538+

ls -la ~/.openclaw/workspace-*

539+

```

540+541+

### Notes

542+543+

- **Workspace isolation**: Each user gets their own workspace directory and agent instance. Users cannot see each other's conversation history or files within the normal messaging flow.

544+

- **Security boundary**: This is a messaging-context isolation mechanism, not a hostile co-tenant security boundary. The agent process and host environment are shared.

545+

- **`bindings` should be empty**: Dynamic agents auto-register their own bindings

546+

- **Upgrade path**: Existing manual bindings continue to work alongside dynamic agents

547+

- **`session.dmScope` is global**: This affects all channels, not just Feishu

548+549+

---

550+407551

## Configuration reference

408552409553

Full configuration: [Gateway configuration](/gateway/configuration)

410554411-

| Setting | Description | Default |

412-

| ------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------- |

413-

| `channels.feishu.enabled` | Enable/disable the channel | `true` |

414-

| `channels.feishu.domain` | API domain (`feishu` or `lark`) | `feishu` |

415-

| `channels.feishu.connectionMode` | Event transport (`websocket` or `webhook`) | `websocket` |

416-

| `channels.feishu.defaultAccount` | Default account for outbound routing | `default` |

417-

| `channels.feishu.verificationToken` | Required for webhook mode | - |

418-

| `channels.feishu.encryptKey` | Required for webhook mode | - |

419-

| `channels.feishu.webhookPath` | Webhook route path | `/feishu/events` |

420-

| `channels.feishu.webhookHost` | Webhook bind host | `127.0.0.1` |

421-

| `channels.feishu.webhookPort` | Webhook bind port | `3000` |

422-

| `channels.feishu.accounts.<id>.appId` | App ID | - |

423-

| `channels.feishu.accounts.<id>.appSecret` | App Secret | - |

424-

| `channels.feishu.accounts.<id>.domain` | Per-account domain override | `feishu` |

425-

| `channels.feishu.accounts.<id>.tts` | Per-account TTS override | `messages.tts` |

426-

| `channels.feishu.dmPolicy` | DM policy | `allowlist` |

427-

| `channels.feishu.allowFrom` | DM allowlist (open_id list) | [BotOwnerId] |

428-

| `channels.feishu.groupPolicy` | Group policy | `allowlist` |

429-

| `channels.feishu.groupAllowFrom` | Group allowlist | - |

430-

| `channels.feishu.requireMention` | Require @mention in groups | `true` |

431-

| `channels.feishu.groups.<chat_id>.requireMention` | Per-group @mention override; explicit IDs also admit the group in allowlist mode | inherited |

432-

| `channels.feishu.groups.<chat_id>.enabled` | Enable/disable a specific group | `true` |

433-

| `channels.feishu.textChunkLimit` | Message chunk size | `2000` |

434-

| `channels.feishu.mediaMaxMb` | Media size limit | `30` |

435-

| `channels.feishu.streaming` | Streaming card output | `true` |

436-

| `channels.feishu.blockStreaming` | Completed-block reply streaming | `false` |

437-

| `channels.feishu.typingIndicator` | Send typing reactions | `true` |

438-

| `channels.feishu.resolveSenderNames` | Resolve sender display names | `true` |

555+

| Setting | Description | Default |

556+

| -------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------ |

557+

| `channels.feishu.enabled` | Enable/disable the channel | `true` |

558+

| `channels.feishu.domain` | API domain (`feishu` or `lark`) | `feishu` |

559+

| `channels.feishu.connectionMode` | Event transport (`websocket` or `webhook`) | `websocket` |

560+

| `channels.feishu.defaultAccount` | Default account for outbound routing | `default` |

561+

| `channels.feishu.verificationToken` | Required for webhook mode | - |

562+

| `channels.feishu.encryptKey` | Required for webhook mode | - |

563+

| `channels.feishu.webhookPath` | Webhook route path | `/feishu/events` |

564+

| `channels.feishu.webhookHost` | Webhook bind host | `127.0.0.1` |

565+

| `channels.feishu.webhookPort` | Webhook bind port | `3000` |

566+

| `channels.feishu.accounts.<id>.appId` | App ID | - |

567+

| `channels.feishu.accounts.<id>.appSecret` | App Secret | - |

568+

| `channels.feishu.accounts.<id>.domain` | Per-account domain override | `feishu` |

569+

| `channels.feishu.accounts.<id>.tts` | Per-account TTS override | `messages.tts` |

570+

| `channels.feishu.dmPolicy` | DM policy | `allowlist` |

571+

| `channels.feishu.allowFrom` | DM allowlist (open_id list) | [BotOwnerId] |

572+

| `channels.feishu.groupPolicy` | Group policy | `allowlist` |

573+

| `channels.feishu.groupAllowFrom` | Group allowlist | - |

574+

| `channels.feishu.requireMention` | Require @mention in groups | `true` |

575+

| `channels.feishu.groups.<chat_id>.requireMention` | Per-group @mention override; explicit IDs also admit the group in allowlist mode | inherited |

576+

| `channels.feishu.groups.<chat_id>.enabled` | Enable/disable a specific group | `true` |

577+

| `channels.feishu.dynamicAgentCreation.enabled` | Enable automatic per-user agent creation | `false` |

578+

| `channels.feishu.dynamicAgentCreation.workspaceTemplate` | Path template for dynamic agent workspaces | `~/.openclaw/workspace-{agentId}` |

579+

| `channels.feishu.dynamicAgentCreation.agentDirTemplate` | Agent directory name template | `~/.openclaw/agents/{agentId}/agent` |

580+

| `channels.feishu.dynamicAgentCreation.maxAgents` | Maximum number of dynamic agents to create | unlimited |

581+

| `channels.feishu.textChunkLimit` | Message chunk size | `2000` |

582+

| `channels.feishu.mediaMaxMb` | Media size limit | `30` |

583+

| `channels.feishu.streaming` | Streaming card output | `true` |

584+

| `channels.feishu.blockStreaming` | Completed-block reply streaming | `false` |

585+

| `channels.feishu.typingIndicator` | Send typing reactions | `true` |

586+

| `channels.feishu.resolveSenderNames` | Resolve sender display names | `true` |

439587440588

---

441589