Skip to content

Commit 19b7c0b

Browse files
authored
docs: align contributor guide and skills with JS updates (#2286)
1 parent a17fc3f commit 19b7c0b

7 files changed

Lines changed: 247 additions & 73 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: code-change-verification
3+
description: Run the mandatory verification stack when changes affect runtime code, tests, or build/test behavior in the OpenAI Agents Python repository.
4+
---
5+
6+
# Code Change Verification
7+
8+
## Overview
9+
10+
Ensure work is only marked complete after formatting, linting, type checking, and tests pass. Use this skill when changes affect runtime code, tests, or build/test configuration. You can skip it for docs-only or repository metadata unless a user asks for the full stack.
11+
12+
## Quick start
13+
14+
1. Keep this skill at `./.codex/skills/code-change-verification` so it loads automatically for the repository.
15+
2. macOS/Linux: `bash .codex/skills/code-change-verification/scripts/run.sh`.
16+
3. Windows: `powershell -ExecutionPolicy Bypass -File .codex/skills/code-change-verification/scripts/run.ps1`.
17+
4. If any command fails, fix the issue, rerun the script, and report the failing output.
18+
5. Confirm completion only when all commands succeed with no remaining issues.
19+
20+
## Manual workflow
21+
22+
- If dependencies are not installed or have changed, run `make sync` first to install dev requirements via `uv`.
23+
- Run from the repository root in this order: `make format`, `make lint`, `make mypy`, `make tests`.
24+
- Do not skip steps; stop and fix issues immediately when a command fails.
25+
- Re-run the full stack after applying fixes so the commands execute in the required order.
26+
27+
## Resources
28+
29+
### scripts/run.sh
30+
31+
- Executes the full verification sequence with fail-fast semantics from the repository root. Prefer this entry point to ensure the required commands run in the correct order.
32+
33+
### scripts/run.ps1
34+
35+
- Windows-friendly wrapper that runs the same verification sequence with fail-fast semantics. Use from PowerShell with execution policy bypass if required by your environment.

.codex/skills/verify-changes/scripts/run.ps1 renamed to .codex/skills/code-change-verification/scripts/run.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Invoke-MakeStep {
2525
& make $Step
2626

2727
if ($LASTEXITCODE -ne 0) {
28-
Write-Error "verify-changes: make $Step failed with exit code $LASTEXITCODE."
28+
Write-Error "code-change-verification: make $Step failed with exit code $LASTEXITCODE."
2929
exit $LASTEXITCODE
3030
}
3131
}
@@ -35,4 +35,4 @@ Invoke-MakeStep -Step "lint"
3535
Invoke-MakeStep -Step "mypy"
3636
Invoke-MakeStep -Step "tests"
3737

38-
Write-Host "verify-changes: all commands passed."
38+
Write-Host "code-change-verification: all commands passed."

.codex/skills/verify-changes/scripts/run.sh renamed to .codex/skills/code-change-verification/scripts/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ make mypy
2222
echo "Running make tests..."
2323
make tests
2424

25-
echo "verify-changes: all commands passed."
25+
echo "code-change-verification: all commands passed."
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: openai-knowledge
3+
description: Use when working with the OpenAI API (Responses API) or OpenAI platform features (tools, streaming, Realtime API, auth, models, rate limits, MCP) and you need authoritative, up-to-date documentation (schemas, examples, limits, edge cases). Prefer the OpenAI Developer Documentation MCP server tools when available; otherwise guide the user to enable `openaiDeveloperDocs`.
4+
---
5+
6+
# OpenAI Knowledge
7+
8+
## Overview
9+
10+
Use the OpenAI Developer Documentation MCP server to search and fetch exact docs (markdown), then base your answer on that text instead of guessing.
11+
12+
## Workflow
13+
14+
### 1) Check whether the Docs MCP server is available
15+
16+
If the `mcp__openaiDeveloperDocs__*` tools are available, use them.
17+
18+
If you are unsure, run `codex mcp list` and check for `openaiDeveloperDocs`.
19+
20+
### 2) Use MCP tools to pull exact docs
21+
22+
- Search first, then fetch the specific page or pages.
23+
- `mcp__openaiDeveloperDocs__search_openai_docs` → pick the best URL.
24+
- `mcp__openaiDeveloperDocs__fetch_openai_doc` → retrieve the exact markdown (optionally with an `anchor`).
25+
- When you need endpoint schemas or parameters, use:
26+
- `mcp__openaiDeveloperDocs__get_openapi_spec`
27+
- `mcp__openaiDeveloperDocs__list_api_endpoints`
28+
29+
Base your answer on the fetched text and quote or paraphrase it precisely. Do not invent flags, field names, defaults, or limits.
30+
31+
### 3) If MCP is not configured, guide setup (do not change config unless asked)
32+
33+
Provide one of these setup options, then ask the user to restart the Codex session so the tools load:
34+
35+
- CLI:
36+
- `codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp`
37+
- Config file (`~/.codex/config.toml`):
38+
- Add:
39+
```toml
40+
[mcp_servers.openaiDeveloperDocs]
41+
url = "https://developers.openai.com/mcp"
42+
```
43+
44+
Also point to: https://developers.openai.com/resources/docs-mcp#quickstart

.codex/skills/verify-changes/SKILL.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

AGENTS.md

Lines changed: 164 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,186 @@
1-
Welcome to the OpenAI Agents SDK repository. This file contains the main points for new contributors.
1+
# Contributor Guide
22

3-
## Repository overview
3+
This guide helps new contributors get started with the OpenAI Agents Python repository. It covers repo structure, how to test your work, available utilities, and guidelines for commits and PRs.
44

5-
- **Source code**: `src/agents/` contains the implementation.
6-
- **Tests**: `tests/` with a short guide in `tests/README.md`.
7-
- **Examples**: under `examples/`.
8-
- **Documentation**: markdown pages live in `docs/` with `mkdocs.yml` controlling the site. Translated docs under `docs/ja`, `docs/ko`, and `docs/zh` are managed by an automated job; do not edit them manually.
9-
- **Utilities**: developer commands are defined in the `Makefile`.
10-
- **PR template**: `.github/PULL_REQUEST_TEMPLATE/pull_request_template.md` describes the information every PR must include.
5+
**Location:** `AGENTS.md` at the repository root.
116

12-
## Agent requirements
7+
## Table of Contents
138

14-
- Always invoke `$verify-changes` before completing any work. The skill encapsulates the required formatting, linting, type-checking, and tests; follow `.codex/skills/verify-changes/SKILL.md` for how to run it.
9+
1. [Mandatory Skill Usage](#mandatory-skill-usage)
10+
2. [Overview](#overview)
11+
3. [Repo Structure & Important Files](#repo-structure--important-files)
12+
4. [Testing & Automated Checks](#testing--automated-checks)
13+
5. [Repo-Specific Utilities](#repo-specific-utilities)
14+
6. [Style, Linting & Type Checking](#style-linting--type-checking)
15+
7. [Development Workflow](#development-workflow)
16+
8. [Pull Request & Commit Guidelines](#pull-request--commit-guidelines)
17+
9. [Review Process & What Reviewers Look For](#review-process--what-reviewers-look-for)
18+
10. [Tips for Navigating the Repo](#tips-for-navigating-the-repo)
19+
11. [Prerequisites](#prerequisites)
1520

16-
## Planning guidance
21+
## Mandatory Skill Usage
1722

18-
- Before starting work, surface any potential backward compatibility risks in your implementation plan and confirm the approach when breaking changes could affect existing users.
23+
### `$code-change-verification`
1924

20-
## Local workflow
25+
Run `$code-change-verification` before marking work complete when changes affect runtime code, tests, or build/test behavior.
2126

22-
1. Run `$verify-changes` before handing off work; it formats, lints, type-checks, and runs the test suite (see `.codex/skills/verify-changes/SKILL.md` for the workflow).
23-
2. To run a single test, use `uv run pytest -s -k <test_name>`.
24-
3. Build the documentation when you touch docs: `make build-docs`.
27+
Run it when you change:
28+
- `src/agents/` (library code) or shared utilities.
29+
- `tests/` or add or modify snapshot tests.
30+
- `examples/`.
31+
- Build or test configuration such as `pyproject.toml`, `Makefile`, `mkdocs.yml`, `docs/scripts/`, or CI workflows.
2532

26-
Coverage can be generated with `make coverage`.
33+
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.
2734

28-
All python commands should be run via `uv run python ...`
35+
### `$openai-knowledge`
2936

30-
## Snapshot tests
37+
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 or 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).
3138

32-
Some tests rely on inline snapshots. See `tests/README.md` for details on updating them:
39+
### Planning expectations
3340

34-
```bash
35-
make snapshots-fix # update existing snapshots
36-
make snapshots-create # create new snapshots
37-
```
41+
Call out potential backward compatibility or public API risks early in your plan and confirm the approach before implementing changes that could impact users.
42+
43+
## Overview
44+
45+
The OpenAI Agents Python repository provides the Python Agents SDK, examples, and documentation built with MkDocs. Use `uv run python ...` for Python commands to ensure a consistent environment.
46+
47+
## Repo Structure & Important Files
48+
49+
- `src/agents/`: Core library implementation.
50+
- `tests/`: Test suite; see `tests/README.md` for snapshot guidance.
51+
- `examples/`: Sample projects showing SDK usage.
52+
- `docs/`: MkDocs documentation source; do not edit translated docs under `docs/ja`, `docs/ko`, or `docs/zh` (they are generated).
53+
- `docs/scripts/`: Documentation utilities, including translation and reference generation.
54+
- `mkdocs.yml`: Documentation site configuration.
55+
- `Makefile`: Common developer commands.
56+
- `pyproject.toml`, `uv.lock`: Python dependencies and tool configuration.
57+
- `.github/PULL_REQUEST_TEMPLATE/pull_request_template.md`: Pull request template to use when opening PRs.
58+
- `site/`: Built documentation output.
59+
60+
## Testing & Automated Checks
3861

39-
Run `make tests` again after updating snapshots to ensure they pass.
62+
Before submitting changes, ensure relevant checks pass and extend tests when you touch code.
4063

41-
## Style notes
64+
When `$code-change-verification` applies, run it to execute the required verification stack from the repository root. Rerun the full stack after applying fixes.
4265

43-
- Write comments as full sentences and end them with a period.
66+
### Unit tests and type checking
4467

45-
## Pull request expectations
68+
- Run the full test suite:
69+
```bash
70+
make tests
71+
```
72+
- Run a focused test:
73+
```bash
74+
uv run pytest -s -k <pattern>
75+
```
76+
- Type checking:
77+
```bash
78+
make mypy
79+
```
4680

47-
PRs should use the template located at `.github/PULL_REQUEST_TEMPLATE/pull_request_template.md`. Provide a summary, test plan and issue number if applicable, then check that:
81+
### Snapshot tests
4882

49-
- New tests are added when needed.
50-
- Documentation is updated.
51-
- `make lint` and `make format` have been run.
52-
- The full test suite passes.
83+
Some tests rely on inline snapshots; see `tests/README.md` for details. Re-run `make tests` after updating snapshots.
5384

54-
Commit messages should be concise and written in the imperative mood. Small, focused commits are preferred.
85+
- Fix snapshots:
86+
```bash
87+
make snapshots-fix
88+
```
89+
- Create new snapshots:
90+
```bash
91+
make snapshots-create
92+
```
5593

56-
## What reviewers look for
94+
### Coverage
95+
96+
- Generate coverage (fails if coverage drops below threshold):
97+
```bash
98+
make coverage
99+
```
100+
101+
### Mandatory local run order
102+
103+
When `$code-change-verification` applies, run the full sequence in order (or use the skill scripts):
104+
105+
```bash
106+
make format
107+
make lint
108+
make mypy
109+
make tests
110+
```
57111

58-
- Tests covering new behaviour.
59-
- Consistent style: code formatted with `uv run ruff format`, imports sorted, and type hints passing `uv run mypy .`.
60-
- Clear documentation for any public API changes.
61-
- Clean history and a helpful PR description.
112+
## Repo-Specific Utilities
113+
114+
- Install or refresh development dependencies:
115+
```bash
116+
make sync
117+
```
118+
- Run tests against Python 3.9 in an isolated environment:
119+
```bash
120+
make old_version_tests
121+
```
122+
- Documentation workflows:
123+
```bash
124+
make build-docs # build docs after editing docs
125+
make serve-docs # preview docs locally
126+
make build-full-docs # run translations and build
127+
```
128+
- Snapshot helpers:
129+
```bash
130+
make snapshots-fix
131+
make snapshots-create
132+
```
133+
134+
## Style, Linting & Type Checking
135+
136+
- Formatting and linting use `ruff`; run `make format` (applies fixes) and `make lint` (checks only).
137+
- Type hints must pass `make mypy`.
138+
- Write comments as full sentences ending with a period.
139+
- Imports are managed by Ruff and should stay sorted.
140+
141+
## Development Workflow
142+
143+
1. Sync with `main` and create a feature branch:
144+
```bash
145+
git checkout -b feat/<short-description>
146+
```
147+
2. If dependencies changed or you are setting up the repo, run `make sync`.
148+
3. Implement changes and add or update tests alongside code updates.
149+
4. Highlight backward compatibility or API risks in your plan before implementing breaking or user-facing changes.
150+
5. Build docs when you touch documentation:
151+
```bash
152+
make build-docs
153+
```
154+
6. When `$code-change-verification` applies, run it to execute the full verification stack before handoff.
155+
7. Commit with concise, imperative messages; keep commits small and focused, then open a pull request.
156+
8. When reporting code changes as complete, include what you changed plus a draft pull request title and description for your local changes; start the description with prose such as “This pull request resolves/updates/adds …” using a verb that matches the change (you can use bullets later), explain the change background (for bugs, clearly describe the bug, symptoms, or repro; for features, what is needed and why), any behavior changes or considerations to be aware of, and you do not need to mention tests you ran.
157+
158+
## Pull Request & Commit Guidelines
159+
160+
- Use the template at `.github/PULL_REQUEST_TEMPLATE/pull_request_template.md`; include a summary, test plan, and issue number if applicable.
161+
- Add tests for new behavior when feasible and update documentation for user-facing changes.
162+
- Run `make format`, `make lint`, `make mypy`, and `make tests` before marking work ready.
163+
- Commit messages should be concise and written in the imperative mood. Small, focused commits are preferred.
164+
165+
## Review Process & What Reviewers Look For
166+
167+
- ✅ Checks pass (`make format`, `make lint`, `make mypy`, `make tests`).
168+
- ✅ Tests cover new behavior and edge cases.
169+
- ✅ Code is readable, maintainable, and consistent with existing style.
170+
- ✅ Public APIs and user-facing behavior changes are documented.
171+
- ✅ Examples are updated if behavior changes.
172+
- ✅ History is clean with a clear PR description.
173+
174+
## Tips for Navigating the Repo
175+
176+
- Use `examples/` to see common SDK usage patterns.
177+
- Review `Makefile` for common commands and use `uv run` for Python invocations.
178+
- Explore `docs/` and `docs/scripts/` to understand the documentation pipeline.
179+
- Consult `tests/README.md` for test and snapshot workflows.
180+
- Check `mkdocs.yml` to understand how docs are organized.
181+
182+
## Prerequisites
183+
184+
- Python 3.9+.
185+
- `uv` installed for dependency management (`uv sync`) and `uv run` for Python commands.
186+
- `make` available to run repository tasks.

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ make snapshots-fix
2121
### Creating snapshots
2222

2323
```
24-
make snapshots-update
24+
make snapshots-create
2525
```

0 commit comments

Comments
 (0)