Spaces:
Sleeping
Sleeping
File size: 6,797 Bytes
cc1daf4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | # Multi-Agent Content Generation System - API Endpoints
**Base URL:** `http://localhost:7860`
**Port:** `7860` (all agents on single port)
---
## Health & Status
### Health Check
```
GET /health
```
Returns system health status and current run ID.
**Response:**
```json
{
"status": "healthy",
"run_id": "uuid",
"port": 7860
}
```
### Root Endpoint
```
GET /
```
Returns API information and available endpoints.
---
## Pipeline Endpoints
### Execute Full Pipeline
```
POST /api/pipeline/execute
```
Execute the complete 7-stage content generation pipeline.
**Request Body:**
```json
{
"user_brief": "string",
"season_arc_document": "string",
"character_bible": "string",
"world_building_document": "string",
"character_voice_guide": "string",
"style_guide": "string",
"continuity_log": "string",
"hook_brief": "string (optional)"
}
```
**Response:**
```json
{
"run_id": "uuid",
"status": "success",
"final_output": { ... },
"hf_output_url": "https://huggingface.co/...",
"hf_metadata_url": "https://huggingface.co/..."
}
```
### Get Pipeline Status
```
GET /api/pipeline/status/{run_id}
```
Get the status and state of a specific pipeline run.
**Response:**
```json
{
"run_id": "uuid",
"status": "completed|failed|running",
"pipeline_state": { ... }
}
```
---
## Agent Endpoints
All agents run on port 7860 with dedicated endpoints.
### 1. Showrunner Agent
```
POST /api/agents/showrunner
```
Generate episode directive from user brief.
**Input:**
```json
{
"user_brief": "string",
"season_arc_document": "string",
"character_bible": "string"
}
```
**Output:**
```json
{
"episode_directive": "string",
"story_premise": "string",
"tone_brief": "string",
"character_focus_notes": "string"
}
```
---
### 2. Story Editor Agent
```
POST /api/agents/story-editor
```
Generate episode outline from directive.
**Input:**
```json
{
"episode_directive": "string",
"series_continuity_log": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"]
}
```
**Output:**
```json
{
"episode_outline": "string",
"act_structure": "string",
"story_notes_for_writers": "string"
}
```
---
### 3. Cultural Consultant Agent
```
POST /api/agents/cultural-consultant
```
Review outline for cultural accuracy.
**Input:**
```json
{
"episode_outline": "string",
"world_building_document": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"]
}
```
**Output:**
```json
{
"cultural_accuracy_notes": "string",
"flagged_inaccuracies": ["issue1", "issue2"],
"approved_touchpoints": ["touchpoint1"],
"reference_suggestions": ["suggestion1"]
}
```
---
### 4. Lead Writer Agent
```
POST /api/agents/lead-writer
```
Write episode script from outline and cultural notes.
**Input:**
```json
{
"approved_outline": "string",
"cultural_consultant_notes": "string",
"character_voice_guide": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"],
"story_premise": "string"
}
```
**Output:**
```json
{
"full_episode_first_draft": "string",
"scene_descriptions": "string",
"dialogue": "string",
"stage_directions": "string"
}
```
---
### 5. Dialogue Specialist Agent
```
POST /api/agents/dialogue-specialist
```
Polish dialogue in the script.
**Input:**
```json
{
"first_draft_script": "string (must not be empty)",
"character_voice_guide": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"],
"dialect_slang_reference": "string"
}
```
**Output:**
```json
{
"dialogue_polished_script": "string",
"voice_consistency_notes": "string"
}
```
---
### 6. Comedy Writer Agent
```
POST /api/agents/comedy-writer
```
Add humor and punch-ups to the script.
**Input:**
```json
{
"dialogue_polished_script": "string (must not be empty)",
"hook_brief_from_showrunner": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"],
"tone_brief": "string"
}
```
**Output:**
```json
{
"comedy_sharpened_script": "string",
"punch_up_notes": "string",
"hook_rewrite_for_opening": "string"
}
```
---
### 7. Proofreader Agent
```
POST /api/agents/proofreader
```
Final quality control on the script.
**Input:**
```json
{
"comedy_sharpened_script": "string (must not be empty)",
"style_guide": "string",
"continuity_log": "string",
"character_list": ["Alex", "Jordan", "Casey", "Morgan"]
}
```
**Output:**
```json
{
"final_locked_script": "string",
"qc_report": {
"issues": [],
"style_alignment": "string",
"character_consistency": "string",
"formatting_notes": "string",
"recommendations": []
},
"continuity_log_update": "string"
}
```
---
## API Usage Examples
### Example 1: Execute Full Pipeline
```bash
curl -X POST http://localhost:7860/api/pipeline/execute \
-H "Content-Type: application/json" \
-d '{
"user_brief": "A tech startup launches a new app",
"season_arc_document": "Season 1: The Rise",
"character_bible": "Alex (CEO), Jordan (CTO), Casey (Designer), Morgan (Marketer)",
"world_building_document": "Modern Silicon Valley",
"character_voice_guide": "Alex: sarcastic, Jordan: technical, Casey: perfectionist, Morgan: optimistic",
"style_guide": "Fast-paced, comedic, tech satire",
"continuity_log": "Episode 1: Team formation, Episode 2: First failure, Episode 3: Launch day"
}'
```
### Example 2: Call Individual Agent
```bash
curl -X POST http://localhost:7860/api/agents/showrunner \
-H "Content-Type: application/json" \
-d '{
"user_brief": "A tech startup launches a new app",
"season_arc_document": "Season 1: The Rise",
"character_bible": "Alex (CEO), Jordan (CTO), Casey (Designer), Morgan (Marketer)"
}'
```
### Example 3: Check Pipeline Status
```bash
curl -X GET http://localhost:7860/api/pipeline/status/0e35979c-8240-4451-a693-6bed1516aa4d
```
---
## Error Handling
All endpoints return appropriate HTTP status codes:
- **200 OK** - Successful request
- **400 Bad Request** - Invalid input
- **404 Not Found** - Resource not found
- **500 Internal Server Error** - Server error
Error responses include a detail message:
```json
{
"detail": "Error message explaining what went wrong"
}
```
---
## Documentation
- **Interactive API Docs:** `http://localhost:7860/docs` (Swagger UI)
- **Alternative Docs:** `http://localhost:7860/redoc` (ReDoc)
---
## Architecture
```
Port 7860 (Single Port)
βββ /health
βββ /
βββ /api/pipeline/
β βββ execute
β βββ status/{run_id}
βββ /api/agents/
βββ showrunner
βββ story-editor
βββ cultural-consultant
βββ lead-writer
βββ dialogue-specialist
βββ comedy-writer
βββ proofreader
```
All agents communicate through the orchestrator and share state via the pipeline.
|