anygen/agent-harness/ANYGEN.md
AnyGen is a cloud-based asynchronous content generation platform that produces professional slides (PPT), documents (DOCX), websites, storybooks, diagrams (SmartDraw), and data analysis reports via a REST API. Unlike local GUI targets, AnyGen runs entirely server-side — the CLI submits tasks, polls for completion, and downloads generated files.
┌──────────────────────────────────────────────────┐
│ AnyGen Cloud Service │
│ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Slide │ │ Doc │ │ SmartDraw │ │
│ │ Engine │ │ Engine │ │ Engine │ │
│ └────┬─────┘ └────┬─────┘ └────────┬─────────┘ │
│ ┌────┘ ┌─────────┘ ┌─────────────┘ │
│ │ ┌────┴────┐ ┌─────┴─────┐ ┌───────────────┐ │
│ │ │ Website │ │ Storybook │ │ Data Analysis │ │
│ │ │ Engine │ │ Engine │ │ Engine │ │
│ │ └────┬────┘ └─────┬─────┘ └───────┬───────┘ │
│ │ │ │ │ │
│ ┌───────┴─────────────┴───────────────┴───────┐ │
│ │ Task Orchestration Layer │ │
│ │ Async queue · status tracking · file store │ │
│ └──────────────────┬──────────────────────────┘ │
│ │ │
│ ┌──────────────────┴──────────────────────────┐ │
│ │ REST API (OpenAPI 3.1) │ │
│ │ POST /v1/openapi/tasks │ │
│ │ GET /v1/openapi/tasks/:id │ │
│ │ POST /v1/openapi/files/upload │ │
│ │ POST /v1/openapi/tasks/prepare │ │
│ └──────────────────┬──────────────────────────┘ │
└─────────────────────┼────────────────────────────┘
│ HTTPS + Bearer sk-…
┌────────────┴─────────────┐
│ cli-anything-anygen │
│ Click CLI + REPL │
│ JSON / human output │
└──────────────────────────┘
AnyGen differs from local GUI targets — there is no local software to invoke. The CLI acts as a structured HTTP client wrapping the AnyGen OpenAPI:
GET /v1/openapi/tasks/:id
at a configurable interval (default 3 s, max 20 min) until completed or failed.POST /v1/openapi/files/upload
to get a file_token for use in task creation.POST /v1/openapi/tasks/prepare enables multi-turn
requirement analysis before creating a task.task run command that orchestrates the full lifecycle.--json output lets agents parse task IDs, statuses, and file paths.Base URL: https://www.anygen.io
Auth: Bearer token (sk-…) via Authorization header.
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/openapi/tasks | Create a new generation task |
| GET | /v1/openapi/tasks/:id | Query task status and metadata |
| POST | /v1/openapi/files/upload | Upload a reference file → file_token |
| POST | /v1/openapi/tasks/prepare | Multi-turn requirement analysis |
{
"auth_token": "Bearer sk-xxx",
"operation": "slide",
"prompt": "Create a quarterly business review presentation",
"language": "en-US",
"slide_count": 10,
"template": "business",
"ratio": "16:9",
"export_format": "pptx",
"file_tokens": ["tk_abc123"],
"files": []
}
{
"task_id": "task_xxx",
"status": "completed",
"progress": 100,
"output": {
"file_url": "https://...",
"file_name": "presentation.pptx",
"thumbnail_url": "https://...",
"task_url": "https://www.anygen.io/task/task_xxx",
"slide_count": 10,
"word_count": 2500
}
}
The CLI persists task metadata locally for history and replay:
{
"version": "1.0",
"task_id": "task_xxx",
"operation": "slide",
"prompt": "Create a quarterly business review presentation",
"status": "completed",
"created_at": "2026-03-09T12:00:00Z",
"completed_at": "2026-03-09T12:01:23Z",
"output": {
"file_url": "https://...",
"file_name": "presentation.pptx",
"task_url": "https://www.anygen.io/task/task_xxx"
},
"local_file": "./output/presentation.pptx",
"metadata": {
"file_size": 2048576
}
}
| Operation | API Value | Output Format | Downloadable File |
|---|---|---|---|
| Slides / PPT | slide | PPTX | Yes |
| Documents / DOCX | doc | DOCX | Yes |
| SmartDraw | smart_draw | drawio / excalidraw | Yes |
| General / Chat | chat | — | No (task URL) |
| Storybook | storybook | — | No (task URL) |
| Data Analysis | data_analysis | — | No (task URL) |
| Website | website | — | No (task URL) |
| Agent Action | CLI Command |
|---|---|
| Create a slide deck | task create --operation slide --prompt "..." -o task.json |
| Create a document | task create --operation doc --prompt "..." -o task.json |
| Draw a diagram | task create --operation smart_draw --prompt "..." -o task.json |
| Full workflow (create→poll→download) | task run --operation slide --prompt "..." --output ./ |
| Check task status | task status <task-id> |
| Poll until completion | task poll <task-id> [--output ./] |
| Download result file | task download <task-id> --output ./ |
| Download thumbnail | task thumbnail <task-id> --output ./ |
| Upload a reference file | file upload <path> |
| Multi-turn requirement analysis | task prepare --message "..." [--save conv.json] |
| Configure API key | config set api_key sk-xxx |
| View configuration | config get [key] |
| View task history | session history |
| Undo last operation | session undo |
| Parameter | Short | Description | Required |
|---|---|---|---|
| --operation | -o | Operation type (slide/doc/smart_draw/chat/...) | Yes |
| --prompt | -p | Content description | Yes |
| --language | -l | zh-CN / en-US | No |
| --slide-count | -c | Number of PPT pages (slide only) | No |
| --template | -t | PPT template (slide only) | No |
| --ratio | -r | 16:9 / 4:3 (slide only) | No |
| --export-format | -f | pptx/image/thumbnail/docx/drawio/excalidraw | No |
| --file-token | File token from upload (repeatable) | No | |
| --style | -s | Style preference | No |
The CLI reads the API key from (in priority order):
--api-key CLI optionANYGEN_API_KEY environment variable~/.config/anygen/config.json fileFor AnyGen CLI, "rendering" is server-side generation. The CLI orchestrates:
file_urlUnit tests (test_core.py): Mock HTTP responses, no real API calls
E2E tests (test_full_e2e.py): Real API calls (require ANYGEN_API_KEY)
_resolve_cli