docs(agents): update coding conventions for state persistence (#342)
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
Tests ReMe / Unit Tests - py3.11 (push) Waiting to run
Tests ReMe / Unit Tests - py3.12 (push) Waiting to run
Tests ReMe / Unit Tests - py3.13 (push) Waiting to run
Windows Smoke / CLI smoke - py3.11 (push) Waiting to run

- Add guideline that steps should be stateless
- Specify storing persistent state in self.app_context.metadata
- Clarify avoiding state storage on step instances
This commit is contained in:
jinliyl 2026-07-13 23:05:35 +08:00 • committed by GitHub
parent bf7ca17705
commit 07d4527a0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,6 +112,8 @@ authorized the necessary environment.
## Coding and Test Conventions
- Target Python 3.11+ and follow the surrounding typing and async style.
- Steps are stateless. If a step needs to persist state, store it in
`self.app_context.metadata` rather than on the step instance.
- Keep public schemas explicit and backward-compatible where practical.
- Close async clients, services, tasks, and other lifecycle resources deterministically.
- Prefer clear failures over silently falling back to corrupt or ambiguous state.