agentleFS
LangChainKnown publisherlangchain-ai/langchain-azure/samples/hosting/langgraph-hosted-agents/AGENTS.md

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

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
  1. Distinctive:

    Read the target README and shared README before editing.

    line 9
  2. Very specific:

    Follow responses/NN_name/ or invocations/NN_name/, use an unused number, and add new samples to the shared README's index.

    line 12
  3. Common:

    Keep credentials out of committed files.

    line 19
  4. Very specific:

    Keep blocking I/O off the async event loop.

    line 21
  5. Distinctive:

    Use the Responses or Decisions API for model calls by default.

    line 23
  6. Very specific:

    When calling models through the Responses API, set store=False because LangGraph manages conversation history.

    line 25
  7. Distinctive:

    Write in plain, concise English.

    line 30
  8. Very specific:

    Use title case for headings and this section order: What This Sample Demonstrates, How It Works, Running the Agent Host, Interacting with …

    line 32
  9. Distinctive:

    Add sample-specific subsections as needed.

    line 35
  10. Distinctive:

    Keep snippets consistent with the code.

    line 44
  11. Distinctive:

    Document exporter and content-recording defaults.

    line 53
  12. Very specific:

    When main.py only exports a graph, set azd's startupCommand in azure.yaml to invoke the hosting module with the hosted entrypoint's …

    line 58
  13. Very specific:

    Use --no-cache-dir for pip installs.

    line 62
  14. Distinctive:

    When changing telemetry or image builds, check default tracing initialization, dependency-layer order, and bytecode in the resulting image …

    line 90
  15. Distinctive:

    Keep repository-file checks in the docs/samples suite.

    line 92

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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/ or invocations/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_thread for 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=False because 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, and Deploying 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.py only exports a graph, set azd's startupCommand in azure.yaml to invoke the hosting module with the hosted entrypoint's protocol and options. codeConfiguration.entryPoint and Docker CMD do not set the local command.
  • Install dependencies before copying application code to preserve Docker layer caching.
  • Use --no-cache-dir for pip installs. Pip generates dependency .pyc files by default; avoid redundant dependency-wide compileall steps.
  • With uv, use uv sync --compile-bytecode for dependencies and compileall for 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.