langchain-azure / langgraph-hosted-agents
AGENTS.md148 starsChanged 3 months agoMITView on GitHub
Applies to this directory and its descendants. Follow the repository and azure-ai instructions, plus those of other SDKs used. Apply these rules to new samples and changed parts of existing samples. - Read the target README and shared README before editing. - Give each sample one clear goal. Use native framework and hosting SDK features; add custom wrappers or host subclasses only when the goal requires them. - Follow responses/NN_name/ or invocations/NN_name/, use an unused number, and add new samples…
- Reads credentials
- 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 35,337 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 repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- libs/azure-ai/AGENTS.mdAGENTS.md
- samples/deepagents-storage-backend/mortgage-processing/AGENTS.mdAGENTS.md
- libs/azure-cosmosdb/.github/copilot-instructions.mdCopilot instructions
- libs/azure-postgresql/.github/copilot-instructions.mdCopilot instructions
- code-reviewSkill
- release-notesSkill
- document-classificationSkill
- mortgage-fact-extractionSkill
- mortgage-underwritingSkill
- packet-intakeSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
15 rules. About 1 is common, 8 are distinctive, and 6 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Read the target README and shared README before editing.
- Very specific: line 12
Follow responses/NN_name/ or invocations/NN_name/, use an unused number, and add new samples to the shared README's index.
- Common: line 19
Keep credentials out of committed files.
- Very specific: line 21
Keep blocking I/O off the async event loop.
- Distinctive: line 23
Use the Responses or Decisions API for model calls by default.
- Very specific: line 25
When calling models through the Responses API, set store=False because LangGraph manages conversation history.
- Distinctive: line 30
Write in plain, concise English.
- Very specific: line 32
Use title case for headings and this section order: What This Sample Demonstrates, How It Works, Running the Agent Host, Interacting with …
- Distinctive: line 35
Add sample-specific subsections as needed.
- Distinctive: line 44
Keep snippets consistent with the code.
- Distinctive: line 53
Document exporter and content-recording defaults.
- Very specific: line 58
When main.py only exports a graph, set azd's startupCommand in azure.yaml to invoke the hosting module with the hosted entrypoint's …
- Very specific: line 62
Use --no-cache-dir for pip installs.
- Distinctive: line 90
When changing telemetry or image builds, check default tracing initialization, dependency-layer order, and bytecode in the resulting image …
- Distinctive: line 92
Keep repository-file checks in the docs/samples suite.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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
Hosted Agent Samples
Applies to this directory and its descendants. Follow the repository and azure-ai instructions, plus those of other SDKs used. Apply these rules to new samples and changed parts of existing samples.
Sample Code
- Read the target README and shared README before editing.
- Give each sample one clear goal. Use native framework and hosting SDK features; add custom wrappers or host subclasses only when the goal requires them.
- Follow
responses/NN_name/orinvocations/NN_name/, use an unused number, and add new samples to the shared README's index. - Include an entrypoint, dependencies,
.env.example, Dockerfile, and deployment configuration for the supported setup path. Keep names and defaults consistent across code, configuration, and documentation. Declare required versions and extras. - Install SDK dependencies from published packages. Do not use local source paths, editable SDK installs, or Git URLs.
- Keep credentials out of committed files. Label simulated tools and data, and preserve input validation, error handling, and resource cleanup.
- Keep blocking I/O off the async event loop; use async SDK calls or
asyncio.to_threadfor necessary synchronous calls. - Use the Responses or Decisions API for model calls by default. Do not use Chat Completions.
- When calling models through the Responses API, set
store=Falsebecause LangGraph manages conversation history.
README
- Write in plain, concise English. Open with what the sample demonstrates, when to use it, and the expected outcome.
- Use title case for headings and this section order:
What This Sample Demonstrates,How It Works,Running the Agent Host,Interacting with the Agent, andDeploying the Agent to Foundry. Add sample-specific subsections as needed. - Explain only what the reader needs for that goal. Omit unrelated topics or link to another sample or document. Link to shared setup, deployment, and tracing instructions instead of repeating them; state sample-specific differences.
- Include required resources, versions, authentication, permissions, and variables, including cloud requirements for local runs. Distinguish developer and agent access.
- Provide runnable client code with commands, inputs, and expected results. A request snippet is enough for a simple call; use a script for stateful flows such as approval/resume, stream reconnection, or artifact downloads.
- Keep snippets consistent with the code. Explain relevant limits, persistence, content exposure, and cleanup beside the affected steps. Keep review history and development plans in the PR description.
Telemetry
- Enable telemetry by default in every sample, locally and when hosted. Include tracing dependencies, initialize instrumentation at startup, and configure export through the shared tracing setup.
- Document exporter and content-recording defaults. Telemetry enablement does not require enabling content capture.
Build and Startup
- When
main.pyonly exports a graph, set azd'sstartupCommandinazure.yamlto invoke the hosting module with the hosted entrypoint's protocol and options.codeConfiguration.entryPointand DockerCMDdo not set the local command. - Install dependencies before copying application code to preserve Docker layer caching.
- Use
--no-cache-dirfor pip installs. Pip generates dependency.pycfiles by default; avoid redundant dependency-widecompileallsteps. - With uv, use
uv sync --compile-bytecodefor dependencies andcompileallfor the standard library and application code at build time, using the runtime interpreter and final paths. Dependency and standard-library compilation is best-effort; application compilation must fail the build on syntax errors and exclude.venv. - Exclude local environments, caches, and secrets from the build context with
.dockerignore.
Example uv Dockerfile fragment, assuming uv is installed:
WORKDIR /app/user_agent
COPY pyproject.toml uv.lock ./
# Install dependencies only; the sample runs directly from source.
RUN uv sync --frozen --no-dev --no-install-project --compile-bytecode
COPY . .
RUN .venv/bin/python -m compileall -q \
$(.venv/bin/python -c "import sysconfig as s; print(s.get_paths()['stdlib'])") || true; \
uv run --no-sync python -m compileall -q -x '[.]venv' .Validation
- For documentation changes, check affected commands, configuration, and links. For runtime or dependency changes, exercise the entrypoint and client flow in a clean environment with the documented versions and extras; test new sample logic.
- For startup changes, verify readiness and that the host stays running.
- When changing telemetry or image builds, check default tracing initialization, dependency-layer order, and bytecode in the resulting image as applicable.
- Keep repository-file checks in the docs/samples suite. Report actual results and distinguish source inspection, offline/mock checks, and live Foundry validation.
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.

