Docs > Agents
Shared agents
# Shared agents A shared agent is one canonical agent definition that many teammates run—**each as themselves, with their own connected accounts and Access Scope**. Shared agents live once under `workspace/agents/<id>/` in [Factory](/factory/). Teammates join by creating a lightweight link under `users/<you>/shared-agents/<id>/AGENT.md` rather than copying files. When an editor updates the agent's instructions, requirements, or schedule, every active member runs the new version on their next run. :::note Sharing an agent never shares OAuth tokens, private messages, or personal memory. Every member run executes strictly under that member's own credentials and Access Scope. ::: ## When to use a shared agent Use a shared agent when several people need the same recurring workflow over their own accounts—for example: - **Personal commitments or follow-up trackers** that scan each person's own Gmail and Slack and surface individual drafts. - **Account or CRM hygiene** where each rep proposes updates from their own customer threads while a sales lead reviews cards in one shared Slack channel. - **Team-wide rollups and digests** where a **coordinator** invokes each member's run and combines the results into one deduplicated summary. Keep an agent personal if only one person will run it or if it depends on private event-webhook triggers (event triggers are supported on personal agents only). ## Files that make up a shared agent ```text workspace/agents/<agent-id>/ AGENT.md # mode: shared, requires, approval/autoMode policy, member instructions TEAM.md # Optional: frontmatter `setup` guide + optional coordinator body team/ # Optional: live shared notes (rosters, ownership, logs) read at HEAD automations/<id>.md # Scheduled (cron/datetime) or manual trigger + per-run task skills/<slug>/SKILL.md # Optional: skills scoped only to this shared agent users/<user>/shared-agents/<agent-id>/ AGENT.md # Member link (mode: linked, enabled: true|false, source) notes.md # Optional personal working notes (isolated to this member) automations/<slug>.md # Optional personal schedule running this shared agent for you only ``` ### What stays shared vs. what stays per-user | Layer | Shared across all members | Isolated per member | | --- | --- | --- | | **Definition** | `AGENT.md`, `TEAM.md`, `automations/*.md`, agent-scoped skills (pinned to the commit SHA of each dispatch) | Personal working notes beside the link file, optional personal automations | | **Team notes** | `workspace/agents/<id>/team/` (read and written at `HEAD`, never frozen to an old bundle) | Personal `memory/` and `knowledge/` files | | **Credentials & access** | None—shared agents never store shared OAuth tokens | Member's connected integrations and `access_scope_id` (or Default = all connected apps) | | **Runs & approvals** | Parent dispatch run and aggregated result; shared Slack approval channel if configured | Each child run's transcript (`chat_id`), execution billing attribution, and `pending_actions` (visible to admins unless `pendingActionVisibility: self`) | ## Execution modes: fan-out vs. coordinator A shared agent runs in **fan-out mode** by default. Adding a Markdown body to `TEAM.md` switches scheduled triggers and admin `Run now` dispatches into **coordinator mode**. ```mermaid flowchart TB Trigger["Schedule or Admin 'Run now'"] --> Check{"TEAM.md has<br/>coordinator body?"} Check -->|No: Fan-out mode| Fanout["Dispatch 1 child run<br/>per active member"] Fanout --> M1["Member A run<br/>(A's OAuth & Scope)"] Fanout --> M2["Member B run<br/>(B's OAuth & Scope)"] Fanout --> M3["Member C<br/>(skipped if unmet requires)"] M1 --> Parent1["Parent run aggregates<br/>per-member results"] M2 --> Parent1 M3 --> Parent1 Check -->|Yes: Coordinator mode| Coord["1 Coordinator run<br/>(runs as Admin coordinator<br/>with coordinator's Scope)"] Coord -->|"agent(prompt, { agent, user })"| CM1["Member A child run<br/>(A's OAuth & Scope)"] Coord -->|"agent(prompt, { agent, user })"| CM2["Member B child run<br/>(B's OAuth & Scope)"] CM1 --> Parent2["Single deduplicated<br/>team output"] CM2 --> Parent2 ``` ### Fan-out mode (default) When `TEAM.md` is absent—or contains only frontmatter `setup` with an empty body—each scheduled trigger or admin `Run now` creates one parent run and dispatches one child run per joined, enabled member: - Active members whose `requires` are satisfied run in isolation as themselves. - Members missing a required app or tool are recorded as `skipped` child runs with the exact unmet requirement. - The parent run tracks overall status (`running`, `needs_action`, `succeeded`, `failed`, or `skipped`) once child runs settle. ### Coordinator mode (`TEAM.md` body) Add coordinator instructions in the Markdown body of `TEAM.md` when results must be combined, deduplicated, ranked, or routed across teammates: ```markdown title="workspace/agents/<agent-id>/TEAM.md" --- schemaVersion: 1 setup: | Ask the teammate which accounts or channels they own and record their assignment in team/roster.md. --- Run the weekly renewal check for each active member using a Dex workflow that calls `agent(prompt, { agent, user })`. Deduplicate overlapping customer mentions across reps, verify proposed CRM cards, and post one combined digest of at-risk renewals. ``` How coordinator mode executes: 1. **Explicit coordinator runner.** An agent Admin assigns themselves as the coordinator runner with one of their own Access Scopes (`dex agents coordinator <id> --scope <scope-id>`). If `TEAM.md` has a body but no runner is set, triggers fail visibly with `coordinator_unset`—Dex never silently falls back to fan-out. 2. **Delegation via workflows.** The coordinator receives the `TEAM.md` instructions, the automation task (labeled as each member's task), the agent ID, and the list of active members. It orchestrates members from a Dex workflow (`@dex/sdk/workflows`, executed via `dex workflows run`) calling `agent(prompt, { agent, user })`. 3. **Member isolation preserved.** Each `agent(...)` call launches a real child run executing **as that member** with their credentials, Access Scope, link folder, and approvals, returning `{ runId, status, text }`. A member can be called more than once in a run. 4. **Card coordination.** When `pendingActionVisibility` is `admins` (the default), the coordinator can inspect, edit, or withdraw pending action cards across the agent (`pending_actions_list`) before humans approve them. Approving always remains with people and executes under the card owner's credentials. 5. **Individual runs still work.** A member clicking **Run now** for themselves still executes only their own run, not the coordinator. ## Membership lifecycle and states Every teammate's participation in a shared agent is in one of three computed states: | State | Meaning | What happens on trigger | | --- | --- | --- | | **`off`** | Not joined, member switched off (`enabled: false`), or Admin-paused (`status: inactive`) | Not dispatched | | **`needs_setup`** | Joined and not Admin-paused, but their Access Scope is disabled/missing or one or more `requires` apps/tools are unmet | Recorded as `skipped` with unmet requirement details | | **`on`** | Joined, active, `enabled: true`, and every entry in `requires` is connected and allowed by their Access Scope | Dispatched normally | ### Onboarding a teammate 1. **Join:** `dex agents join <id>` (or clicking **Set up** on the shared agent page) writes the member's link file starting `enabled: false`. 2. **Run setup:** If `TEAM.md` defines `setup`, Dex walks the teammate through those questions in plain language, checks `team/` for overlap with other members, and commits their answers to `team/`. 3. **Turn on:** `dex agents on <id>` checks `requires` against the member's Access Scope (or all connected apps if no Scope is bound). If apps are missing, Dex lists them and prompts the teammate to connect them. 4. **Turn off or leave:** `dex agents off <id>` pauses runs while preserving setup; `dex agents leave <id>` removes the link (clear any personal entries in `team/` first, since leaving ends write access to `team/`). ### Admin pause vs. member toggle An agent Admin can pause or resume any member independently of the member's own `enabled` switch. Admin pause is stored in Postgres (`agent_members.status = 'inactive'`), is never overwritten by Factory pushes, and can only be lifted by an Admin. Paused members can still approve or reject open pending action cards from earlier runs. ## Roles and permissions Access to a shared agent comes directly from its Factory path grants (`factory_shares` on `workspace/agents/<id>/`): | Action | Member (`read`) | Editor (`write`) | Admin (`admin`) | | --- | --- | --- | --- | | View agent files, join, leave, toggle own `on`/`off`, set own Scope | Yes | Yes | Yes | | Read and write `team/` notes while an active member | Yes | Yes | Yes | | Trigger a manual run for **yourself only** | Yes | Yes | Yes | | Edit `AGENT.md`, `TEAM.md`, `automations/*.md`, and agent skills | No | Yes | Yes | | Share the agent and manage roles (`dex agents share`) | No | No | Yes | | View full member list and pause/resume members | No | No | Yes | | Set or clear the coordinator runner (`dex agents coordinator`) | No | No | Yes | | Trigger a full team fan-out or coordinator `Run now` | No | No | Yes | | Review and approve/reject other members' pending actions (when `pendingActionVisibility: admins`) | No | No | Yes | ## Shared approvals and Slack channels By default (`pendingActionVisibility: admins`), agent Admins can see and act on pending action cards produced by any member's run, while members see only their own cards. Set `pendingActionVisibility: self` in `AGENT.md` when cards contain sensitive personal actions that only the member themselves should see. Admins can also configure a **shared approval Slack channel** (`approval_slack_channel`) on a shared agent. When set, member cards route to that Slack channel instead of individual DMs so the card owner or an Admin can review, edit, approve, or reject in one place. :::caution When an Admin approves a teammate's pending action card, the external tool executes under the **teammate's (card owner's)** credentials and Access Scope—never the approving Admin's. ::: ## Creating and sharing an agent with the CLI ```bash # 1. Create the shared agent and initial schedule (runs for nobody until members turn it on) dex agents create \ --title "Weekly deal hygiene" \ --schedule "0 9 * * 1" \ --timezone "America/New_York" \ --task "Review open deals updated in the last 7 days and propose stage updates." # 2. Pull Factory, edit workspace/agents/<id>/AGENT.md (add requires, instructions) and optional TEAM.md dex factory pull dex factory add factories/*/workspace/agents/<id> dex factory commit -m "Configure deal hygiene shared agent" dex factory preview dex factory push # 3. Share with teammates (read = member, write = editor) dex agents share <id> sam@acme.com --role read dex agents share <id> priya@acme.com --role write # 4. If TEAM.md has coordinator instructions, set the coordinator runner and Scope dex agents coordinator <id> --scope <scope-id> ``` ## Related pages - [Working with agents](/agents/working-with-agents/) - `AGENT.md` fields, harnesses, and `requires` - [Tools, scopes, and approvals](/agents/tools-and-approvals/) - Access Scopes, Pending Actions, and Auto Mode - [Permissions, spaces, and sharing](/factory/sharing-and-installation/) - Factory ACLs, Spaces, and link adoption - [Factory definition as code](/factory/workspace-structure/) - Complete `AGENT.md` and `TEAM.md` schemas - [CLI and SDK](/integrations/cli-and-sdk/) - Full `dex agents` and `dex workflows` command referenceBuild one canonical workspace agent that teammates join via links and run under their own credentials and Access Scopes, in fan-out or coordinator mode.
A shared agent is one canonical agent definition that many teammates run—each as themselves, with their own connected accounts and Access Scope.
Shared agents live once under workspace/agents/<id>/ in Factory. Teammates join by creating a lightweight link under users/<you>/shared-agents/<id>/AGENT.md rather than copying files. When an editor updates the agent’s instructions, requirements, or schedule, every active member runs the new version on their next run.
When to use a shared agent
Section titled “When to use a shared agent”Use a shared agent when several people need the same recurring workflow over their own accounts—for example:
- Personal commitments or follow-up trackers that scan each person’s own Gmail and Slack and surface individual drafts.
- Account or CRM hygiene where each rep proposes updates from their own customer threads while a sales lead reviews cards in one shared Slack channel.
- Team-wide rollups and digests where a coordinator invokes each member’s run and combines the results into one deduplicated summary.
Keep an agent personal if only one person will run it or if it depends on private event-webhook triggers (event triggers are supported on personal agents only).
Files that make up a shared agent
Section titled “Files that make up a shared agent”workspace/agents/<agent-id>/ AGENT.md # mode: shared, requires, approval/autoMode policy, member instructions TEAM.md # Optional: frontmatter `setup` guide + optional coordinator body team/ # Optional: live shared notes (rosters, ownership, logs) read at HEAD automations/<id>.md # Scheduled (cron/datetime) or manual trigger + per-run task skills/<slug>/SKILL.md # Optional: skills scoped only to this shared agent
users/<user>/shared-agents/<agent-id>/ AGENT.md # Member link (mode: linked, enabled: true|false, source) notes.md # Optional personal working notes (isolated to this member) automations/<slug>.md # Optional personal schedule running this shared agent for you onlyWhat stays shared vs. what stays per-user
Section titled “What stays shared vs. what stays per-user”| Layer | Shared across all members | Isolated per member |
|---|---|---|
| Definition | AGENT.md, TEAM.md, automations/*.md, agent-scoped skills (pinned to the commit SHA of each dispatch) | Personal working notes beside the link file, optional personal automations |
| Team notes | workspace/agents/<id>/team/ (read and written at HEAD, never frozen to an old bundle) | Personal memory/ and knowledge/ files |
| Credentials & access | None—shared agents never store shared OAuth tokens | Member’s connected integrations and access_scope_id (or Default = all connected apps) |
| Runs & approvals | Parent dispatch run and aggregated result; shared Slack approval channel if configured | Each child run’s transcript (chat_id), execution billing attribution, and pending_actions (visible to admins unless pendingActionVisibility: self) |
Execution modes: fan-out vs. coordinator
Section titled “Execution modes: fan-out vs. coordinator”A shared agent runs in fan-out mode by default. Adding a Markdown body to TEAM.md switches scheduled triggers and admin Run now dispatches into coordinator mode.
flowchart TB
Trigger["Schedule or Admin 'Run now'"] --> Check{"TEAM.md has<br/>coordinator body?"}
Check -->|No: Fan-out mode| Fanout["Dispatch 1 child run<br/>per active member"]
Fanout --> M1["Member A run<br/>(A's OAuth & Scope)"]
Fanout --> M2["Member B run<br/>(B's OAuth & Scope)"]
Fanout --> M3["Member C<br/>(skipped if unmet requires)"]
M1 --> Parent1["Parent run aggregates<br/>per-member results"]
M2 --> Parent1
M3 --> Parent1
Check -->|Yes: Coordinator mode| Coord["1 Coordinator run<br/>(runs as Admin coordinator<br/>with coordinator's Scope)"]
Coord -->|"agent(prompt, { agent, user })"| CM1["Member A child run<br/>(A's OAuth & Scope)"]
Coord -->|"agent(prompt, { agent, user })"| CM2["Member B child run<br/>(B's OAuth & Scope)"]
CM1 --> Parent2["Single deduplicated<br/>team output"]
CM2 --> Parent2
Fan-out mode (default)
Section titled “Fan-out mode (default)”When TEAM.md is absent—or contains only frontmatter setup with an empty body—each scheduled trigger or admin Run now creates one parent run and dispatches one child run per joined, enabled member:
- Active members whose
requiresare satisfied run in isolation as themselves. - Members missing a required app or tool are recorded as
skippedchild runs with the exact unmet requirement. - The parent run tracks overall status (
running,needs_action,succeeded,failed, orskipped) once child runs settle.
Coordinator mode (TEAM.md body)
Section titled “Coordinator mode (TEAM.md body)”Add coordinator instructions in the Markdown body of TEAM.md when results must be combined, deduplicated, ranked, or routed across teammates:
---schemaVersion: 1setup: | Ask the teammate which accounts or channels they own and record their assignment in team/roster.md.---
Run the weekly renewal check for each active member using a Dex workflow thatcalls `agent(prompt, { agent, user })`. Deduplicate overlapping customermentions across reps, verify proposed CRM cards, and post one combined digestof at-risk renewals.How coordinator mode executes:
- Explicit coordinator runner. An agent Admin assigns themselves as the coordinator runner with one of their own Access Scopes (
dex agents coordinator <id> --scope <scope-id>). IfTEAM.mdhas a body but no runner is set, triggers fail visibly withcoordinator_unset—Dex never silently falls back to fan-out. - Delegation via workflows. The coordinator receives the
TEAM.mdinstructions, the automation task (labeled as each member’s task), the agent ID, and the list of active members. It orchestrates members from a Dex workflow (@dex/sdk/workflows, executed viadex workflows run) callingagent(prompt, { agent, user }). - Member isolation preserved. Each
agent(...)call launches a real child run executing as that member with their credentials, Access Scope, link folder, and approvals, returning{ runId, status, text }. A member can be called more than once in a run. - Card coordination. When
pendingActionVisibilityisadmins(the default), the coordinator can inspect, edit, or withdraw pending action cards across the agent (pending_actions_list) before humans approve them. Approving always remains with people and executes under the card owner’s credentials. - Individual runs still work. A member clicking Run now for themselves still executes only their own run, not the coordinator.
Membership lifecycle and states
Section titled “Membership lifecycle and states”Every teammate’s participation in a shared agent is in one of three computed states:
| State | Meaning | What happens on trigger |
|---|---|---|
off | Not joined, member switched off (enabled: false), or Admin-paused (status: inactive) | Not dispatched |
needs_setup | Joined and not Admin-paused, but their Access Scope is disabled/missing or one or more requires apps/tools are unmet | Recorded as skipped with unmet requirement details |
on | Joined, active, enabled: true, and every entry in requires is connected and allowed by their Access Scope | Dispatched normally |
Onboarding a teammate
Section titled “Onboarding a teammate”- Join:
dex agents join <id>(or clicking Set up on the shared agent page) writes the member’s link file startingenabled: false. - Run setup: If
TEAM.mddefinessetup, Dex walks the teammate through those questions in plain language, checksteam/for overlap with other members, and commits their answers toteam/. - Turn on:
dex agents on <id>checksrequiresagainst the member’s Access Scope (or all connected apps if no Scope is bound). If apps are missing, Dex lists them and prompts the teammate to connect them. - Turn off or leave:
dex agents off <id>pauses runs while preserving setup;dex agents leave <id>removes the link (clear any personal entries inteam/first, since leaving ends write access toteam/).
Admin pause vs. member toggle
Section titled “Admin pause vs. member toggle”An agent Admin can pause or resume any member independently of the member’s own enabled switch. Admin pause is stored in Postgres (agent_members.status = 'inactive'), is never overwritten by Factory pushes, and can only be lifted by an Admin. Paused members can still approve or reject open pending action cards from earlier runs.
Roles and permissions
Section titled “Roles and permissions”Access to a shared agent comes directly from its Factory path grants (factory_shares on workspace/agents/<id>/):
| Action | Member (read) | Editor (write) | Admin (admin) |
|---|---|---|---|
View agent files, join, leave, toggle own on/off, set own Scope | Yes | Yes | Yes |
Read and write team/ notes while an active member | Yes | Yes | Yes |
| Trigger a manual run for yourself only | Yes | Yes | Yes |
Edit AGENT.md, TEAM.md, automations/*.md, and agent skills | No | Yes | Yes |
Share the agent and manage roles (dex agents share) | No | No | Yes |
| View full member list and pause/resume members | No | No | Yes |
Set or clear the coordinator runner (dex agents coordinator) | No | No | Yes |
Trigger a full team fan-out or coordinator Run now | No | No | Yes |
Review and approve/reject other members’ pending actions (when pendingActionVisibility: admins) | No | No | Yes |
Shared approvals and Slack channels
Section titled “Shared approvals and Slack channels”By default (pendingActionVisibility: admins), agent Admins can see and act on pending action cards produced by any member’s run, while members see only their own cards. Set pendingActionVisibility: self in AGENT.md when cards contain sensitive personal actions that only the member themselves should see.
Admins can also configure a shared approval Slack channel (approval_slack_channel) on a shared agent. When set, member cards route to that Slack channel instead of individual DMs so the card owner or an Admin can review, edit, approve, or reject in one place.
Creating and sharing an agent with the CLI
Section titled “Creating and sharing an agent with the CLI”# 1. Create the shared agent and initial schedule (runs for nobody until members turn it on)dex agents create \ --title "Weekly deal hygiene" \ --schedule "0 9 * * 1" \ --timezone "America/New_York" \ --task "Review open deals updated in the last 7 days and propose stage updates."
# 2. Pull Factory, edit workspace/agents/<id>/AGENT.md (add requires, instructions) and optional TEAM.mddex factory pulldex factory add factories/*/workspace/agents/<id>dex factory commit -m "Configure deal hygiene shared agent"dex factory previewdex factory push
# 3. Share with teammates (read = member, write = editor)dex agents share <id> sam@acme.com --role readdex agents share <id> priya@acme.com --role write
# 4. If TEAM.md has coordinator instructions, set the coordinator runner and Scopedex agents coordinator <id> --scope <scope-id>Related pages
Section titled “Related pages”- Working with agents -
AGENT.mdfields, harnesses, andrequires - Tools, scopes, and approvals - Access Scopes, Pending Actions, and Auto Mode
- Permissions, spaces, and sharing - Factory ACLs, Spaces, and link adoption
- Factory definition as code - Complete
AGENT.mdandTEAM.mdschemas - CLI and SDK - Full
dex agentsanddex workflowscommand reference