main
md 49 lines 2.23 KB
Rendered Raw
1 # subagents.py DOX
2
3 ## Purpose
4
5 - Own the `subagents.py` API endpoint.
6 - This module returns subordinate agent profile data for UI and delegation flows.
7 - Keep this file-level DOX profile synchronized with `subagents.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `subagents.py` owns the runtime implementation.
12 - `subagents.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `Subagents` (`ApiHandler`)
15 - `async process(self, input: Input, request: Request) -> Output`
16 - `get_subagents_list(self)`
17 - `load_agent(self, name: str | None)`
18 - `save_agent(self, name: str | None, data: dict | None)`
19 - `delete_agent(self, name: str | None)`
20
21 ## Runtime Contracts
22
23 - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`.
24 - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change.
25 - `Subagents` is an `ApiHandler`.
26 - `Subagents` defines `process(...)`.
27 - Observed side-effect areas: filesystem writes, filesystem deletion.
28 - Imported dependency areas include: `helpers`, `helpers.api`, `typing`.
29
30 ## Key Concepts
31
32 - Important called helpers/classes observed in the source: `subagents.get_agents_list`, `subagents.load_agent_data`, `subagents.SubAgent`, `subagents.save_agent_data`, `subagents.delete_agent_data`, `self.use_context`, `Exception`, `self.get_subagents_list`, `self.load_agent`, `self.save_agent`, `self.delete_agent`.
33 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
34
35 ## Work Guidance
36
37 - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes.
38 - Update frontend callers, plugin callers, and tests together when payload shape changes.
39 - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies.
40
41 ## Verification
42
43 - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists.
44 - Related tests observed by source search:
45 - `tests/test_skills_runtime.py`
46
47 ## Child DOX Index
48
49 No child DOX files.