main
md 58 lines 2.66 KB
Rendered Raw
1 # tool.py DOX
2
3 ## Purpose
4
5 - Own the `tool.py` helper module.
6 - This module defines the base agent tool class and response contract.
7 - Keep this file-level DOX profile synchronized with `tool.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `tool.py` owns the runtime implementation.
12 - `tool.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `Response` (no explicit base class)
15 - `Tool` (no explicit base class)
16 - `async execute(self, **kwargs) -> Response`
17 - `async set_progress(self, content: str | None)`
18 - `add_progress(self, content: str | None)`
19 - `async before_execution(self, **kwargs)`
20 - `async after_execution(self, response: Response, **kwargs)`
21 - `get_log_object(self)`
22 - `nice_key(self, key: str)`
23
24 ## Runtime Contracts
25
26 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
27 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
28 - `Tool` defines `execute(...)`.
29 - Observed side-effect areas: settings/state persistence.
30 - Imported dependency areas include: `abc`, `agent`, `dataclasses`, `helpers.extension`, `helpers.print_style`, `helpers.strings`, `typing`.
31
32 ## Key Concepts
33
34 - Important called helpers/classes observed in the source: `self.get_log_object`, `sanitize_string`, `self.agent.hist_add_tool_result`, `self.agent.context.log.log`, `key.split`, `join`, `call_extensions_async`, `response.message.strip`, `uuid.uuid4`, `PrintStyle`, `PrintStyle.stream`, `words.capitalize`, `word.lower`, `self.nice_key`.
35 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
36
37 ## Work Guidance
38
39 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
40 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
41 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
42
43 ## Verification
44
45 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
46 - Related tests observed by source search:
47 - `tests/test_a0_connector_prompt_gating.py`
48 - `tests/test_browser_agent_regressions.py`
49 - `tests/test_default_prompt_budget.py`
50 - `tests/test_dirty_json.py`
51 - `tests/test_document_query_plugin.py`
52 - `tests/test_fastmcp_openapi_security.py`
53 - `tests/test_host_browser_connector.py`
54 - `tests/test_mcp_handler_multimodal.py`
55
56 ## Child DOX Index
57
58 No child DOX files.