Manim Agent
Use this skill to run the full Manim Agent production workflow, not a simplified one-off Manim snippet. Locate the local repository from MANIM_AGENT_HOME, the current workspace, or a user-provided path; if it is missing, clone https://github.com/gqy20/manim-agent.git before running project commands.
Operating Mode
- Clarify the requested output only when needed: topic, target duration, audience, voice/TTS need, quality level, and final file path.
- Run
scripts/check_manim_agent_env.pybefore the first real render in a session, or whenever a failure suggests missing dependencies. - Prefer the CLI path for direct video delivery. Use the Web path only when the user asks for task history, SSE progress, browser UI, or backend persistence.
- Preserve the repository pipeline: planning, implementation, render resolution/review, narration, TTS, and mux. Do not replace it with a handmade
scene.pyunless the user explicitly asks for a raw Manim scene. - Produce concrete artifacts: final MP4, generated scene/code location, logs or error summary, and the command used.
Required Interfaces
- A language-model interface is required for normal pipeline runs. Manim Agent uses Claude Agent SDK to plan scenes and write or fix Manim code; Manim and FFmpeg alone are not enough.
- A working local runtime is required before generation: Python 3.12+,
uv, Manim, FFmpeg,claude-agent-sdk, andhttpx. Runscripts/check_manim_agent_env.pyinstead of guessing. - The LLM interface uses Aliyun DashScope / Bailian Model Studio through the Claude Code compatible route (
https://dashscope.aliyuncs.com/apps/anthropic) and a supported model such asqwen3.7-plus. The OpenAI-compatible route is not the right path for this repository's SDK flow. - These qwen models run in hybrid/extended-thinking mode by default on this route; there is no separate "-nothinking" model id. The repo keeps thinking enabled by default for release-quality generations. Use
MANIM_AGENT_THINKING_MODE=disabledonly for low-latency smoke tests or when diagnosing provider latency. - If Phase 1 fails before rendering, check the LLM provider first: expired plan, invalid model name, missing auth token, or incompatible structured-output behavior.
- TTS is optional. Use
--no-ttsfor smoke tests. For narrated output, configure DashScope CosyVoice withDASHSCOPE_API_KEY; do not expect the skill package to contain an API key. Apply for a DashScope/Bailian API key athttps://help.aliyun.com/zh/model-studio/get-api-key. - The speech route is Aliyun DashScope CosyVoice. Default model:
cosyvoice-v3-flash; default voice:longanyang. The adapter downloads the returned audio URL and measures real duration before muxing. - Database and R2 credentials are not required for direct CLI MP4 generation; they are only needed for the Web/backend persistence path.
Reference Routing
- Read
references/repo-runtime.mdfor installation, environment variables, CLI/Web commands, ports, and local paths. - Read
references/pipeline-workflow.mdbefore running or explaining the end-to-end pipeline. - Read
references/production-quality.mdbefore generating or reviewing teaching animation content. - Read
references/recovery-and-review.mdwhen a render, structured output, TTS, mux, or frontend/backend task fails.
Default CLI Pattern
From the local manim-agent repository:
uv run python -m manim_agent "解释傅里叶变换的核心直觉" --target-duration 30 --quality high --no-tts -o outputs/fourier.mp4
Use --no-tts for the first smoke run unless the user explicitly wants narration and a supported TTS key is available. For production narration:
uv run python -m manim_agent "证明勾股定理" --target-duration 30 --quality high --voice longanyang -o outputs/pythagorean.mp4
Default runs do not enable independent AI frame review. Add --render-review only when the user asks for strict visual review, release QA, frame-by-frame inspection, or when a previous render showed overlap, cropping, unreadable math, or other visual risk:
uv run python -m manim_agent "证明勾股定理" --target-duration 30 --quality high --voice longanyang --render-review -o outputs/pythagorean_reviewed.mp4
Delivery Rules
- State whether the run used no-TTS, TTS, render review, intro/outro, full render, or segment render.
- Never claim the video is ready until the MP4 path exists and is readable.
- If a dependency is missing, report the exact missing dependency and the next command to fix it.
- If a secret is provided in chat, use it only for the current run when necessary; do not write it into this skill, logs, examples, or user-visible output.
- If the user asks for a packaged skill or reusable workflow, update this skill rather than scattering notes into the repository.
- Do not expose API keys, database URLs, R2 credentials, or
.envvalues in responses.
Local Repo Awareness
The upstream repo already contains a production plugin at plugins/manim-production/ with scene planning, scene building, layout safety, narration sync, render review, and intro/outro rules. Reuse those rules when working inside the repo. This Codex skill is the stable outer entrypoint: it decides when to invoke the repo, which path to run, what checks to perform, and what evidence to return.
Scan to join WeChat group