Skip to content

Commit 492b2f0

Browse files
docs(sdk): add scoped AGENTS.md (#2081)
Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 23e167d commit 492b2f0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
- This directory (`openhands-sdk/openhands/sdk/`) contains the core Python SDK under the `openhands.sdk.*` namespace.
6+
- Keep new modules within the closest existing subpackage (e.g., `llm/`, `tool/`, `event/`, `agent/`) and follow local naming patterns.
7+
- Add/adjust unit tests under `tests/sdk/` mirroring the SDK path (for example, changes to `openhands-sdk/openhands/sdk/tool/tool.py` should be covered in `tests/sdk/tool/test_tool.py`).
8+
9+
## Build, Test, and Development Commands
10+
11+
- `make build`: sets up the dev environment (runs `uv sync --dev` and installs pre-commit hooks).
12+
- `make lint` / `make format`: run Ruff linting and formatting.
13+
- `uv run pre-commit run --files <path>`: run the pre-commit checks for files you changed.
14+
- `uv run pytest tests/sdk -k <pattern>`: run targeted SDK tests; prefer running the smallest relevant test set first.
15+
16+
## Coding Style & Naming Conventions
17+
18+
- Python target is 3.12; keep code Ruff-compliant (line length 88).
19+
- Prefer explicit, accurate type annotations; use Pyright for type checking (do not add mypy).
20+
- Avoid `# type: ignore` unless there is no reasonable typing fix.
21+
- Keep imports at the top of files; avoid `sys.path` hacks and in-line imports unless required for circular dependencies.
22+
- When changing Pydantic models or serialized event shapes, preserve backward compatibility so older persisted data can still load.
23+
24+
## Testing Guidelines
25+
26+
- Prefer real code paths over mocks; introduce fixtures in `tests/conftest.py` when setup is repeated.
27+
- Keep tests minimal and focused on the changed behavior; avoid adding broad integration tests unless required.
28+
29+
## Commit & Pull Request Guidelines
30+
31+
- Follow the repository’s existing commit style (short, imperative subjects; use scope prefixes like `fix(sdk):` when helpful).
32+
- Keep PRs focused; update docs and tests when changing public APIs or user-facing behavior.

0 commit comments

Comments
 (0)