|
| 1 | +# AGENTS.md — hawk-sdk-python |
| 2 | + |
| 3 | +Python SDK for the Hawk daemon API. Provides an idiomatic Python client for chat, streaming, sessions, and stats. |
| 4 | + |
| 5 | +## Design Principles |
| 6 | + |
| 7 | +- **Thin wrapper** — maps directly to the hawk daemon HTTP API |
| 8 | +- **Type-hinted** — full type annotations for IDE support |
| 9 | +- **Zero dependencies** — only `requests` and `typing_extensions` |
| 10 | + |
| 11 | +## Build & Test |
| 12 | + |
| 13 | +```bash |
| 14 | +pip install -e ".[dev]" # Install with dev deps |
| 15 | +pytest # Run tests |
| 16 | +pytest --cov=hawk --cov-report=term-missing # Coverage |
| 17 | +ruff check . # Lint |
| 18 | +ruff format . # Format |
| 19 | +mypy . # Type check |
| 20 | +``` |
| 21 | + |
| 22 | +## Architecture |
| 23 | + |
| 24 | +- `hawk/client.py` — Main `HawkClient` class |
| 25 | +- `hawk/models.py` — Pydantic models for API responses |
| 26 | +- `hawk/errors.py` — Typed error classes (`HawkAPIError`, etc.) |
| 27 | +- `hawk/discovery.py` — Auto-discover running hawk daemon |
| 28 | +- `hawk/memory_tools.py` — Memory graph operations |
| 29 | +- `tests/` — Test suite with mocked HTTP responses |
| 30 | + |
| 31 | +## Conventions |
| 32 | + |
| 33 | +- Python 3.10+ |
| 34 | +- `ruff` for linting and formatting (enforced in CI) |
| 35 | +- Type annotations required on all public APIs |
| 36 | +- Conventional Commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:` |
| 37 | +- No `Co-authored-by:` trailers |
| 38 | +- `pytest` for testing, `httpretty` for HTTP mocking |
| 39 | + |
| 40 | +## Common Pitfalls |
| 41 | + |
| 42 | +- `HawkClient` uses context manager (`with` statement) for cleanup |
| 43 | +- Discovery scans localhost ports — tests must mock this |
| 44 | +- `Retry-After: 0` is valid — respect it, don't retry immediately |
0 commit comments