| 1 | # 🎬 Echo Director Agent |
| 2 | |
| 3 |  |
| 4 |  |
| 5 |  |
| 6 |  |
| 7 | |
| 8 | Echo Director Agent turns a story idea into a structured video workflow. It combines a conversational |
| 9 | agent, a visual production workspace, character-memory review, and a multi-shot generation pipeline. |
| 10 | The agent calls an independently deployed Echo 1.5 video service over HTTP. |
| 11 | |
| 12 | This repository contains the agent runtime, WebUI, workflow prompts, and long-video orchestration. It |
| 13 | does **not** bundle model weights or a hosted video-generation service. |
| 14 | |
| 15 | ## ✨ Highlights |
| 16 | |
| 17 | - 🎭 **Director workflow** — plan stories, edit shots, review results, regenerate, and merge a final cut. |
| 18 | - 🧠 **Visual memory** — select character references manually or using your favorite vlm. |
| 19 | - 🎞️ **One-click long video** — expand one idea into a planned, reviewed, multi-shot production. |
| 20 | - 🔌 **Service-based generation** — use an Echo-compatible HTTP service or local debug mode for development. |
| 21 | - 🗂️ **Local-first assets** — keep working files on disk and expose them through the local gateway. |
| 22 | - ☁️ **Optional S3 mapping** — publish only the files that an external service must access. |
| 23 | - 🖥️ **Integrated WebUI** — chat, story editing, shot control, reference selection, progress, and playback. |
| 24 | ## 🧭 Architecture |
| 25 | |
| 26 | ```text |
| 27 | ┌──────────────────────┐ |
| 28 | │ Browser / Echo WebUI │ |
| 29 | └──────────┬───────────┘ |
| 30 | │ HTTP + WebSocket |
| 31 | ▼ |
| 32 | ┌──────────────────────┐ ┌────────────────────────┐ |
| 33 | │ nanobot AgentLoop │──────▶│ Configured LLM / VLM │ |
| 34 | │ + Director tools │ │ provider │ |
| 35 | └──────────┬───────────┘ └────────────────────────┘ |
| 36 | │ |
| 37 | ├──────── HTTP ─────▶ Echo-compatible service |
| 38 | │ │ |
| 39 | │◀────── callback ────────┘ |
| 40 | ▼ |
| 41 | ┌──────────────────────┐ |
| 42 | │ Local workspace │ |
| 43 | │ stories · shots │ |
| 44 | │ memory · final media │ |
| 45 | └──────────────────────┘ |
| 46 | ``` |
| 47 | |
| 48 | The storage layer sits below the workflow. Director and memory code operate on logical asset URLs; |
| 49 | they do not contain vendor-specific bucket or endpoint logic. |
| 50 | |
| 51 | ## 🚀 Quick start |
| 52 | |
| 53 | ### Requirements |
| 54 | |
| 55 | - Python 3.11 or 3.12 |
| 56 | - [uv](https://docs.astral.sh/uv/) |
| 57 | - Node.js 20.19+ and npm |
| 58 | - `ffmpeg` |
| 59 | - An OpenAI-compatible LLM/VLM endpoint |
| 60 | - An Echo-compatible video service, unless you enable local debug mode |
| 61 | |
| 62 | ### Install |
| 63 | |
| 64 | ```bash |
| 65 | bash setup_local.sh |
| 66 | ``` |
| 67 | |
| 68 | The setup script installs Python and WebUI dependencies and creates `.config.local.json` from the |
| 69 | public example when needed. |
| 70 | |
| 71 | ### Configure |
| 72 | |
| 73 | Copy the local environment template and add your model API key: |
| 74 | |
| 75 | ```bash |
| 76 | cp .env.example .env |
| 77 | ``` |
| 78 | |
| 79 | `start_local.sh` loads `.env` automatically. Environment variables supplied by the caller take |
| 80 | precedence, so CI and one-off runs can override local defaults without editing files. |
| 81 | |
| 82 | Then edit `.config.local.json` and set at least: |
| 83 | |
| 84 | ```json |
| 85 | { |
| 86 | "agents": { |
| 87 | "defaults": { |
| 88 | "provider": "custom", |
| 89 | "model": "your-model-name", |
| 90 | "maxConcurrentRequests": 3 |
| 91 | } |
| 92 | }, |
| 93 | "providers": { |
| 94 | "custom": { |
| 95 | "apiKey": "${NANOBOT_MODEL_API_KEY}", |
| 96 | "apiBase": "https://llm.example.com/v1" |
| 97 | } |
| 98 | }, |
| 99 | "tools": { |
| 100 | "echoGenerator": { |
| 101 | "baseUrl": "http://127.0.0.1:8221", |
| 102 | "callbackBaseUrl": "http://127.0.0.1:18791" |
| 103 | }, |
| 104 | "memoryReview": { |
| 105 | "provider": "custom", |
| 106 | "model": "your-multimodal-model" |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | ``` |
| 111 | |
| 112 | The complete, secret-free template is in [`.config.local.example.json`](.config.local.example.json). |
| 113 | `${VARIABLE}` references are resolved at startup and fail clearly when the variable is missing. |
| 114 | |
| 115 | ### Run |
| 116 | |
| 117 | macOS, Linux, or Git Bash: |
| 118 | |
| 119 | ```bash |
| 120 | bash start_local.sh |
| 121 | ``` |
| 122 | |
| 123 | Windows Command Prompt: |
| 124 | |
| 125 | ```bat |
| 126 | start_local.cmd |
| 127 | ``` |
| 128 | |
| 129 | To override a value for one launch: |
| 130 | |
| 131 | ```bash |
| 132 | NANOBOT_MODEL_API_KEY="temporary-key" bash start_local.sh |
| 133 | ``` |
| 134 | |
| 135 | ```bat |
| 136 | set NANOBOT_MODEL_API_KEY=temporary-key && start_local.cmd |
| 137 | ``` |
| 138 | |
| 139 | Open [http://127.0.0.1:5187](http://127.0.0.1:5187). Runtime logs are written to: |
| 140 | |
| 141 | ```text |
| 142 | .local-runtime/gateway.log |
| 143 | .local-runtime/webui.log |
| 144 | ``` |
| 145 | |
| 146 | To run only the gateway: |
| 147 | |
| 148 | ```bash |
| 149 | uv run --extra api nanobot gateway \ |
| 150 | --config .config.local.json \ |
| 151 | --workspace .local-workspace \ |
| 152 | --debug |
| 153 | ``` |
| 154 | |
| 155 | ## ⚙️ Configuration |
| 156 | |
| 157 | ### Echo Director runtime |
| 158 | |
| 159 | Generic agent limits live under `agents.defaults`. Echo service connectivity lives under |
| 160 | `tools.echoGenerator`: |
| 161 | |
| 162 | ```json |
| 163 | { |
| 164 | "agents": { |
| 165 | "defaults": { |
| 166 | "maxConcurrentRequests": 3 |
| 167 | } |
| 168 | }, |
| 169 | "tools": { |
| 170 | "echoGenerator": { |
| 171 | "baseUrl": "http://127.0.0.1:8221", |
| 172 | "callbackBaseUrl": "http://127.0.0.1:18791" |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | ``` |
| 177 | |
| 178 | `maxConcurrentRequests` limits simultaneous agent turns (`0` means unlimited). Generation and merge |
| 179 | jobs are submitted to the configured Echo service and complete asynchronously through callbacks. |
| 180 | |
| 181 | This release enables the WebUI WebSocket channel and the Director callback channel in its public |
| 182 | configuration. Other channels inherited from the underlying nanobot framework are not configured or |
| 183 | used by default. |
| 184 | |
| 185 | ### Model providers |
| 186 | |
| 187 | All model credentials live under `providers`. Agent features reference a provider by name instead of |
| 188 | copying keys and endpoints into feature-specific sections. |
| 189 | |
| 190 | ```json |
| 191 | { |
| 192 | "providers": { |
| 193 | "custom": { |
| 194 | "apiKey": "${NANOBOT_MODEL_API_KEY}", |
| 195 | "apiBase": "https://llm.example.com/v1", |
| 196 | "extraHeaders": null |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | ``` |
| 201 | |
| 202 | `custom` supports OpenAI-compatible services. The underlying nanobot runtime also supports providers |
| 203 | such as OpenAI, Anthropic, OpenRouter, Gemini, Ollama, and other entries defined in |
| 204 | `nanobot/providers/registry.py`. |
| 205 | |
| 206 | ### Echo generation service |
| 207 | |
| 208 | ```json |
| 209 | { |
| 210 | "tools": { |
| 211 | "echoGenerator": { |
| 212 | "baseUrl": "http://127.0.0.1:8221", |
| 213 | "callbackBaseUrl": "http://127.0.0.1:18791", |
| 214 | "httpTimeoutSec": 30 |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | ``` |
| 219 | |
| 220 | | Field | Purpose | |
| 221 | | --- | --- | |
| 222 | | `baseUrl` | Root URL of the configured video-generation service. | |
| 223 | | `callbackBaseUrl` | Local Agent callback origin used by Echo Server for R2V and merge completion. | |
| 224 | | `httpTimeoutSec` | Per-request HTTP timeout. | |
| 225 | |
| 226 | For the standard local setup, `callbackBaseUrl` must point to the same host and port as |
| 227 | `channels.director_callback` (`http://127.0.0.1:18791` in the example config). The Agent does not |
| 228 | poll job status; Echo Server calls the operation-specific callback when work reaches a terminal state. |
| 229 | |
| 230 | The personal release does not send an `Authorization` header to the video service and exposes no |
| 231 | video-service token setting. |
| 232 | |
| 233 | ### Memory review |
| 234 | |
| 235 | ```json |
| 236 | { |
| 237 | "tools": { |
| 238 | "memoryReview": { |
| 239 | "enabled": true, |
| 240 | "autoApprove": false, |
| 241 | "candidateCount": 24, |
| 242 | "provider": "custom", |
| 243 | "model": "your-multimodal-model" |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | ``` |
| 248 | |
| 249 | The VLM route reuses `providers.<name>`. With `autoApprove: false`, the workflow pauses before the |
| 250 | next shot so the user can review the proposed Memory slots in the WebUI. |
| 251 | |
| 252 | Memory Workspace is a local asset workbench, not an automatic prompt attachment list: |
| 253 | |
| 254 | - Generated-shot candidates and local uploads share an editable text profile and provenance. |
| 255 | - Image uploads receive a short VLM profile when a VLM route is configured. Without one, the asset |
| 256 | remains available for manual use but is hidden from Agent recommendations until a profile is added. |
| 257 | - Audio can be uploaded separately and paired with an image in Build Memory. Audio profiles are |
| 258 | manual unless an ASR/audio-capable profiler is integrated; a visual VLM does not invent audio content. |
| 259 | - The Agent reads profiles and asset IDs only and writes `recommended_memory_slot_refs`. |
| 260 | - The user can reorder, add, remove, and pair assets. Applying the draft creates |
| 261 | `approved_memory_slots`, which is the complete Memory payload sent to R2V. |
| 262 | - `reference_shot_ids` remains narrative context and is never appended to approved Memory slots. |
| 263 | |
| 264 | ### Local-first file storage |
| 265 | |
| 266 | ```json |
| 267 | { |
| 268 | "tools": { |
| 269 | "fileStorage": { |
| 270 | "local": { |
| 271 | "directory": "director/assets", |
| 272 | "baseUrl": "http://127.0.0.1:8765", |
| 273 | "routePrefix": "/api/assets" |
| 274 | }, |
| 275 | "outbound": { |
| 276 | "backend": "inline" |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | ``` |
| 282 | |
| 283 | Assets are stored under the configured workspace by default. `inline` converts local assets to data |
| 284 | URIs only when they must be sent to an external service. |
| 285 | |
| 286 | For services that cannot accept inline media, configure an explicit S3-compatible mapping: |
| 287 | |
| 288 | ```json |
| 289 | { |
| 290 | "tools": { |
| 291 | "fileStorage": { |
| 292 | "outbound": { |
| 293 | "backend": "s3", |
| 294 | "s3": { |
| 295 | "endpointUrl": "https://s3.example.com", |
| 296 | "publicBaseUrl": "https://cdn.example.com/echo-assets", |
| 297 | "bucket": "echo-assets", |
| 298 | "region": "region-1", |
| 299 | "keyPrefix": "agent-assets", |
| 300 | "addressingStyle": "auto", |
| 301 | "accessKeyId": "${FILE_STORAGE_ACCESS_KEY_ID}", |
| 302 | "secretAccessKey": "${FILE_STORAGE_SECRET_ACCESS_KEY}", |
| 303 | "sessionToken": "" |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | ``` |
| 310 | |
| 311 | There are no built-in endpoints, buckets, credentials, or cloud-vendor preferences. Local originals |
| 312 | remain the source of truth. |
| 313 | |
| 314 | ## 🎥 Workflows |
| 315 | |
| 316 | ### Interactive Director |
| 317 | |
| 318 | ```text |
| 319 | idea → story → shot prompts → generation → asset extraction/profile → shot acceptance |
| 320 | → Agent Memory recommendation → Build Memory approval → next shot → merge |
| 321 | ``` |
| 322 | |
| 323 | The Director tools manage durable state in the workspace. Video jobs complete through the HTTP callback |
| 324 | channel, so long-running generation does not block the model conversation. |
| 325 | |
| 326 | ### Quick Film |
| 327 | |
| 328 | Quick Film is a mode of the same Director workflow, not a separate agent or model runtime. It marks |
| 329 | the session for automatic production and runs: |
| 330 | |
| 331 | ```text |
| 332 | idea → story → shot prompts → Echo generation → VLM memory review → approval → merge |
| 333 | ``` |
| 334 | |
| 335 | It reuses the Director workspace, provider configuration, memory pipeline, Echo HTTP client, callbacks, |
| 336 | and file storage. The WebUI only changes how much human approval the workflow requests. |
| 337 | |
| 338 | ## 🗃️ Workspace layout |
| 339 | |
| 340 | ```text |
| 341 | <workspace>/ |
| 342 | ├── director/ |
| 343 | │ ├── assets/ |
| 344 | │ └── works/<work_id>/ |
| 345 | │ ├── state.json |
| 346 | │ ├── story.md |
| 347 | │ ├── story_profile.json |
| 348 | │ ├── shots/ |
| 349 | │ ├── jobs/ |
| 350 | │ ├── memory/ |
| 351 | │ └── outputs/ |
| 352 | └── sessions/ |
| 353 | ``` |
| 354 | |
| 355 | ## 🛠️ Development |
| 356 | |
| 357 | Install development dependencies: |
| 358 | |
| 359 | ```bash |
| 360 | uv sync --extra api --extra dev |
| 361 | npm --prefix webui ci |
| 362 | ``` |
| 363 | |
| 364 | Run the checks: |
| 365 | |
| 366 | ```bash |
| 367 | uv run ruff check nanobot |
| 368 | npm --prefix webui run build |
| 369 | ``` |
| 370 | |
| 371 | The WebUI production build is copied to `nanobot/web/dist/` and can be served by the gateway at |
| 372 | `/webui/`. |
| 373 | |
| 374 | Python package builds run this WebUI build automatically. Building an sdist or wheel from source |
| 375 | therefore requires Node.js and npm; installing a prebuilt wheel does not. |
| 376 | |
| 377 | ## 🧱 Project layout |
| 378 | |
| 379 | ```text |
| 380 | . |
| 381 | ├── nanobot/ # Agent runtime, channels, tools, config, and memory |
| 382 | ├── pe/ # Prompt-engineering profiles and skills |
| 383 | ├── webui/ # React/Vite production workspace |
| 384 | ├── .config.local.example.json |
| 385 | ├── setup_local.sh |
| 386 | └── start_local.sh |
| 387 | ``` |
| 388 | |
| 389 | ## 🔐 Security |
| 390 | |
| 391 | - Keep `.config.local.json`, `.env`, workspace files, and runtime logs out of Git. |
| 392 | - Bind services to `127.0.0.1` unless remote access is intentional and protected. |
| 393 | - Configure a callback secret before exposing the callback channel. |
| 394 | - Keep `tools.exec.enable` off when shell access is unnecessary. |
| 395 | - Add external download domains explicitly; the default allow-list is empty. |
| 396 | - Use scoped, short-lived credentials for optional S3-compatible publishing. |
| 397 | |
| 398 | See [SECURITY.md](SECURITY.md) for reporting and deployment guidance. |
| 399 | |
| 400 | ## 📜 License & acknowledgements |
| 401 | |
| 402 | Echo Director Agent is released under the [MIT License](LICENSE). |
| 403 | |
| 404 | - We sincerely thank the [nanobot](https://github.com/HKUDS/nanobot) team for their excellent work, which provides the foundation for the general agent runtime. |
| 405 | - We thank [alexwang58](https://github.com/alexwang58), [oasis-cloud](https://github.com/oasis-cloud), and Weijie Wang for their efforts on this work. |
| 406 | - Echo video generation is provided by a separately deployed service and is not bundled here. |
| 407 | - Third-party notices are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). |
| 408 |