Skip to content
ThirdLayer

Docs > Agents

Shared agents

Build 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.

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).

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
LayerShared across all membersIsolated per member
DefinitionAGENT.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 notesworkspace/agents/<id>/team/ (read and written at HEAD, never frozen to an old bundle)Personal memory/ and knowledge/ files
Credentials & accessNone—shared agents never store shared OAuth tokensMember’s connected integrations and access_scope_id (or Default = all connected apps)
Runs & approvalsParent dispatch run and aggregated result; shared Slack approval channel if configuredEach child run’s transcript (chat_id), execution billing attribution, and pending_actions (visible to admins unless pendingActionVisibility: self)

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

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.

Add coordinator instructions in the Markdown body of TEAM.md when results must be combined, deduplicated, ranked, or routed across teammates:

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.

Every teammate’s participation in a shared agent is in one of three computed states:

StateMeaningWhat happens on trigger
offNot joined, member switched off (enabled: false), or Admin-paused (status: inactive)Not dispatched
needs_setupJoined and not Admin-paused, but their Access Scope is disabled/missing or one or more requires apps/tools are unmetRecorded as skipped with unmet requirement details
onJoined, active, enabled: true, and every entry in requires is connected and allowed by their Access ScopeDispatched normally
  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/).

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.

Access to a shared agent comes directly from its Factory path grants (factory_shares on workspace/agents/<id>/):

ActionMember (read)Editor (write)Admin (admin)
View agent files, join, leave, toggle own on/off, set own ScopeYesYesYes
Read and write team/ notes while an active memberYesYesYes
Trigger a manual run for yourself onlyYesYesYes
Edit AGENT.md, TEAM.md, automations/*.md, and agent skillsNoYesYes
Share the agent and manage roles (dex agents share)NoNoYes
View full member list and pause/resume membersNoNoYes
Set or clear the coordinator runner (dex agents coordinator)NoNoYes
Trigger a full team fan-out or coordinator Run nowNoNoYes
Review and approve/reject other members’ pending actions (when pendingActionVisibility: admins)NoNoYes

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”
Terminal window
# 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>