| 1 | # response.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `response.py` agent tool. |
| 6 | - This module emits the final or intermediate agent response to the user. |
| 7 | - Keep this file-level DOX profile synchronized with `response.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `response.py` owns the runtime implementation. |
| 12 | - `response.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `ResponseTool` (`Tool`) |
| 15 | - `async execute(self, **kwargs)` |
| 16 | - `async before_execution(self, **kwargs)` |
| 17 | - `async after_execution(self, response, **kwargs)` |
| 18 | |
| 19 | ## Runtime Contracts |
| 20 | |
| 21 | - Tool modules must define `helpers.tool.Tool` subclasses and return `helpers.tool.Response` from `execute(...)`. |
| 22 | - Update this file whenever tool arguments, output shape, `break_loop` behavior, intervention handling, prompt instructions, or side effects change. |
| 23 | - `ResponseTool` is a `Tool`. |
| 24 | - `ResponseTool` defines `execute(...)`. |
| 25 | - `ResponseTool` requires a non-empty top-level string `text` or legacy `message` |
| 26 | argument, preferring `text` and falling back to `message` when `text` is blank. |
| 27 | Invalid arguments raise `RepairableException` so the agent can surface a correction |
| 28 | warning and retry rather than crash. |
| 29 | - Imported dependency areas include: `helpers.errors`, `helpers.tool`. |
| 30 | |
| 31 | ## Key Concepts |
| 32 | |
| 33 | - Important called helpers/classes observed in the source: `Response`. |
| 34 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 35 | |
| 36 | ## Work Guidance |
| 37 | |
| 38 | - Keep tool output concise, model-readable, and safe for history persistence. |
| 39 | - Coordinate argument or behavior changes with prompt tool instructions and skill guidance. |
| 40 | - Respect intervention flow for long-running, external, or user-visible operations. |
| 41 | |
| 42 | ## Verification |
| 43 | |
| 44 | - Run targeted tool and prompt-contract tests for changed behavior; smoke-test agent execution when no focused test exists. |
| 45 | - Related tests observed by source search: |
| 46 | - `tests/chunk_parser_test.py` |
| 47 | - `tests/rate_limiter_test.py` |
| 48 | - `tests/test_browser_agent_regressions.py` |
| 49 | - `tests/test_chat_compaction.py` |
| 50 | - `tests/test_dirty_json.py` |
| 51 | - `tests/test_download_toast_regressions.py` |
| 52 | - `tests/test_fasta2a_client.py` |
| 53 | - `tests/test_fastmcp_openapi_security.py` |
| 54 | |
| 55 | ## Child DOX Index |
| 56 | |
| 57 | No child DOX files. |