Docs > Agents
Working with agents
# Working with agents Whether you work with Dex interactively in chat or through a saved `AGENT.md` in Factory, reliable results come from clear boundaries: what sources to check first, what output format to produce, and which external writes require human review. ## Configuring an agent (`AGENT.md`) A saved agent is defined by `AGENT.md` in your personal directory (`users/<you>/agents/<slug>/AGENT.md`) or in the shared workspace (`workspace/agents/<id>/AGENT.md`): ```markdown title="agents/deal-hygiene/AGENT.md" --- schemaVersion: 1 title: Deal hygiene harness: dex model: inherit requireWriteApproval: true requires: - slack - gmail - attio: - update_record --- Check open opportunities against recent Slack threads and Gmail conversations. Compare each deal's stage, next step, and close date against actual customer messages from the past 7 days. Never invent dates or commitments. Cite the Slack permalink or email thread behind every proposed CRM update. ``` | Field | Default | Purpose | | --- | --- | --- | | `title` | Folder slug | Human-readable display name shown in the UI and CLI | | `harness` | `dex` | Execution runtime: `dex`, `claude`, or `codex` | | `model` | `inherit` | Model identifier, or `inherit` to use the harness default | | `requireWriteApproval` | `true` | Routes external integration writes to durable [Pending Action](/agents/tools-and-approvals/#2-durable-pending-actions-for-automations-and-proposals) cards | | `autoMode` | Omitted | Optional automated write reviewer (`true` or a plain-language policy). Requires `requireWriteApproval: true` | | `requires` | Omitted | Apps—and optionally specific tools (`app: [tool_a, tool_b]`)—required before a run can execute | | `mode` | Omitted | Set to `shared` for workspace-owned [shared agents](/agents/shared-agents/) | | `pendingActionVisibility` | `admins` | Shared agents only: `admins` lets agent admins review member cards; `self` restricts cards to each member | Never restate `title`, `harness`, `model`, `requireWriteApproval`, or `autoMode` inside child `automations/*.md` files—automations always inherit those settings from `AGENT.md`. ## Harnesses Every interactive turn and automation run executes through a durable session runtime that supports three selectable harnesses: | Harness | Execution model | Best for | Notes | | --- | --- | --- | --- | | **`dex`** (default) | Native multi-agent loop (orchestrator + `delegate_subagent`) with deferred tool loading | Day-to-day interactive chat, browser extension sessions, and general automations | Supports incognito sessions and client-side browser/desktop tools in interactive chat | | **`claude`** | Sandboxed Claude harness running in an E2B sandbox | File-heavy authoring, multi-step Factory/Zeta CLI work, and long-running analysis | Persisted durable sessions with direct `/workspace/factory` checkout and `dex` CLI access | | **`codex`** | Sandboxed Codex harness running in an E2B sandbox | Structured scripting, workflow execution, and multi-file edits | Persisted durable sessions with `/workspace/factory` checkout and durable recovery | Leave `model: inherit` unless you have a specific reason to pin a model; inheriting keeps agents aligned with your workspace's default harness configuration. ## Declaring app and tool requirements (`requires`) Use `requires` to declare what an agent cannot run without: - List app names using their canonical catalog identifiers (for example, `slack`, `gmail`, `attio`, `linear`, `notion`). Run `dex scopes catalog` to see exact names. - Name individual tools only when a run truly fails without them (`attio: [update_record]`). - `requires` is a **readiness check, not a permission grant**. If a user has not connected a required app—or excluded it from their Access Scope—Dex flags the agent as needing setup and skips scheduled runs with an explicit reason instead of failing halfway through. ## Writing instructions that hold up Background automation runs start fresh without prior chat history. Follow four rules when writing `AGENT.md` and task prompts: 1. **Name the sources and priority order.** Tell the agent when to check the [knowledge graph](/context/knowledge-graph/) (`dex zeta`) first versus calling live Slack/Gmail tools. 2. **Keep personal details out of shared instructions.** For shared agents, never hard-code your own accounts, channel IDs, or territories in `AGENT.md`; collect per-member specifics during `TEAM.md` setup and store them in `team/`. 3. **Separate standing rules from per-run tasks.** Put persona, evidence rules, and safety limits in `AGENT.md`, and put the specific run window or deliverable in `automations/<name>.md`. 4. **Move repeatable procedures into skills.** If a checklist grows past a few paragraphs—or applies to more than one agent—extract it into a [skill](/agents/skills/). Agent-scoped skills under `agents/<slug>/skills/<skill>/SKILL.md` are visible only to that agent and override skills of the same name during its runs. ## Related pages - [Shared agents](/agents/shared-agents/) - Run one agent across a team with per-member credentials or coordinator mode - [Skills](/agents/skills/) - Progressive-disclosure procedures and agent-scoped skills - [Tools, scopes, and approvals](/agents/tools-and-approvals/) - Access Scopes, Pending Actions, and Auto Mode - [Creating automations](/automations/creating-automations/) - Attach schedules, conditions, and triggers to an agent - [Factory definition as code](/factory/workspace-structure/) - Full `AGENT.md` and `automations/*.md` schema referenceConfigure Dex agent instructions, execution harnesses, models, required apps, and approval settings so interactive and background runs stay reliable.
Whether you work with Dex interactively in chat or through a saved AGENT.md in Factory, reliable results come from clear boundaries: what sources to check first, what output format to produce, and which external writes require human review.
Configuring an agent (AGENT.md)
Section titled “Configuring an agent (AGENT.md)”A saved agent is defined by AGENT.md in your personal directory (users/<you>/agents/<slug>/AGENT.md) or in the shared workspace (workspace/agents/<id>/AGENT.md):
---schemaVersion: 1title: Deal hygieneharness: dexmodel: inheritrequireWriteApproval: truerequires: - slack - gmail - attio: - update_record---
Check open opportunities against recent Slack threads and Gmail conversations.Compare each deal's stage, next step, and close date against actual customermessages from the past 7 days.
Never invent dates or commitments. Cite the Slack permalink or email threadbehind every proposed CRM update.| Field | Default | Purpose |
|---|---|---|
title | Folder slug | Human-readable display name shown in the UI and CLI |
harness | dex | Execution runtime: dex, claude, or codex |
model | inherit | Model identifier, or inherit to use the harness default |
requireWriteApproval | true | Routes external integration writes to durable Pending Action cards |
autoMode | Omitted | Optional automated write reviewer (true or a plain-language policy). Requires requireWriteApproval: true |
requires | Omitted | Apps—and optionally specific tools (app: [tool_a, tool_b])—required before a run can execute |
mode | Omitted | Set to shared for workspace-owned shared agents |
pendingActionVisibility | admins | Shared agents only: admins lets agent admins review member cards; self restricts cards to each member |
Never restate title, harness, model, requireWriteApproval, or autoMode inside child automations/*.md files—automations always inherit those settings from AGENT.md.
Harnesses
Section titled “Harnesses”Every interactive turn and automation run executes through a durable session runtime that supports three selectable harnesses:
| Harness | Execution model | Best for | Notes |
|---|---|---|---|
dex (default) | Native multi-agent loop (orchestrator + delegate_subagent) with deferred tool loading | Day-to-day interactive chat, browser extension sessions, and general automations | Supports incognito sessions and client-side browser/desktop tools in interactive chat |
claude | Sandboxed Claude harness running in an E2B sandbox | File-heavy authoring, multi-step Factory/Zeta CLI work, and long-running analysis | Persisted durable sessions with direct /workspace/factory checkout and dex CLI access |
codex | Sandboxed Codex harness running in an E2B sandbox | Structured scripting, workflow execution, and multi-file edits | Persisted durable sessions with /workspace/factory checkout and durable recovery |
Leave model: inherit unless you have a specific reason to pin a model; inheriting keeps agents aligned with your workspace’s default harness configuration.
Declaring app and tool requirements (requires)
Section titled “Declaring app and tool requirements (requires)”Use requires to declare what an agent cannot run without:
- List app names using their canonical catalog identifiers (for example,
slack,gmail,attio,linear,notion). Rundex scopes catalogto see exact names. - Name individual tools only when a run truly fails without them (
attio: [update_record]). requiresis a readiness check, not a permission grant. If a user has not connected a required app—or excluded it from their Access Scope—Dex flags the agent as needing setup and skips scheduled runs with an explicit reason instead of failing halfway through.
Writing instructions that hold up
Section titled “Writing instructions that hold up”Background automation runs start fresh without prior chat history. Follow four rules when writing AGENT.md and task prompts:
- Name the sources and priority order. Tell the agent when to check the knowledge graph (
dex zeta) first versus calling live Slack/Gmail tools. - Keep personal details out of shared instructions. For shared agents, never hard-code your own accounts, channel IDs, or territories in
AGENT.md; collect per-member specifics duringTEAM.mdsetup and store them inteam/. - Separate standing rules from per-run tasks. Put persona, evidence rules, and safety limits in
AGENT.md, and put the specific run window or deliverable inautomations/<name>.md. - Move repeatable procedures into skills. If a checklist grows past a few paragraphs—or applies to more than one agent—extract it into a skill. Agent-scoped skills under
agents/<slug>/skills/<skill>/SKILL.mdare visible only to that agent and override skills of the same name during its runs.
Related pages
Section titled “Related pages”- Shared agents - Run one agent across a team with per-member credentials or coordinator mode
- Skills - Progressive-disclosure procedures and agent-scoped skills
- Tools, scopes, and approvals - Access Scopes, Pending Actions, and Auto Mode
- Creating automations - Attach schedules, conditions, and triggers to an agent
- Factory definition as code - Full
AGENT.mdandautomations/*.mdschema reference