Practice guide: AGENTS.md operating-rules templates and examples
operating rules say how to do it — steps, tool constraints, date math. Edit on the Operating rules page (maps to AGENTS.md). Persona and tone belong on the Persona page.
Source help/en/guides/agents-md-templates.md
In user language: operating rules say how to do it — steps, tool constraints, date math. Edit on the Operating rules page (maps to AGENTS.md). Persona and tone belong on the Persona page.
Each round the platform injects current time and time zone; whether you use it to parse “last N days”, and how you call APIs, is written here.
Template 1: relative dates + skill APIs (CRM / reports)
## Dates and ranges
- Treat **current time** in [Runtime environment] as “today”; time zone matches the injected line.
- User says **“last N days”**: **N calendar days including today**.
- end_date = today (YYYY-MM-DD)
- begin_date = today minus N−1 days (YYYY-MM-DD)
- When the user gives explicit start and end dates, use those; do not apply “last N days”.
- Example dates in a skill body are **format only**, never a live query range.
## Query steps
1. Compute begin_date / end_date from above (skip if the user already gave them).
2. Open **skill notes** related to this workspace and follow their steps with `http_request`.
3. Explain results to the user **only from** JSON the tool returned; if the call did not succeed, do not claim you found data.
4. Give the date range and conclusion in short natural language.
## When information is missing
- N is unknown, or a required API field is missing: ask first; do not invent dates or data.
- This workspace has not enabled network requests: say an admin must enable it, and ask the user for concrete dates or exported material.
Template 2: only APIs in skills (no inventing)
Matches the deep example in Where to put your rules; you can paste:
## Network and APIs
- **Do not** invent URLs, paths, or request-body field names.
- When you need a business API: **first** read the **skill** body related to this task, and only use what it declares:
- Base URL / path and method
- Required and optional parameters
- Auth placeholders (e.g. `{{CRM-credential}}`)
- Use `http_request`; state results **only from** returned JSON.
- No matching skill, call failed, or insufficient permission: say so honestly, **do not** invent a successful result.
## On failure
1. Tell the user the failure type (no skill / network / 4xx / 5xx).
2. If the skill requires retry or different parameters, follow the skill; otherwise ask the user for more info or to contact an admin.
Template 3: multi-step task list (no network)
## General steps
1. Restate the user’s goal; confirm missing information.
2. If you need a team metric, retrieve the **workspace knowledge base** or **agent knowledge base** first.
3. Before output, self-check: is it executable step by step; did you cite files or data that were never provided.
## Forbidden
- Skipping constraints the user confirmed.
- Treating fictional company names in sample docs as real customers.
Template 4: memory vs knowledge order
## Information-source priority
1. This round’s tool returns and skill steps
2. Clear metrics in the workspace / agent **knowledge base**
3. **Operating rules** (this document)
4. Personal preferences in **long-term memory** (must not conflict with 1 and 2)
5. Model common knowledge (only when none of the above covers it and the user allows inference, and mark “inferred”)
If memory conflicts with the knowledge base, the **knowledge base** wins, and tell the user to update stale memory.
Template 5: auto-repair when script execution fails (Excel / Office)
Fits agents with script execution enabled that need run_script to produce xlsx/docx. Paste onto the Operating rules page.
## Script execution and Excel output
- **Three tool layers**: skill_update only changes Markdown; skill_script_read / skill_script_write change scripts/*.py; run_script runs the script.
- run_script parameters come in via the input object; the script reads global input and output_dir; products must write to output_dir to appear in output_files.
- run_script failed: read error_code; python_not_found → backend Python needed; missing_packages → pip mirror or requirements.txt.
- ok:true but output_files empty: skill_script_read whether the script uses output_dir; do not claim success.
- Improve flow: skill_script_read → skill_script_write → skill_update (## Script execution) → run_script verify (at most 2 rounds on the same task).
- May auto: adjust input, retry, skill_script_write, CSV fallback; must ask the user first: install system software, change PATH, non-allow-list pip packages.
Web fill shortcut
The Operating rules page has Fill date-query example, a simplified template 1; rewrite for the business then save.
Related docs
- Agent operating rules — product-feature intro
- How to write workspace skills — APIs in the skill body
- SOUL templates
- File map