xr-ai
AGENTS.md93 starsChanged 4 months agoApache-2.0View on GitHub
This file contains the repository-wide constraints for humans and agents. Read the nearest package or sample README for its entry point and canonical-doc links. User-facing docs live only under docs/source/. Building an application? Read docs/source/guides/building-your-app.md. - One hub serves many clients and agents. It fans inbound messages to subscribed ProcessorEndpoints and routes return traffic only to the originating client. - Agents communicate with the hub through xr_ai_hub IPC. LiveKit is internal to the hub and must not appear in agent…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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 repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- build-your-appSkill
- getting-startedSkill
- gh-manage-xr-ai-reviewsSkill
- gh-review-xr-aiSkill
The file
We split this AGENTS.md into the rules it gives an agent
10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 42
All model HTTP goes through the typed services and factories in xr_ai_models.
- Very specific: line 104
When preparing a repository sample, refer to Adding a sample and the simple-vlm-example reference.
- Very specific: line 120
After changing a pyproject.toml outside apps/, run uv run --script .github/scripts/generate_dependency_map.py.
- Very specific: line 123
Do not hand-edit the generated section in DEPENDENCIES.md.
- Very specific: line 140
Never put API keys or tokens in source files.
- Distinctive: line 142
Do not add an abstraction until two concrete use cases need it.
- Very specific: line 143
When a sample's behavior is driven by an LLM prompt, changing a rule in its system.txt requires a corresponding eval case.
- Distinctive: line 159
Follow the authoritative documentation style for customer-facing Markdown and reStructuredText.
- Very specific: line 180
When documentation exists in both locations, consolidate it into docs/source/ and replace the README copy with a link.
- Distinctive: line 187
Use these canonical references when working in their area:
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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
<!--
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->xr-ai working contract
This file contains the repository-wide constraints for humans and agents. Read
the nearest package or sample README for its entry point and canonical-doc
links. User-facing docs live only under docs/source/.
Building an application? Read
docs/source/guides/building-your-app.md.
Repository map
client-samples/ Platform clients
agent-sdk/ Agent runtime, hub IPC, model, tool, and voice libraries
agent-samples/ Runnable agent stacks
model-server-samples/ Shared model-server launch samples
apps/ Application workspaces outside repository sample tooling
services/ Hub, model servers, and typed capability services
utils/ Launcher, logging, VAD, vLLM, and voice-gate utilities
tests/ Cross-package and integration tests
docs/source/ User and contributor documentation
third_party_licenses/ Unmodified third-party license and attribution texts
skills/ Skill bank that sets coding agents upArchitecture boundaries
- One hub serves many clients and agents. It fans inbound messages to subscribed
ProcessorEndpoints and routes return traffic only to the originating client. - Agents communicate with the hub through
xr_ai_hubIPC. LiveKit is internal to the hub and must not appear in agent APIs. - The hub owns client readiness. Agents report only their own
_agent.status. Readiness participation is opt-in withannounces_readiness=True, applies only to subscribed participants, and must never be published directly by a worker. agent-sdk/xr-ai-hub/depends only onpyzmqandmsgpack.- All model HTTP goes through the typed services and factories in
xr_ai_models. Do not add vendor SDKs or hand-written model HTTP clients to workers or services. One scoped exception: Riva speech NIMs expose only gRPC, so the optionalrivaextra addsnvidia-riva-clientbehindkind: riva_grpc, with the import deferred intomake_stt/make_tts; the base install stays httpx-only. - Workers never import
device_io_huborxr_ai_launcher. Use public SDK packages and task-specific libraries. - Tools are native, in-process
ToolorAsyncToolinstances fromxr_ai_tools. Every execution passes through NeMo Relay. The repository does not ship MCP compatibility servers. - Agents call another agent's tools directly with
execute()orstream().xr_ai_runtimeprovides typed publish/fan-out and owns only its delivery tasks. Agents own their state, resources, lifecycle, background tasks, and concurrency policy. - Application-specific capabilities stay with their application. Shared process boundaries use typed msgpack over ZMQ services, not MCP.
- Image selection and visual inference are separate tools. Selection returns
lightweight image references; single-image, multi-image, and timestamped
video-frame query tools resolve them through
VLMService. Raw media remains on the hub path and out of tool results. Latest recorded windows need only a duration; historical frame and video selection share an absolutestart_us.
The authoritative dependency graph and enforced package limits are in
DEPENDENCIES.md.
Process and sample layout
Each agent sample contains a stdlib-style orchestrator and a separately packaged worker. Optional application-specific capability processes sit beside them.
agent-samples/<kebab-name>/
main.py
pyproject.toml
README.md
yaml/
worker/
pyproject.toml
<snake_name>_worker/
__init__.py
__main__.pyApplications that are not repository samples use the same internal layout
under apps/<kebab-name>/. Repository dependency, lint, SPDX, sample catalog,
and test discovery exclude that top-level directory.
- Orchestrators depend on
xr-ai-launcher, declarePROCESSES, and callrun_stack. - Stack items start in declaration order; members of a
Parallelitem start concurrently. The launcher waits for each item to signal ready, and fails the stack if any process exits. device_io_hubalways runs as its own process.- Raw IPC workers keep hub addresses as module constants, use async callbacks,
cancel tasks before
ProcessorEndpoint.stop()and.close(), and move CPU-bound work to an executor. - Voice workers delegate readiness, signals, pipeline cancellation, and cleanup
to
VoiceAgent; its media session is private. - New worker code is a named package with relative internal imports and an
explicit
__main__.py.
When preparing a repository sample, refer to
Adding a sample and the
simple-vlm-example reference.
Change contract
- Public Python API names, signatures, types, defaults, and field behavior live
in
__all__, declarations, and co-located docstrings; Sphinx generates their reference pages. Update narrative README ordocs/source/content only when concepts, workflows, operations, or architecture change. Breaking changes also require a migration entry. - Top-level sample commands and options live in their
[project.scripts]andargparsedeclarations; Sphinx generates the user-facing CLI reference. - Sample configuration values and field guidance live in checked-in YAML/JSON
and adjacent YAML comments. Files under a top-level sample's
yaml/tree or beside a direct capability subproject are generated into the config reference. - After changing a
pyproject.tomloutsideapps/, runuv run --script .github/scripts/generate_dependency_map.py; the pre-commit hook normally regenerates the Python inventory automatically and CI rejects drift. Do not hand-edit the generated section inDEPENDENCIES.md. Regenerate the affected project's gitignoreduv.locklocally to verify resolution. - The root
uv.tomllimits registry artifacts to the last dependency qualification timestamp. Advance it only in a dedicated dependency refresh, resolve every project's gitignoreduv.lockwithuv --config-file uv.toml lock --upgrade --project <directory>from the repository root, and run the full test suite. uv stops upward config discovery at a nearer[tool.uv]table; most nested projects define one through[tool.uv.sources], so pass the root config explicitly. Do not commit per-project lockfiles; the locks underdependency-manifest/are the exception, anduv.lockthere is produced byuv run --script .github/scripts/generate_dependency_manifest.py(pre-commit runs it whenuv.tomlis staged). Regeneratedependency-manifest/for auv.tomlqualification refresh or a targeted dependency security refresh, and commit the generated project and lock in the same change. Do not regenerate it for ordinary dependency or project changes, even when a new project is missing from it. - Never put API keys or tokens in source files. Use environment variables or
the credential store documented in
docs/source/getting_started/credentials.md. - Do not add an abstraction until two concrete use cases need it.
- When a sample's behavior is driven by an LLM prompt, changing a rule in its
system.txtrequires a corresponding eval case. Do not reuse worked-example specifics in the eval fixture. - New source files outside
apps/need the repository SPDX header. File-type rules and exceptions are in SPDX headers. - Preserve unrelated work in a dirty tree. Never use destructive Git commands to discard user changes.
Comments and documentation
Comments explain a non-obvious invariant or failure mode. Do not narrate the code, debugging history, rejected alternatives, or plans. Keep architectural docs about the current system; issue trackers and Git history hold proposals and past decisions.
Follow the authoritative documentation style for customer-facing Markdown and reStructuredText. Match the surrounding document and keep edits scoped.
docs/source/ is the canonical home for user-facing concepts, architecture,
workflows, operations, troubleshooting, and reference material. Do not duplicate
that content in a README. A README is a concise repository entry point: state
what the directory contains, link to the canonical documentation, and keep only
the minimum local information needed before following that link. A top-level
sample README under agent-samples/ or model-server-samples/ additionally keeps
the exact commands needed to start that sample. State the sample directory as
the working directory and write every command relative to it, including commands
that invoke another sample such as ../../model-server-samples/model-servers
from an agent sample. It also includes a compact configuration entry point:
name the sample-owned YAML or JSON files, describe
the common settings they own, and show one representative edit. Put exhaustive
field descriptions, precedence, path resolution, architecture, behavior,
artifact contracts, extension instructions, and eval methodology in the
sample's docs/source/ guide. Nested READMEs may contain only artifact-local
instructions that are not useful in the published documentation.
When documentation exists in both locations, consolidate it into
docs/source/ and replace the README copy with a link. When moving README
content, preserve any still-valid operational detail in the destination page;
do not delete unique guidance merely to shorten the README. Package API details
remain in declarations and co-located docstrings and are rendered into the
generated Python reference rather than repeated in either narrative location.
Use these canonical references when working in their area:
| Topic | Document |
| Architecture | docs/source/overview/architecture.md |
| Processes | docs/source/components/launcher-and-process-model.md |
| Agent SDK | docs/source/components/agent-sdk.md |
| AI services | docs/source/components/ai-services.md |
| Credentials | docs/source/getting_started/credentials.md |
| Networking | docs/source/getting_started/networking.md |
| Testing | docs/source/guides/testing.md |
| Documentation style | docs/source/guides/documentation-style.md |
| Troubleshooting | docs/source/guides/troubleshooting.md |
| xr-render-demo | docs/source/reference/xr-render-demo.md |
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.

