azure-functions-agents-runtime
AGENTS.md13 starsChanged 36 days agoMITView on GitHub
Operating guide for AI coding agents (and humans) working in azure-functions-agents-runtime. Read this first. It defines how we make changes so features stay aligned with the architecture and each other. - What this project is: a markdown-first programming model that turns an agent project (*.agent.md + config) into an azure.functions.FunctionApp, powered by the Microsoft Agent Framework (MAF). - Design source of truth: docs/architecture.md. This file governs process; that file governs design. Keep both in sync. Every change starts with triage…
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository16 other files it gives its agents.
- add-featureSkill
- update-schema-docsSkill
- azure-resourcesSkill
- actionable-pr-reportSkill
- pr-status-analysisSkill
- data-driven-workflowsSkill
- glossarySkill
- style-guideSkill
- api-guideSkill
- guide-childSkill
- guide-parentSkill
- excludedSkill
- too-deepSkill
- groupedSkill
- childSkill
- parentSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Every change starts with triage + a dedicated worktree: Never commit feature work directly on main.
- Distinctive: line 36
Run these phases in order.
- Very specific: line 73
Remove the worktree after the PR merges: git worktree remove <path>.
- Distinctive: line 177
pipeline stages: must stay accurate. Update it in the same PR as behavior changes (lifecycle phase 5).
- Very specific: line 184
examples and patterns: When schema.py changes, use the update-schema-docs skill (.github/skills/update-schema-docs/SKILL.md) to generate …
- Very specific: line 203
Run python eng/scripts/generate_config_reference.py → regenerates reference
- Very specific: line 204
Use the update-schema-docs skill → adds examples to spec, reviews architecture, and syncs docs/index.md / docs/getting-started.md when the …
- Distinctive: line 208
Commit all doc updates together with implementation
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Operating guide for AI coding agents (and humans) working in
azure-functions-agents-runtime. Read this first. It defines how we make
changes so features stay aligned with the architecture and each other.
- What this project is: a markdown-first programming model that turns an
agent project (
*.agent.md+ config) into anazure.functions.FunctionApp, powered by the Microsoft Agent Framework (MAF). - Design source of truth:
docs/architecture.md. This file governs process; that file governs design. Keep both in sync.
0. Golden rule
Every change starts with triage + a dedicated worktree. Never commit feature
work directly on main. Classify the change, size it, then follow the matching
lane below. When in doubt about scope or design, stop and ask.
1. Feature development lifecycle
Classify the change first, then pick a lane:
| Scope | Examples | Lane |
| nit | typo, comment, formatting, trivial rename | Worktree → implement → gate → PR |
| bug | incorrect behavior, regression | Worktree → (repro test first) → fix → gate → PR |
| small feature | self-contained, single module, no new public surface | Worktree → short design note in PR → implement → test → docs → gate → PR |
| medium+ feature | new public surface, cross-module, new authoring format or discovery behavior | Full FRD pipeline (below) |
The medium+ pipeline (phases)
Run these phases in order. Each has an exit gate; do not advance until it is met.
| Phase | What happens | Exit gate |
| 0 · Triage + Worktree | Agree scope; create the worktree (§2). | Scope + lane agreed |
| 1 · FRD | Write a Feature Requirements Document (§4): problem, goals/non-goals, proposed design, Decisions log, test plan, docs impact. | FRD drafted |
| 2 · Architecture review (planning mode) | Review the FRD for completeness and alignment with the module map in docs/architecture.md. Iterate. | Human sign-off recorded in the Decisions log → status Finalized |
| 3 · Implementation | Implement product changes only, per the finalized FRD. Keep diffs surgical. | ruff + mypy clean |
| 4 · Testing | Design/extend coverage for the new behavior; add tests under tests/. | Full gate green (§3) |
| 5 · Docs | Update docs/architecture.md (module map / pipeline), docs/front-matter-spec.md, docs/triggers.md, and README.md as relevant. For schema changes: run eng/scripts/generate_config_reference.py then use the update-schema-docs skill to sync examples. | Docs reflect reality; DoD met (§6) |
Phases 2 and 4 are explicit review checkpoints. Treat them as separate passes (ideally a dedicated review sub-agent): an architecture review that judges the FRD, and a testing review that judges coverage. Do not let the author's implementation context bias the review.
Tooling: the
add-featureworkflow skill (.github/skills/add-feature/SKILL.md) automates phases 1–5, and FRDs use the template atdocs/frds/_template.md. When told to "use the add-feature skill," follow that playbook; §4 below is the FRD outline.
2. Worktree convention
One worktree per change, branched off main:
git worktree add \
../copilot-worktrees/azure-functions-agents-runtime/<user>-<slug> \
-b <user>/<slug> main- Branch:
<user>/<slug>(e.g.vrdmr/agents-folder-indexing). - Directory: mirrors the branch under
copilot-worktrees/azure-functions-agents-runtime/. - Remove the worktree after the PR merges:
git worktree remove <path>.
3. Canonical commands (the gate)
These mirror CI's lint/type-check/test steps (eng/templates/jobs/ci-tests.yml; Python 3.13 and
3.14). All three must pass before a PR is ready. The --cov-report=xml flag
is what CI runs; drop it (or use the fast loop below) for everyday local runs.
# One-time setup (editable install with dev extras)
python -m pip install --upgrade pip
python -m pip install -U -e .[dev]
# Lint
python -m ruff check src tests
# Type-check (strict)
python -m mypy src
# Test (with coverage, matching CI exactly)
python -m pytest --cache-clear --cov=./src/azure_functions_agents --cov-report=xml --cov-branch tests
# Fast local test loop
python -m pytest tests -q
samples/is intentionally excluded fromruffandmypy.tests/is linted but excluded from strictmypy.
4. FRD: Feature Requirements Document
Required for medium+ features. Location: committed to the repo at
docs/frds/<NNNN>-<slug>.md (zero-padded sequence, e.g.
docs/frds/0001-agents-folder-indexing.md) — treated like a lightweight ADR so
the Decisions log is durable history. Start from
docs/frds/_template.md; see
docs/frds/README.md for numbering. FRDs describe
intended feature behavior and acceptance, never delivery discussion, PR/slice
scope, sequencing, ownership, schedule, or rollout plans. Keep those in PR
descriptions or a separate delivery plan. Recommended sections:
- Summary — one paragraph: what and why.
- Motivation / problem — the pain today (e.g. AgentApps with many agents).
- Goals / Non-goals — explicit scope boundaries.
- Proposed design — modules touched, mapped to the
docs/architecture.mdstages (discover → translate → register → execute). Decisions log — append-only feature-contract choices; record who decided, not delivery decisions:
# Decision Options considered Choice Decided by Date 1 … A / B / C B Human / Agent … - Test plan — new/changed tests; fixtures under
tests/fixtures/config_scenarios/when config behavior changes. - Docs impact — which
docs/*andREADME.mdsections change. - Status —
Draft→In review→Finalized.
5. Code conventions
Grounded in pyproject.toml and current code:
- Python ≥ 3.13. Strict typing everywhere in
src/(mypy --strict,pydantic.mypyplugin). - Type aliases use PEP 695:
type Foo = Bar(notFoo: TypeAlias = Bar); ruffUP040enforces this. Seesrc/azure_functions_agents/discovery/mcp.py. - Ruff rules:
E,F,I,B,UP,SIM,RUF,N; line-length 100 (E501ignored). Imports sorted via ruff isort; first-party =azure_functions_agents. - Pydantic v2 for all config models (
config/schema.py). When a field + validator is shared across provider/sub-models, declare it once on the common base class rather than duplicating per subclass. - MAF remains the default production runtime. The only migration exception is the
internal, app-level
AZURE_FUNCTIONS_AGENTS_ENABLE_COPILOTpreview (sample and limits). Keep harness dispatch behind that once-per-app boundary; no per-agent selectors, mixed-harness roles, or automatic fallback. The legacyruntime:frontmatter field stays ignored (one-time warning). - Logging goes through the shared
azure_functions_agents._logger.logger. - Respect the pipeline boundaries (architecture.md §2): discovery is
read-only; registration is the only Azure-aware stage; the runner executes
lazily. Don't re-parse YAML/front matter in registration — trust
ResolvedAgent/AgentCapabilities.
6. Testing conventions
- Tests live in
tests/and mirror source modules (tests/test_<module>.py).tests/conftest.pyputssrc/onsys.path. - Config/authoring behavior is covered by scenario fixtures under
tests/fixtures/config_scenarios/. Add a new scenario folder when you change how*.agent.md,agents.config.yaml,mcp.json,skills/, ortools/are interpreted. - For bug fixes, add a failing regression test first, then fix.
7. Documentation conventions
docs/architecture.mdis the design source of truth — its module map and pipeline stages must stay accurate. Update it in the same PR as behavior changes (lifecycle phase 5).docs/front-matter-reference.mdis auto-generated fromsrc/azure_functions_agents/config/schema.pyviaeng/scripts/generate_config_reference.py. Never edit manually. Pre-commit hooks regenerate it when schema.py changes; CI validates it stays current.docs/front-matter-spec.mddocuments the.agent.mdauthoring format with examples and patterns. When schema.py changes, use theupdate-schema-docsskill (.github/skills/update-schema-docs/SKILL.md) to generate usage examples for new fields and sync with the reference.docs/triggers.mddocuments trigger types. Update when trigger surface changes.README.mdis the user-facing quickstart — update examples when public behavior changes.- The published GitHub Pages docs site
is built from
docs/with MkDocs (mkdocs.yml,.github/workflows/docs.yml).docs/index.md(landing/feature bullets) anddocs/getting-started.md(quickstart walkthrough) are the site's onboarding pages and duplicate parts ofREADME.md— theupdate-schema-docsskill also keeps these in sync when a schema change adds a new user-facing capability. Preview locally withmkdocs serve; seeCONTRIBUTING.md.
Schema change workflow
When modifying src/azure_functions_agents/config/schema.py:
- Make schema changes (new fields, models, validators)
- Run
python eng/scripts/generate_config_reference.py→ regenerates reference - Use the
update-schema-docsskill → adds examples to spec, reviews architecture, and syncsdocs/index.md/docs/getting-started.mdwhen the change is user-facing - Human review of architectural concerns and PR checklist
- Commit all doc updates together with implementation
8. Definition of Done
- Change made in a dedicated worktree off
main. - (medium+) FRD finalized with a completed Decisions log.
ruff,mypy, andpytestall green locally (§3).- New behavior is tested (regression test for bugs).
docs/architecture.md+ relevantdocs/*/README.mdupdated.- (schema changes)
front-matter-reference.mdregenerated +update-schema-docsskill run. - Diff is surgical — no unrelated changes.
- Worktree removed after merge.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

