This guide helps new contributors get started with the OpenAI Agents JS monorepo. It covers repo structure, how to test your work, available utilities, file locations, and guidelines for commits and PRs.
Location: AGENTS.md at the repository root.
- Mandatory Skill Usage
- ExecPlans
- Overview
- Repo Structure & Important Files
- Testing & Automated Checks
- Repo-Specific Utilities
- Style, Linting & Type Checking
- Prerequisites
- Development Workflow
- Pull Request & Commit Guidelines
- Review Process & What Reviewers Look For
- Tips for Navigating the Repo
Run $code-change-verification before marking work complete when changes affect runtime code, tests, or build/test behavior.
Run it when you change:
packages/,examples/,helpers/,scripts/, orintegration-tests/- Root build/test config such as
package.json,pnpm-lock.yaml,pnpm-workspace.yaml,tsconfig*.json,eslint.config.*, orvitest*.ts
You can skip $code-change-verification for docs-only or repo-meta changes (for example, docs/, .codex/, README.md, AGENTS.md, .github/), unless a user explicitly asks to run the full verification stack.
When you change anything under packages/ or touch .changeset/, use $changeset-validation to create and validate the changeset before you treat the code as final. Codex must ensure an appropriate changeset exists that covers every changed package, and run this skill alongside $code-change-verification ahead of handoff.
When working on OpenAI API or OpenAI platform integrations in this repo (Responses API, tools, streaming, Realtime API, auth, models, rate limits, MCP, Agents SDK/ChatGPT Apps SDK), use $openai-knowledge to pull authoritative docs via the OpenAI Developer Docs MCP server (and guide setup if it is not configured).
When writing complex features or significant refactors, use an ExecPlan (as described in PLANS.md) from design to implementation. Store each ExecPlan file in the repository root (top level) with a descriptive name. Call out potential backward compatibility or public API risks in your plan and confirm the approach when changes could impact package consumers.
The OpenAI Agents JS repository is a pnpm-managed monorepo that provides:
packages/agents: A convenience bundle exporting core and OpenAI packages.packages/agents-core: Core abstractions and runtime for agent workflows.packages/agents-openai: OpenAI-specific bindings and implementations.packages/agents-realtime: Realtime bindings and implementations.packages/agents-extensions: Extensions for agent workflows.docs: Documentation site powered by Astro.examples: Sample projects demonstrating usage patterns.scripts: Automation scripts (dev.mts,embedMeta.ts).helpers: Shared utilities for testing and other internal use.
packages/agents-core/,packages/agents-openai/,packages/agents-realtime/,packages/agents-extensions/: Each has its ownpackage.json,src/,test/, and build scripts.docs/: Documentation source; develop withpnpm docs:devor build withpnpm docs:build. Translated docs underdocs/src/content/docs/ja,docs/src/content/docs/ko, anddocs/src/content/docs/zhare generated viapnpm docs:translate; do not edit them manually.examples/: Subdirectories (e.g.basic,agent-patterns) with their ownpackage.jsonand start scripts.scripts/dev.mts: Runs concurrent build-watchers and the docs dev server (pnpm dev).scripts/embedMeta.ts: Generatessrc/metadata.tsfor each package before build.helpers/tests/: Shared test utilities.README.md: High-level overview and installation instructions.CONTRIBUTING.md: Official contribution guidelines (this guide is complementary).pnpm-workspace.yaml: Defines workspace packages.tsconfig.json,tsc-multi.json: TypeScript configuration.vitest.config.ts: Test runner configuration.eslint.config.mjs: ESLint configuration.package.json(root): Common scripts (build,test,lint,dev,docs:dev,examples:*).
Before submitting changes, ensure all checks pass and augment tests when you touch code:
When $code-change-verification applies (see Mandatory Skill Usage), invoke it to run the required verification stack from the repository root. Rerun the full stack after fixes.
- Add or update unit tests for any code change unless it is truly infeasible; if something prevents adding tests, explain why in the PR.
- Check the compilation across all packages and examples:
NEVER USE
pnpm -r build-check
-wor other watch modes. - Run the full test suite:
CI=1 pnpm test - Tests are located under each package in
packages/<pkg>/test/. - The test script already sets
CI=1to avoid watch mode.
- Not required for typical contributions. These tests rely on a local npm registry (Verdaccio) and other environment setup.
- To run locally only if needed:
pnpm local-npm:start # starts Verdaccio on :4873 pnpm local-npm:publish # public pacakges to the local repo pnpm test:integration # runs integration tests
See this README for details.
- Generate coverage report:
pnpm test:coverage
- Reports output to
coverage/.
- Run ESLint:
pnpm lint
- Code style follows
eslint.config.mjsand Prettier defaults. - Comments must end with a period.
- Ensure TypeScript errors are absent via build:
pnpm build
- Build runs
tsx scripts/embedMeta.ts(prebuild) andtscfor each package.
When $code-change-verification applies (see Mandatory Skill Usage), run the full validation sequence locally via the $code-change-verification skill; do not skip any step or change the order.
Before opening a pull request, always run $changeset-validation to ensure all changed packages are covered by a changeset and the validation passes; if no packages were touched and a changeset is unnecessary, you can skip creating one.
- You can skip failing precommit hooks using
--no-verifyduring commit.
pnpm dev: Runs concurrent watch builds for all packages and starts the docs dev server.pnpm dev
- Documentation site:
pnpm docs:dev pnpm docs:build
- Examples:
pnpm examples:basic pnpm examples:agents-as-tools pnpm examples:deterministic pnpm examples:tools-shell pnpm examples:tools-apply-patch # See root package.json "examples:*" scripts for full list - Metadata embedding (prebuild):
pnpm -F <package> build # runs embedMeta.ts automatically
- Workspace scoping (operate on a single package):
pnpm -F agents-core build pnpm -F agents-openai test
- Follow ESLint rules (
eslint.config.mjs), no unused imports, adhere to Prettier. - Run
pnpm lintand fix all errors locally. - Use
pnpm buildto catch type errors.
- Node.js 22+ recommended.
- pnpm 10+ (
corepack enableis recommended to manage versions).
- Sync with
main(or default branch). - Create a feature/fix branch with a descriptive name:
git checkout -b feat/<short-description>
- Make changes and add/update unit tests in
packages/<pkg>/testunless doing so is truly infeasible. - When
$code-change-verificationapplies (see Mandatory Skill Usage), run it to execute the full verification stack in order before considering the work complete. - Commit using Conventional Commits.
- Push and open a pull request.
- When reporting code changes as complete (after substantial code work), invoke
$pr-draft-summaryto generate the required PR summary block with change summary, PR title, and draft description.
-
Use Conventional Commits:
feat: new featurefix: bug fixdocs: documentation onlytest: adding or fixing testschore: build, CI, or tooling changesperf: performance improvementrefactor: code changes without feature or fixbuild: changes that affect the build systemci: CI configurationstyle: code style (formatting, missing semicolons, etc.)types: type-related changesrevert: reverts a previous commit
-
Commit message format:
<type>(<scope>): <short summary> Optional longer description. -
Keep summary under 80 characters.
-
If your change affects the public API, add a Changeset via:
pnpm changeset
- ✅ All automated checks pass (build, tests, lint).
- ✅ Tests cover new behavior and edge cases.
- ✅ Code is readable and maintainable.
- ✅ Public APIs have doc comments.
- ✅ Examples updated if behavior changes.
- ✅ Documentation (in
docs/) updated for user-facing changes. - ✅ Commit history is clean and follows Conventional Commits.
- Use
pnpm -F <pkg>to operate on a specific package. - Study
vitest.config.tsfor test patterns (e.g., setup files, aliasing). - Explore
scripts/embedMeta.tsfor metadata generation logic. - Examples in
examples/are fully functional apps—run them to understand usage. - Docs in
docs/src/use Astro and Starlight; authored content lives underdocs/src/content/docs/and mirrors package APIs. - When editing GitHub Actions workflows, always web-search for the latest stable major versions of official actions (e.g.,
actions/checkout,actions/setup-node) before updating version pins. - Treat review feedback critically: reviewers can be wrong. Reproduce or verify each comment, cross-check with source docs, and only make changes when the feedback remains valid after your own validation.