| 1 | # fasta2a_client.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `fasta2a_client.py` helper module. |
| 6 | - This module connects Agent Zero to external A2A agents. |
| 7 | - Keep this file-level DOX profile synchronized with `fasta2a_client.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `fasta2a_client.py` owns the runtime implementation. |
| 12 | - `fasta2a_client.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `AgentConnection` (no explicit base class) |
| 15 | - `async get_agent_card(self) -> Dict[str, Any]` |
| 16 | - `async send_message(self, message: str, attachments: Optional[List[str]]=..., context_id: Optional[str]=..., metadata: Optional[Dict[str, Any]]=...) -> Dict[str, Any]` |
| 17 | - `async get_task(self, task_id: str) -> Dict[str, Any]` |
| 18 | - `async wait_for_completion(self, task_id: str, poll_interval: int=..., max_wait: int=...) -> Dict[str, Any]` |
| 19 | - `async close(self)` |
| 20 | - Top-level functions: |
| 21 | - `async connect_to_agent(agent_url: str, timeout: int=...) -> AgentConnection`: Create a connection to a remote agent. |
| 22 | - `is_client_available() -> bool`: Check if FastA2A client is available. |
| 23 | - Notable constants/configuration names: `_PRINTER`. |
| 24 | |
| 25 | ## Runtime Contracts |
| 26 | |
| 27 | - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together. |
| 28 | - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change. |
| 29 | - Observed side-effect areas: filesystem writes, network calls, WebSocket state, settings/state persistence, secret handling, scheduler state. |
| 30 | - Imported dependency areas include: `helpers.print_style`, `typing`, `uuid`. |
| 31 | |
| 32 | ## Key Concepts |
| 33 | |
| 34 | - Important called helpers/classes observed in the source: `PrintStyle`, `AgentConnection`, `PrintStyle.warning`, `agent_url.rstrip`, `httpx.AsyncClient`, `A2AClient`, `TimeoutError`, `connection.get_agent_card`, `RuntimeError`, `agent_url.startswith`, `os.getenv`, `self._http_client.aclose`, `self.close`, `response.raise_for_status`, `response.json`, `self.get_agent_card`, `uuid.uuid4`, `self._a2a_client.send_message`, `self._a2a_client.get_task`, `self.get_task`. |
| 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 | - No direct test reference was found by name search; choose the nearest behavioral test or perform a focused smoke check. |
| 47 | |
| 48 | ## Child DOX Index |
| 49 | |
| 50 | No child DOX files. |