Spaces:
Sleeping
Sleeping
Commit ·
bcd9d5d
1
Parent(s): 7f50e50
docs: document site template architecture and APIs
Browse files- add architecture notes for backend/app/sites layer
- document agent template-awareness behavior
- add /api/sites endpoint usage examples in API docs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- docs/agents.md +10 -1
- docs/api.md +21 -0
- docs/architecture.md +18 -0
docs/agents.md
CHANGED
|
@@ -27,6 +27,7 @@ Explores pages and search results:
|
|
| 27 |
- URL prioritization
|
| 28 |
- Link traversal policy
|
| 29 |
- Page relevance scoring
|
|
|
|
| 30 |
|
| 31 |
### 3. Extractor Agent
|
| 32 |
|
|
@@ -66,11 +67,19 @@ Cons: weaker specialization.
|
|
| 66 |
Coordinator delegates work:
|
| 67 |
|
| 68 |
1. Planner emits execution graph
|
| 69 |
-
2. Navigator discovers candidate pages
|
| 70 |
3. Extractor parses and emits data
|
| 71 |
4. Verifier validates outputs
|
| 72 |
5. Memory Agent stores reusable patterns
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
Pros: modular, robust, scalable.
|
| 75 |
Cons: coordination overhead.
|
| 76 |
|
|
|
|
| 27 |
- URL prioritization
|
| 28 |
- Link traversal policy
|
| 29 |
- Page relevance scoring
|
| 30 |
+
- Site-template lookup (`/api/sites/match`) for domain-specific guidance
|
| 31 |
|
| 32 |
### 3. Extractor Agent
|
| 33 |
|
|
|
|
| 67 |
Coordinator delegates work:
|
| 68 |
|
| 69 |
1. Planner emits execution graph
|
| 70 |
+
2. Navigator discovers candidate pages and loads site templates
|
| 71 |
3. Extractor parses and emits data
|
| 72 |
4. Verifier validates outputs
|
| 73 |
5. Memory Agent stores reusable patterns
|
| 74 |
|
| 75 |
+
## Site Template Awareness
|
| 76 |
+
|
| 77 |
+
Agents can reference inbuilt templates from `backend/app/sites/`:
|
| 78 |
+
|
| 79 |
+
- Planner resolves template context early (site id, strategy, output fields)
|
| 80 |
+
- Navigator refreshes template context per URL
|
| 81 |
+
- Execution steps include template provenance (`site_template` action)
|
| 82 |
+
|
| 83 |
Pros: modular, robust, scalable.
|
| 84 |
Cons: coordination overhead.
|
| 85 |
|
docs/api.md
CHANGED
|
@@ -898,4 +898,25 @@ async for chunk in api.generate_stream(prompt="...", model="claude-3-5-sonnet"):
|
|
| 898 |
|
| 899 |
---
|
| 900 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 901 |
**Next:** See [mcp.md](./mcp.md) for MCP server integration.
|
|
|
|
| 898 |
|
| 899 |
---
|
| 900 |
|
| 901 |
+
## Site Template APIs
|
| 902 |
+
|
| 903 |
+
The backend now exposes inbuilt site templates for agent orchestration:
|
| 904 |
+
|
| 905 |
+
- `GET /api/sites`
|
| 906 |
+
Returns full template catalog (50+ domains).
|
| 907 |
+
- `GET /api/sites/{site_id}`
|
| 908 |
+
Returns one template definition.
|
| 909 |
+
- `POST /api/sites/match`
|
| 910 |
+
Resolves best template from `instructions` + `assets`.
|
| 911 |
+
|
| 912 |
+
Example:
|
| 913 |
+
|
| 914 |
+
```bash
|
| 915 |
+
curl -X POST http://localhost:8000/api/sites/match \
|
| 916 |
+
-H "Content-Type: application/json" \
|
| 917 |
+
-d "{\"instructions\":\"get trending communities\",\"assets\":[\"https://reddit.com\"]}"
|
| 918 |
+
```
|
| 919 |
+
|
| 920 |
+
---
|
| 921 |
+
|
| 922 |
**Next:** See [mcp.md](./mcp.md) for MCP server integration.
|
docs/architecture.md
CHANGED
|
@@ -69,6 +69,15 @@ Responsibilities:
|
|
| 69 |
- lazy installation
|
| 70 |
- composition workflows
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
### 4. Data Plane
|
| 73 |
|
| 74 |
Responsibilities:
|
|
@@ -127,6 +136,15 @@ Task queue supports:
|
|
| 127 |
- Logs/metrics: append-only time-series-friendly sink
|
| 128 |
- Exports: JSON/CSV trace packs
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
## Reliability
|
| 131 |
|
| 132 |
- per-tool timeout and retry
|
|
|
|
| 69 |
- lazy installation
|
| 70 |
- composition workflows
|
| 71 |
|
| 72 |
+
### 3.5 Site Template Layer
|
| 73 |
+
|
| 74 |
+
Responsibilities:
|
| 75 |
+
|
| 76 |
+
- maintain inbuilt domain templates (`backend/app/sites/`)
|
| 77 |
+
- map instructions/assets to known site behavior
|
| 78 |
+
- provide reusable navigation goals/fields for planner and navigator agents
|
| 79 |
+
- expose template catalog through `/api/sites*` endpoints
|
| 80 |
+
|
| 81 |
### 4. Data Plane
|
| 82 |
|
| 83 |
Responsibilities:
|
|
|
|
| 136 |
- Logs/metrics: append-only time-series-friendly sink
|
| 137 |
- Exports: JSON/CSV trace packs
|
| 138 |
|
| 139 |
+
## Backend Folder Notes (Template System)
|
| 140 |
+
|
| 141 |
+
```text
|
| 142 |
+
backend/app/sites/
|
| 143 |
+
- models.py # SiteTemplate dataclass
|
| 144 |
+
- templates.py # 50+ inbuilt site templates
|
| 145 |
+
- registry.py # list/get/match/serialize helpers
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
## Reliability
|
| 149 |
|
| 150 |
- per-tool timeout and retry
|