Guidance for agents that are adding, removing, moving, or materially changing examples in this repository.
- Prefer adapting the closest existing example over creating a new one from scratch.
- Use concise
kebab-casedirectory names for new examples. - New examples on
mainshould use DepthAI v3 patterns. - Keep required runtime dependencies in the example's
requirements.txt. - Use the DepthAI Visualizer for visualization unless the example specifically requires another UI or output path.
- Keep media assets small and store demo media in
/mediawhen adding human-facing README material. - Update the relevant top-level category README table when adding a new example.
- Add or update the example's
AGENTS.mdwhenever creating a new example or materially changing an existing one. - Keep per-example
AGENTS.mdfocused on example-specific purpose, architecture, constraints, safe modifications, and validation. - Start every per-example guide with
# AGENTS.mdas the only H1 heading in the file. - Use these required H2 sections exactly once and in this order:
## Summary,## Use This Example When,## Do Not Use This Example When,## Quick Facts,## Read First,## Architecture,## Constraints,## Related Examples,## Validation - The following H2 sections are optional, but when present they must appear in these positions:
## Data Flowafter## Architecture## Modification Guideafter## Data Flowor## Architecture## Common Adaptationsafter## Modification Guideor## Architecture## Non-Obvious Repo Conventionsafter## Constraints - Do not add any other H1 or H2 sections. If you need extra structure, use bullets or H3 headings under the allowed sections.
- Start the body with a
## Summarysection. Its first paragraph is used by the generated INDEX.md, so keep it to one or two short sentences. - Do not repeat shared vocabulary from ESSENTIAL_KNOWLEDGE.md unless the example has an exception.
- Treat
README.mdas human-facing documentation. Agent-critical details should live inAGENTS.md. - It is OK for
AGENTS.mdto duplicate important details fromREADME.md; prefer duplication over forcing agents to read noisy human-facing docs.
Validate per-example AGENTS.md coverage and structure locally from the repository root:
python3 scripts/validate_agents_docs.pyCI runs the same validation on pull requests.
The runnability tests discover examples that have main.py and requirements.txt in the same directory. Detected examples are run as python3 main.py with no additional flags after installing their requirements.
Run all example tests locally from the repository root:
pytest -v -r a --log-cli-level=INFO --log-file=out.log --color=yes --root-dir . -- tests/Run only peripheral tests:
pytest -v -r a --log-cli-level=INFO --log-file=out.log --color=yes --root-dir . -- tests/test_examples_peripheral.pyRun tests for one example:
pytest -v -r a --log-cli-level=INFO --log-file=out.log --color=yes --root-dir neural-networks/generic-example -- tests/Useful local filters:
pytest -v -r a --log-cli-level=INFO --log-file=out.log --color=yes --platform rvc4 --python-version 3.12 --root-dir neural-networks/generic-example -- tests/If an example is intentionally incompatible with a mode, platform, Python version, OS, or DepthAI version, add or update its rule in tests/constants.py. See tests/README.md for the known-failing rule format.
Before finishing, run the most relevant local test command available for the change. If hardware or dependency constraints prevent local testing, state that explicitly in the PR.
- OAK project bootstrapping may use these examples as host-script or standalone project seeds; keep example
AGENTS.mdfiles usable outside the monorepo. - Put cross-example references under a section named exactly
## Related Examples; bootstrap tooling preserves that section when links are portable GitHubmainURLs. - Use GitHub URLs pinned to
mainfor cross-example links, for examplehttps://github.com/luxonis/oak-examples/tree/main/custom-frontend/raw-stream. - Keep relative links scoped to files inside the example directory. Do not use
../links to sibling or parent examples.
Regenerate INDEX.md after adding, removing, moving, or materially changing an example:
python3 scripts/generate_agents_index.pyDo not hand-edit generated example entries in INDEX.md; update example metadata/docs or the generator instead.
Verify the generated index before finishing:
python3 scripts/generate_agents_index.py --checkCI runs the same check on pull requests.