Rifqi Hafizuddin Claude Opus 4.8 commited on
Commit Β·
e0141e7
1
Parent(s): 9bccc12
[NOTICKET] docs: add API_ENDPOINTS.md (FE surface for Go) + update DEV_PLAN tracker
Browse files- API_ENDPOINTS.md (repo root): the 4 FE-callable surfaces (call_agent,
list_skills, help, report) with request/response examples (chat SSE
transcript, report 201/409 JSON, version list), schemas, and a full
32-route inventory + task-8 reading.
- DEV_PLAN: #10 (API doc) and #12 (PR) marked done; tracker reflects KM-678.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- API_ENDPOINTS.md +373 -0
- DEV_PLAN.md +2 -2
API_ENDPOINTS.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Data Eyond β Python Agentic Service: FE-Callable API (for Go integration)
|
| 2 |
+
|
| 3 |
+
**Audience:** Harry (Go gateway) wiring the FE β Go β Python surface.
|
| 4 |
+
**Scope:** the **4 FE-callable surfaces** the Python service exposes after the 2026-06-24 pivot
|
| 5 |
+
(DEV_PLAN decision #6). Everything else under `/api/v1` is internal / Phase-1 legacy / Go-owned β
|
| 6 |
+
see [Β§7](#7-not-fe-facing) and the full inventory in [Β§9](#9-appendix--complete-endpoint-inventory-all-registered-routes).
|
| 7 |
+
**Branch:** `pr/4` Β· **Snapshot:** 2026-06-25 Β· **Companion:** [REPO_STATUS.md](REPO_STATUS.md).
|
| 8 |
+
|
| 9 |
+
> Request flow is **FE β Go β Python**. The FE never calls Python directly except for chat
|
| 10 |
+
> streaming. Auth/JWT is terminated at the Go gateway; Python receives `user_id` / `room_id` as
|
| 11 |
+
> **trusted inputs** and does no auth of its own.
|
| 12 |
+
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
## 1. The 4 FE-callable surfaces
|
| 16 |
+
|
| 17 |
+
| # | Logical name | HTTP | How it's invoked |
|
| 18 |
+
|---|---|---|---|
|
| 19 |
+
| 1 | **`call_agent`** | `POST /api/v1/chat/stream` | The one streaming chat call. Router classifies + dispatches. |
|
| 20 |
+
| 2 | **`list_skills`** | `GET /api/v1/tools` | Static slash-command catalog for the FE "/" menu. Cacheable. |
|
| 21 |
+
| 3 | **skill: `help`** | *(via `call_agent`)* | **No dedicated endpoint** β the router resolves it to the `help` intent inside `/chat/stream`. |
|
| 22 |
+
| 4 | **skill: `report`** | `POST /api/v1/report` (+ 2 `GET`s) | Dedicated REST API. **Not** through `/chat/stream`. |
|
| 23 |
+
|
| 24 |
+
**Key consequence for Go:** the two catalog skills are invoked **differently**. `/help` goes through
|
| 25 |
+
`/chat/stream`; `/report` is a direct REST call to the Report API. The catalog's `name` field is the
|
| 26 |
+
internal route key (`help` = router intent; `report` = the Report API), not a uniform dispatch key.
|
| 27 |
+
|
| 28 |
+
**Conventions:**
|
| 29 |
+
- Base path: `/api/v1`.
|
| 30 |
+
- **`room_id == analysis_id`** β one chat room == one analysis session (#9). Callers pass `room_id`
|
| 31 |
+
to chat; it *is* the `analysis_id` used by the report API.
|
| 32 |
+
- Streaming uses **SSE** (`text/event-stream`, `sse-starlette`).
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## 2. `call_agent` β `POST /api/v1/chat/stream`
|
| 37 |
+
|
| 38 |
+
The only FEβPython call in normal operation. Source: [chat.py:169](src/api/v1/chat.py:169).
|
| 39 |
+
|
| 40 |
+
**Request body** (`application/json`) β `ChatRequest`:
|
| 41 |
+
|
| 42 |
+
```json
|
| 43 |
+
{
|
| 44 |
+
"user_id": "u_1a2b3c",
|
| 45 |
+
"room_id": "room_42",
|
| 46 |
+
"message": "What were total sales by region last quarter?"
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
`room_id` is the analysis session id. No auth header (handled by Go).
|
| 51 |
+
|
| 52 |
+
**Response:** `text/event-stream`. Events arrive in this order:
|
| 53 |
+
|
| 54 |
+
| `event:` | `data:` payload | Notes |
|
| 55 |
+
|---|---|---|
|
| 56 |
+
| `sources` | JSON array of source refs | `{document_id, filename, page_label}`. Structured: one per executed table (`document_id = "{user_id}_{table}"`, `page_label = null`). Unstructured: deduped doc/page. `chat`/`help`/`error`: `[]`. |
|
| 57 |
+
| `status` | text | **Slow-path only** β progress pings ("Planningβ¦", "Running N stepsβ¦"). Keeps the SSE alive; safe to surface or ignore. |
|
| 58 |
+
| `chunk` | text fragment | Concatenate in order to form the answer. |
|
| 59 |
+
| `done` | *(empty)* | End of stream. |
|
| 60 |
+
| `error` | text | Terminal error; stream stops after this. |
|
| 61 |
+
|
| 62 |
+
> The handler also emits an internal `intent` event β it is **consumed inside Python** (gates
|
| 63 |
+
> caching) and **not forwarded** to the client. Go/FE will never see it.
|
| 64 |
+
|
| 65 |
+
**Example β `structured_flow` answer** (raw SSE wire; blank line separates events). Source shape:
|
| 66 |
+
[chat_handler.py:607](src/agents/chat_handler.py:607).
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
event: sources
|
| 70 |
+
data: [{"document_id":"u_1a2b3c_orders","filename":"orders","page_label":null}]
|
| 71 |
+
|
| 72 |
+
event: status
|
| 73 |
+
data: Planning analysisβ¦
|
| 74 |
+
|
| 75 |
+
event: status
|
| 76 |
+
data: Running 3 stepsβ¦
|
| 77 |
+
|
| 78 |
+
event: chunk
|
| 79 |
+
data: Total sales by region last quarter:
|
| 80 |
+
|
| 81 |
+
event: chunk
|
| 82 |
+
data: Central led at $1.21M (38%), East $0.74M, West $0.55M (down 12% QoQ).
|
| 83 |
+
|
| 84 |
+
event: done
|
| 85 |
+
data:
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
**Example β simple `chat` reply** (no status pings, empty sources):
|
| 89 |
+
|
| 90 |
+
```
|
| 91 |
+
event: sources
|
| 92 |
+
data: []
|
| 93 |
+
|
| 94 |
+
event: chunk
|
| 95 |
+
data: I'm your AI data analyst β connect a source or ask a question to get started.
|
| 96 |
+
|
| 97 |
+
event: done
|
| 98 |
+
data:
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
**Behavior worth knowing for integration:**
|
| 102 |
+
- **Redis response cache** (1h TTL) is applied to the stateless `chat` intent only; cached replies
|
| 103 |
+
replay as `sources`/`chunk`/`done`.
|
| 104 |
+
- **Greeting/farewell fast-path** returns a canned reply with no LLM call.
|
| 105 |
+
- The LLM **router** classifies every message into one of **5 intents** β
|
| 106 |
+
`chat` Β· `help` Β· `check` Β· `unstructured_flow` Β· `structured_flow` β and dispatches. Messages
|
| 107 |
+
persist (user + assistant) on `done`.
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
+
|
| 111 |
+
## 3. `list_skills` β `GET /api/v1/tools`
|
| 112 |
+
|
| 113 |
+
Static, deterministic, **safe for Go to cache**. Source: [tools.py:133](src/api/v1/tools.py:133).
|
| 114 |
+
|
| 115 |
+
**Request:** none (no params, no body).
|
| 116 |
+
|
| 117 |
+
**Response** `200` (`ListToolsResponse`):
|
| 118 |
+
|
| 119 |
+
```json
|
| 120 |
+
{
|
| 121 |
+
"count": 2,
|
| 122 |
+
"tools": [
|
| 123 |
+
{ "command": "/help", "name": "help", "type": "skill",
|
| 124 |
+
"description": "Show what the assistant can do and guide your next step." },
|
| 125 |
+
{ "command": "/report", "name": "report", "type": "skill",
|
| 126 |
+
"description": "Generate a versioned analysis report (background, EDA, key findings, insights)." }
|
| 127 |
+
]
|
| 128 |
+
}
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
`CommandResponse` = `{ command, name, type, description }`, `type β {skill, analytics, data_access}`.
|
| 132 |
+
Post-KM-678 the catalog is **`/help` + `/report` only**; the `analyze_*`, `check_*`, `retrieve_*`
|
| 133 |
+
and retired `/problem-statement` entries are commented out (kept for restorability), not deleted.
|
| 134 |
+
|
| 135 |
+
---
|
| 136 |
+
|
| 137 |
+
## 4. skill: `help` β via `call_agent`
|
| 138 |
+
|
| 139 |
+
**There is no `/help` endpoint.** The FE "/" menu surfaces `/help`; to invoke it, call
|
| 140 |
+
`POST /api/v1/chat/stream` and let the router classify the message as the `help` intent
|
| 141 |
+
([chat_handler.py:363](src/agents/chat_handler.py:363)). Help streams `chunk` events (same SSE
|
| 142 |
+
shape as Β§2, with `sources: []` and no `status` pings) β a state-aware, next-step guidance reply.
|
| 143 |
+
|
| 144 |
+
```
|
| 145 |
+
event: sources
|
| 146 |
+
data: []
|
| 147 |
+
|
| 148 |
+
event: chunk
|
| 149 |
+
data: Your goal is set β you can start exploring now. Try a question like "average order value by month", then I can generate a report.
|
| 150 |
+
|
| 151 |
+
event: done
|
| 152 |
+
data:
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
> **Open integration question (for Harry):** the Python `/chat/stream` contract has **no
|
| 156 |
+
> forced-intent / slash-bypass param** β `handle()` always routes via the LLM classifier. So
|
| 157 |
+
> deterministic `/help` dispatch depends on either (a) Go forwarding the literal slash text and
|
| 158 |
+
> trusting the router to classify it as `help`, or (b) adding a forced-intent input to the chat
|
| 159 |
+
> contract. The `tools.py` docstring's "slash invocation bypasses the router to the tool directly"
|
| 160 |
+
> is **not yet true on the Python side.** Needs a decision. (DEV_PLAN #8/#18.)
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## 5. skill: `report` β Report API
|
| 165 |
+
|
| 166 |
+
Dedicated REST surface (the "Generate Report" button), **not** a chat route.
|
| 167 |
+
Source: [report.py](src/api/v1/report.py).
|
| 168 |
+
|
| 169 |
+
### `POST /api/v1/report`
|
| 170 |
+
Generate, persist, and return a new report **version**.
|
| 171 |
+
|
| 172 |
+
**Query params:** `analysis_id` (required), `user_id` (required). No request body.
|
| 173 |
+
|
| 174 |
+
```
|
| 175 |
+
POST /api/v1/report?analysis_id=room_42&user_id=u_1a2b3c
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
| Status | Meaning |
|
| 179 |
+
|---|---|
|
| 180 |
+
| `201` | New version generated β `AnalysisReport` body. |
|
| 181 |
+
| `409` | Floor not met β **no recorded analyses yet** for this session, nothing to report. |
|
| 182 |
+
| `500` | Generation or persistence failed. |
|
| 183 |
+
|
| 184 |
+
**`201` response** (`AnalysisReport`):
|
| 185 |
+
|
| 186 |
+
```json
|
| 187 |
+
{
|
| 188 |
+
"report_id": "8f3a2b1c9d4e4f6a8b0c1d2e3f4a5b6c",
|
| 189 |
+
"analysis_id": "room_42",
|
| 190 |
+
"user_id": "u_1a2b3c",
|
| 191 |
+
"version": 2,
|
| 192 |
+
"generated_at": "2026-06-25T09:14:33.512Z",
|
| 193 |
+
"problem_statement": {
|
| 194 |
+
"objective": "Understand which regions drive revenue and why Q1 dipped.",
|
| 195 |
+
"business_questions": [
|
| 196 |
+
"Which regions contribute most to total revenue?",
|
| 197 |
+
"Did any region decline quarter-over-quarter?"
|
| 198 |
+
]
|
| 199 |
+
},
|
| 200 |
+
"record_ids": ["rec_a1", "rec_b2"],
|
| 201 |
+
"executive_summary": "Revenue is concentrated in the Central region (38% of total). The West was the only region to contract, down 12% QoQ β the main driver of the Q1 dip.",
|
| 202 |
+
"findings": [
|
| 203 |
+
{ "text": "Central region contributed 38% of total revenue, the largest share.",
|
| 204 |
+
"record_ids": ["rec_a1"], "supporting_data": null },
|
| 205 |
+
{ "text": "West region revenue fell 12% quarter-over-quarter.",
|
| 206 |
+
"record_ids": ["rec_b2"], "supporting_data": null }
|
| 207 |
+
],
|
| 208 |
+
"caveats": [
|
| 209 |
+
{ "text": "March data for the East region was partially missing (~6% of rows).",
|
| 210 |
+
"record_ids": ["rec_b2"] }
|
| 211 |
+
],
|
| 212 |
+
"open_questions": [
|
| 213 |
+
{ "text": "What drove the West region's QoQ decline?", "record_ids": ["rec_b2"] }
|
| 214 |
+
],
|
| 215 |
+
"data_sources": [
|
| 216 |
+
{ "source_id": "src_sales_db", "name": "orders", "source_type": "postgres",
|
| 217 |
+
"detail": { "tables": ["orders"], "row_count": 48213,
|
| 218 |
+
"columns": ["region", "amount", "ordered_at"] } }
|
| 219 |
+
],
|
| 220 |
+
"method_steps": [
|
| 221 |
+
{ "task_id": "t1", "stage": "data_understanding", "objective": "Inventory the sales source",
|
| 222 |
+
"status": "success", "tools_used": ["check_data"] },
|
| 223 |
+
{ "task_id": "t2", "stage": "modeling", "objective": "Aggregate revenue by region",
|
| 224 |
+
"status": "success", "tools_used": ["analyze_aggregate"] }
|
| 225 |
+
],
|
| 226 |
+
"rendered_markdown": "# Analysis Report\n\n*Generated 2026-06-25 by u_1a2b3c Β· 2 analyses Β· 1 source(s)*\n\n## Objective\nUnderstand which regions drive revenueβ¦\n\n## Key Findings\n1. Central region contributed 38%β¦"
|
| 227 |
+
}
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
**`409` response** (floor not met β the demo's most common error):
|
| 231 |
+
|
| 232 |
+
```json
|
| 233 |
+
{ "detail": "Not ready to generate a report β still needs at least one completed analysis." }
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
> β οΈ **Demo/integration precondition:** `AnalysisRecord`s persist **only on the slow path**, so
|
| 237 |
+
> reports require **`enable_slow_path=true`** on the Python deployment *and* β₯1 prior
|
| 238 |
+
> `structured_flow` question in the session. With slow path off, `POST /report` **409s by design**,
|
| 239 |
+
> not a bug. (DEV_PLAN #15/#16.)
|
| 240 |
+
|
| 241 |
+
### `GET /api/v1/report/{analysis_id}`
|
| 242 |
+
List a session's report versions (oldest-first). Returns `[ReportVersionEntry]`; `[]` if none.
|
| 243 |
+
|
| 244 |
+
```json
|
| 245 |
+
[
|
| 246 |
+
{ "report_id": "1b2c3d4eβ¦", "version": 1, "generated_at": "2026-06-24T15:02:11Z", "record_count": 1 },
|
| 247 |
+
{ "report_id": "8f3a2b1cβ¦", "version": 2, "generated_at": "2026-06-25T09:14:33Z", "record_count": 2 }
|
| 248 |
+
]
|
| 249 |
+
```
|
| 250 |
+
|
| 251 |
+
### `GET /api/v1/report/{analysis_id}/{version}`
|
| 252 |
+
Fetch one version β `AnalysisReport` (same shape as the `POST` 201 body above); `404` if that
|
| 253 |
+
version doesn't exist.
|
| 254 |
+
|
| 255 |
+
```json
|
| 256 |
+
{ "detail": "No report v3 for analysis 'room_42'." }
|
| 257 |
+
```
|
| 258 |
+
|
| 259 |
+
---
|
| 260 |
+
|
| 261 |
+
## 6. Schemas
|
| 262 |
+
|
| 263 |
+
**`AnalysisReport`** (POST + GET-version body):
|
| 264 |
+
|
| 265 |
+
| Field | Type | Notes |
|
| 266 |
+
|---|---|---|
|
| 267 |
+
| `report_id` | str | |
|
| 268 |
+
| `analysis_id` | str | == `room_id` |
|
| 269 |
+
| `user_id` | str \| null | |
|
| 270 |
+
| `version` | int | monotonic V1, V2, β¦ |
|
| 271 |
+
| `generated_at` | datetime | ISO 8601, UTC |
|
| 272 |
+
| `problem_statement` | `{ objective: str, business_questions: string[] }` | the frozen goal snapshot (new pivot shape) |
|
| 273 |
+
| `record_ids` | string[] | records the version was built from |
|
| 274 |
+
| `executive_summary` | str | the **only** LLM-authored field |
|
| 275 |
+
| `findings` | `ReportFinding[]` | `{ text, record_ids[], supporting_data? }` |
|
| 276 |
+
| `caveats` | `AttributedNote[]` | `{ text, record_ids[] }` |
|
| 277 |
+
| `open_questions` | `AttributedNote[]` | `{ text, record_ids[] }` |
|
| 278 |
+
| `data_sources` | `DataSourceRef[]` | `{ source_id, name, source_type, detail }` |
|
| 279 |
+
| `method_steps` | `TaskSummary[]` | `{ task_id, stage, objective, status, tools_used[] }`; `stage` β CRISP-DM phases |
|
| 280 |
+
| `rendered_markdown` | str | the full rendered report |
|
| 281 |
+
|
| 282 |
+
> **Persistence caveat:** dedorch `reports` stores **markdown only**. On read-back via the `GET`
|
| 283 |
+
> endpoints, the structured fields above come back **empty** and `rendered_markdown` is the source of
|
| 284 |
+
> truth. (REPO_STATUS Β§5.)
|
| 285 |
+
|
| 286 |
+
**`ReportVersionEntry`** (GET-list rows): `{ report_id, version, generated_at, record_count }`.
|
| 287 |
+
|
| 288 |
+
---
|
| 289 |
+
|
| 290 |
+
## 7. Not FE-facing
|
| 291 |
+
|
| 292 |
+
Registered under `/api/v1` but **not** part of the FEβPython surface β do not wire these from the FE:
|
| 293 |
+
|
| 294 |
+
- **Analysis CRUD** β `POST /analysis/create`, `GET /analysis`, `GET /analysis/{id}`. Intended to
|
| 295 |
+
move behind Go (state writes via Go, per decision #5/#18). Router still **mounted** (Go may use it);
|
| 296 |
+
the FE should not call it.
|
| 297 |
+
- **`check_data` / `check_knowledge`** β served by **Go**, not surfaced as Python FE endpoints.
|
| 298 |
+
- **Chat cache management** β `DELETE /chat/cache`, `/chat/cache/room/{id}`, `/retrieval/cache/{user_id}`
|
| 299 |
+
(ops/internal).
|
| 300 |
+
- **Phase-1 legacy routers** β `users`, `room`, `document`, `db_client`, `data_catalog`
|
| 301 |
+
(functionally migrated to Go; mostly dormant).
|
| 302 |
+
- **Health/root** β `GET /`, `GET /health` (liveness only).
|
| 303 |
+
|
| 304 |
+
---
|
| 305 |
+
|
| 306 |
+
## 8. Open items affecting this contract
|
| 307 |
+
|
| 308 |
+
1. **`/help` dispatch mechanism** β router-classify vs. forced-intent param (Β§4). *(DEV_PLAN #8/#18)*
|
| 309 |
+
2. **`/report` needs `enable_slow_path=true`** + a prior `structured_flow` question, else 409.
|
| 310 |
+
*(DEV_PLAN #15)*
|
| 311 |
+
3. **`analysis_records` home** post-`SKIP_INIT_DB` cutover β the report API depends on this table
|
| 312 |
+
existing. *(DEV_PLAN #14/#16)*
|
| 313 |
+
4. **Analysis-state writes** β once Go owns creation + state writes, Python's per-turn state
|
| 314 |
+
`ensure` becomes a read-only get (Go must guarantee the row exists before any chat turn).
|
| 315 |
+
*(DEV_PLAN #18)*
|
| 316 |
+
|
| 317 |
+
---
|
| 318 |
+
|
| 319 |
+
## 9. Appendix β complete endpoint inventory (all registered routes)
|
| 320 |
+
|
| 321 |
+
Every route mounted in [main.py](main.py), so task #8 can be decided against the full picture.
|
| 322 |
+
**32 routes** across 9 routers + 2 app-level. Status legend:
|
| 323 |
+
**β
FE-callable** (one of the 4 surfaces β keep) Β· **βοΈ comment out** (task #8 target) Β·
|
| 324 |
+
**π¦ legacy β Go** (Phase-1, functionally migrated; not FEβPython; mostly dormant) Β·
|
| 325 |
+
**βοΈ internal/ops**.
|
| 326 |
+
|
| 327 |
+
| Method | Path | Purpose | Router | Status |
|
| 328 |
+
|---|---|---|---|---|
|
| 329 |
+
| POST | `/api/v1/chat/stream` | Main chat SSE β **`call_agent`**; carries chat/help/check/structured/unstructured intents | Chat | β
FE-callable (#1, +help #3) |
|
| 330 |
+
| GET | `/api/v1/tools` | Slash-command catalog β **`list_skills`** (Go caches) | Tools | β
FE-callable (#2) |
|
| 331 |
+
| POST | `/api/v1/report` | Generate a report version | Report | β
FE-callable (#4) |
|
| 332 |
+
| GET | `/api/v1/report/{analysis_id}` | List report versions | Report | β
FE-callable (#4) |
|
| 333 |
+
| GET | `/api/v1/report/{analysis_id}/{version}` | Fetch one report version | Report | β
FE-callable (#4) |
|
| 334 |
+
| POST | `/api/v1/analysis/create` | Create session (state + room + bindings) | Analysis | βοΈ comment (#8 β Go) |
|
| 335 |
+
| GET | `/api/v1/analysis` | List a user's analyses | Analysis | βοΈ comment (#8) |
|
| 336 |
+
| GET | `/api/v1/analysis/{analysis_id}` | Get one session's state + sources | Analysis | βοΈ comment (#8) |
|
| 337 |
+
| DELETE | `/api/v1/chat/cache` | Clear one cached reply | Chat | βοΈ internal/ops |
|
| 338 |
+
| DELETE | `/api/v1/chat/cache/room/{room_id}` | Clear a room's cache | Chat | βοΈ internal/ops |
|
| 339 |
+
| DELETE | `/api/v1/retrieval/cache/{user_id}` | Clear a user's retrieval cache | Chat | βοΈ internal/ops |
|
| 340 |
+
| GET | `/` | Service status | (app) | βοΈ internal/ops |
|
| 341 |
+
| GET | `/health` | Liveness probe | (app) | βοΈ internal/ops |
|
| 342 |
+
| POST | `/api/login` | Login by email + password β οΈ mounted at `/api`, **not** `/api/v1` | Users | π¦ legacy β Go |
|
| 343 |
+
| GET | `/api/v1/documents/doctypes` | Supported document types | Documents | π¦ legacy β Go |
|
| 344 |
+
| GET | `/api/v1/documents/{user_id}` | List a user's documents | Documents | π¦ legacy β Go |
|
| 345 |
+
| POST | `/api/v1/document/upload` | Upload a document (10/min) | Documents | π¦ legacy β Go |
|
| 346 |
+
| DELETE | `/api/v1/document/delete` | Delete a document | Documents | π¦ legacy β Go |
|
| 347 |
+
| POST | `/api/v1/document/process` | Process / ingest a document | Documents | π¦ legacy β Go |
|
| 348 |
+
| GET | `/api/v1/rooms/{user_id}` | List a user's rooms | Rooms | π¦ legacy β Go |
|
| 349 |
+
| GET | `/api/v1/room/{room_id}` | Get one room | Rooms | π¦ legacy β Go |
|
| 350 |
+
| DELETE | `/api/v1/room/{room_id}` | Delete a room | Rooms | π¦ legacy β Go |
|
| 351 |
+
| POST | `/api/v1/room/create` | Create a room | Rooms | π¦ legacy β Go |
|
| 352 |
+
| GET | `/api/v1/data-catalog/{user_id}` | List catalog index | Data Catalog | π¦ legacy β Go |
|
| 353 |
+
| POST | `/api/v1/data-catalog/rebuild` | Rebuild a user's catalog | Data Catalog | π¦ legacy β Go |
|
| 354 |
+
| GET | `/api/v1/database-clients/dbtypes` | Supported DB types | Database Clients | π¦ legacy β Go |
|
| 355 |
+
| POST | `/api/v1/database-clients` | Create a DB connection | Database Clients | π¦ legacy β Go |
|
| 356 |
+
| GET | `/api/v1/database-clients/{user_id}` | List a user's DB connections | Database Clients | π¦ legacy β Go |
|
| 357 |
+
| GET | `/api/v1/database-clients/{user_id}/{client_id}` | Get one DB connection | Database Clients | π¦ legacy β Go |
|
| 358 |
+
| PUT | `/api/v1/database-clients/{client_id}` | Update a DB connection | Database Clients | π¦ legacy β Go |
|
| 359 |
+
| DELETE | `/api/v1/database-clients/{client_id}` | Delete a DB connection | Database Clients | π¦ legacy β Go |
|
| 360 |
+
| POST | `/api/v1/database-clients/{client_id}/ingest` | Build the catalog for a DB connection | Database Clients | π¦ legacy β Go |
|
| 361 |
+
|
| 362 |
+
**Tally:** 5 β
FE-callable Β· 3 βοΈ to comment (#8) Β· 19 π¦ legacyβGo Β· 5 βοΈ internal/ops.
|
| 363 |
+
|
| 364 |
+
**Task #8 reading:**
|
| 365 |
+
- **Keep exposed:** the 5 β
rows (`chat/stream`, `/tools`, the 3 `report` routes). `help` rides on
|
| 366 |
+
`chat/stream` β no route of its own.
|
| 367 |
+
- **Comment out (the #8 to-do):** the 3 `analysis` routes β analysis CRUD moves behind Go (#5/#18).
|
| 368 |
+
- **`check_data` is not an HTTP endpoint** β it's the `check` router intent (runs inside
|
| 369 |
+
`chat/stream`) plus its now-commented slash-catalog entry (KM-678); Go serves it to the FE. So
|
| 370 |
+
"comment check_data" = the catalog line (done) + don't expose a Python route (there isn't one).
|
| 371 |
+
- The 19 π¦ routers (`users`, `document`, `room`, `data_catalog`, `db_client`) are Phase-1 legacy,
|
| 372 |
+
already functionally in Go (REPO_STATUS Β§7). They're out of the FEβPython path but **still
|
| 373 |
+
mounted** β a separate cleanup from #8's analysis-CRUD scope.
|
DEV_PLAN.md
CHANGED
|
@@ -91,9 +91,9 @@ Status legend: β¬ not started Β· π in progress Β· β
done Β· β blocked Β·
|
|
| 91 |
| 7 | `report_id` state update via request to Go, not direct DB | Sofhia + Harry | β¬ | Needs Go endpoint. See #18 for the rest of the writes |
|
| 92 |
| 8 | Expose/confirm 4 FE endpoints; comment `check_data` + analysis CRUD | Sofhia | β
| KM-678: `list_tools` trimmed to `/help` + `/report` (analytics/check/retrieve commented in the **menu**). `help` confirmed as a `call_agent` intent β no own endpoint. Analysis CRUD endpoint left **registered**: "comment the rest" was about the FE slash menu, not killing HTTP routes Go needs |
|
| 93 |
| 9 | Verify `analysis_id` in `call_agent` contract | Sofhia | β
| Verified: no separate field β carried as `room_id` (`analysis_id == room_id`), per REPO_STATUS Β§4/Β§11. Action for Go: send the id as `room_id` |
|
| 94 |
-
| 10 | API endpoint doc (MD), 4 endpoints, for Go integration | Rifqi + Sofhia |
|
| 95 |
| 11 | Full Python project doc (MD β PDF/Word BRD) | Rifqi | β¬ | Reuse REPO_STATUS.md as the base |
|
| 96 |
-
| 12 | Reconcile/open the `list_tools` PR cleanly (stacked commits) | Rifqi |
|
| 97 |
| 13 | Merge HF Python build β test 4 endpoints via Swagger | Sofhia + Harry | β¬ | Not E2E. Blocked by #15 |
|
| 98 |
| 14 | `analysis_records` home | Rifqi + Sofhia + lead | β¬ β required | Records-based decided β no longer conditional; see #16 |
|
| 99 |
| 15 | Flip `ENABLE_SLOW_PATH=true` on HF + verify an `AnalysisRecord` persists from a `structured_flow` question | Rifqi | β¬ new | Precondition for any report demo (#13) |
|
|
|
|
| 91 |
| 7 | `report_id` state update via request to Go, not direct DB | Sofhia + Harry | β¬ | Needs Go endpoint. See #18 for the rest of the writes |
|
| 92 |
| 8 | Expose/confirm 4 FE endpoints; comment `check_data` + analysis CRUD | Sofhia | β
| KM-678: `list_tools` trimmed to `/help` + `/report` (analytics/check/retrieve commented in the **menu**). `help` confirmed as a `call_agent` intent β no own endpoint. Analysis CRUD endpoint left **registered**: "comment the rest" was about the FE slash menu, not killing HTTP routes Go needs |
|
| 93 |
| 9 | Verify `analysis_id` in `call_agent` contract | Sofhia | β
| Verified: no separate field β carried as `room_id` (`analysis_id == room_id`), per REPO_STATUS Β§4/Β§11. Action for Go: send the id as `room_id` |
|
| 94 |
+
| 10 | API endpoint doc (MD), 4 endpoints, for Go integration | Rifqi + Sofhia | β
| Done 2026-06-25 β `API_ENDPOINTS.md` (repo root). 4 FE surfaces with request/response **examples** (chat SSE transcript, report 201/409 JSON, version list), schemas, Β§9 full 32-route inventory + task-8 reading |
|
| 95 |
| 11 | Full Python project doc (MD β PDF/Word BRD) | Rifqi | β¬ | Reuse REPO_STATUS.md as the base |
|
| 96 |
+
| 12 | Reconcile/open the `list_tools` PR cleanly (stacked commits) | Rifqi | β
| N/A β we develop directly on the single active branch `pr/4` (KM-652 + KM-678 already stacked there); no separate PR to reconcile |
|
| 97 |
| 13 | Merge HF Python build β test 4 endpoints via Swagger | Sofhia + Harry | β¬ | Not E2E. Blocked by #15 |
|
| 98 |
| 14 | `analysis_records` home | Rifqi + Sofhia + lead | β¬ β required | Records-based decided β no longer conditional; see #16 |
|
| 99 |
| 15 | Flip `ENABLE_SLOW_PATH=true` on HF + verify an `AnalysisRecord` persists from a `structured_flow` question | Rifqi | β¬ new | Precondition for any report demo (#13) |
|