Make performance ads for Meta, TikTok and YouTube, named and iterated from results
Make performance ads, also called ad creatives or variants, at a steady weekly pace for Meta, TikTok and YouTube. Your agent keeps one master timeline per concept, makes each variant as a copy with a new hook, line or call to action, sizes it for each placement, and names every file by your scheme. Each week it reads your results sheet and proposes the next round.
This is ordinary ad work for a real product. The agent makes and names the files. You upload them, set budgets, and switch ads on in Ads Manager. The agent never touches a live ad, never changes a budget, and never publishes.
Use invideo for this when you want every variant to stay an editable timeline beside its master, so next week's change is a few edits and a free export, not a new video.
Quickest path
Set up your agent first with invideo for AI agents. Then give it this prompt.
Here are this week's results: ./results/week-44.csv. My masters are in<project-url>. Read the results, tell me which hooks and lines won, andpropose 12 new variants. After I approve the list, make each one as a copyof its master, in 9:16 and 4:5, named by my scheme, and export them all.In a chat app, you paste the results table into the chat. In a terminal, the agent reads the CSV from the folder you name.
What you need
The agent needs the masters, the scheme and the numbers.
- One master timeline per concept, already cut and approved.
- The variant list: hooks, lines, offers or calls to action to swap. The agent can propose them from your results.
- The placements: 9:16 for Reels, Stories, TikTok and Shorts, 4:5 or 1:1 for feeds, 16:9 for YouTube in-stream.
- Your naming scheme. One example: week, concept, hook, size, version, like
w44_c2_hookB_9x16_v1. - Your results sheet, exported from Ads Manager as CSV, with one row per ad name.
Steps
The agent works in rounds. Each round is one branch, so last week's ads stay as they were.
Read the results
The agent reads your CSV with its own file tools and matches each row to a file name. It sorts by the metric you name, like cost per purchase or hook rate. It tells you which hooks, lines and sizes won, and what it proposes next. You see the ranked list; nothing in invideo changes.
Open this week's round on a branch
The agent reads the master with
get_timelineand creates a branch withtimeline_historyactioncreate_branch, named for the week. It sees the branch URL.Copy the master once per variant
The agent runs
duplicate_timelinewith anamethat matches the file name. The copies share nothing with the master. It sees one new timeline id per variant.Change what the variant tests
For a new hook line, the agent runs
set_texton the hook's text clip. For a new opening shot, it usesplace_mediamodereplace. It sees a newstate_token.Generate a shot the variant needs
The agent runs
find_modelswith the job in words, picks one, and reads its inputs withget_model. A good pick isseedance_2_5.frames. It callsgeneratewithdry_run: trueand tells you the price. Then it callsgeneratewithmax_creditsset to that price and anidempotency_key. It sees a sequence URL, reads it withread, and places it withplace_media.Size each placement
The agent sets the canvas with
set_timeline_settingsand fixes each clip withfill_frameandset_position. It adds safe zone lines withcreate_guide, from the platform's spec page, and moves text inside them. The page Resize one master ad for every placement, with safe zones has the details. It sees the new canvas inget_timeline.Check every variant, then export
The agent calls
captureon each timeline at the hook, the middle and the call to action, and runscheck_timeline. Then it runsexportonce per timeline, withtimeline_id,file_nameset to the scheme name and anidempotency_key. It sees one export card per variant, each with statuscompleted, and gives you the list of names.
The terminal version, for one variant:
invideo agent register <project-url> --name <name>export INVIDEO_AS=<name>invideo edit show <edit-url> --jsoninvideo branch new <edit-url> --name w44 --token <state_token>invideo edit show <branch-url> --jsoninvideo edit change <branch-url> --timeline T1 --token <state_token> \ --operations @copy-master.jsoninvideo gen models <project-url> --query "short product shot for an ad"invideo gen model <project-url> --model seedance_2_5.framesinvideo gen run <page-url> --model seedance_2_5.frames --dry-run \ -i prompt="hand pours cold brew over ice" -i aspect_ratio=9:16 -i duration=5invideo gen run <page-url> --model seedance_2_5.frames \ --max-credits <price> --idempotency-key w44-c2-b-shot \ -i prompt="hand pours cold brew over ice" -i aspect_ratio=9:16 -i duration=5invideo edit show <branch-url> --jsoninvideo edit change <branch-url> --timeline T7 --token <state_token> \ --operations @hookB.jsoninvideo edit capture <branch-url> --timeline T7 --at 0.5,3,14 \ --out ./framesinvideo edit export <branch-url> --format video --quality 1080 \ --timeline T7 --file-name w44_c2_hookB_9x16_v1 --idempotency-key w44-c2-b \ --jsoninvideo status <card-url> --waitinvideo notebook show <card-url> --out ./adsmv ./ads/export.mp4 ./ads/w44_c2_hookB_9x16_v1.mp4Where the values come from: <edit-url> from invideo edit new, <project-url> from invideo project new, <name> from your choice in invideo agent register, and <page-url> from invideo notebook show <project-url>. <state_token> comes from the first invideo edit show, then from invideo edit show on the branch, read again before each change, because the main token is stale there. <branch-url> is the branch_url that invideo branch new returns. <price> is the dry run's estimated_credits. <card-url> is .sequences[0] of what the export returns. invideo status does not download, so invideo notebook show saves the file, always as export.mp4, and the agent renames it. A voice line works the same way with elevenlabs_text_to_speech.elevenlabs_tts_v4, -i prompt= and -i voice_id=.
The two ops files are bare lists. The first, copy-master.json, runs on the master T1 and copies it. The second, hookB.json, runs on the copy T7 and changes the hook. The copy's id T7 and the hook clip's id c14 come from invideo edit show on the branch.
[ { "op": "duplicate_timeline", "timeline": "T1", "name": "w44_c2_hookB_9x16_v1" }][ { "op": "set_text", "clip": "c14", "text": "Cold brew in 30 seconds. No machine." }]Cost and time
Edits and exports are free. Generation and transcripts cost credits. Paid stock costs a small credit charge, or one of your workspace's iStock licenses. Your agent runs a dry run first and tells you the price before it spends anything.
- Costs credits: a new generated shot, a new voice line, paid stock.
- Free: copies, text swaps, resizing, guides,
captureand everyexport.
A variant that only swaps text and size takes a few minutes. Run a big round in parts, a few variants at a time, and check each part before the next. See Credits for prices.
If something goes wrong
Most problems come from a stale token or a name that does not match the sheet.
| Symptom | Fix |
|---|---|
get_model or generate refuses the model as not found | Models retire. Run find_models with the job in words, use the best match, and tell the person which model you used. |
Exit code 6, or status is held | A safety review, not a refusal. Wait, then run invideo status <url> --wait again. Do not resend. If it ends failed, change the input the review flagged. |
| The download folder is empty | invideo status does not download. Run invideo notebook show <card-url> --out ./ads with the card URL from .sequences[0]. |
| The variant needs a new voice line | Make it with elevenlabs_text_to_speech.elevenlabs_tts_v4 and a voice_id from search_library in elevenlabs_text_to_speech_voices, priced and run the same way as a shot. |
The saved file is export.mp4, not the scheme name | file_name does not name the saved file. Rename it to the scheme name after the download. |
| CLI exit 3 | The edit changed since your read. Run invideo edit show on the URL you edit, the branch URL on a branch, and rebuild the ops with the new token. |
| A result row matches no file | The ad was renamed in Ads Manager. Ask the person for the mapping. Do not guess. |
| Two exports have the same name | Add the version to file_name. Each name in the scheme must be unique. |
| Text sits under the TikTok buttons | Move it inside the guides with set_position, and capture again. |
| An export never finishes | read the card or run invideo status --wait. Do not call export again. |
| Avoid: editing the master for a variant | Instead: duplicate_timeline, and change the copy. |
| Avoid: changing an ad that is live | Instead: make a new variant with a new version number. The person swaps it in Ads Manager. |
| Avoid: claiming a variant will win | Instead: report what the numbers say and how many results each row has. |
Prompts to try
Each prompt is a real variation of this job.
Hook B beat hook A on every concept. Make hook B versions of the threeconcepts that don't have one, in 9:16 and 4:5, version 1.Make 5 call-to-action variants of concept 2: "Shop now", "Try it free","See flavors", "Get 2 cans", "Order now". 9:16 only.List every variant made in October with its name, its master, and whatit changed. Put it in a brief note so the team can see it.When to use something else
invideo does not read Ads Manager, place ads, or set budgets. Export your results from Meta Ads Manager, TikTok Ads Manager or Google Ads as a CSV, and upload the finished files there yourself. For automatic creative testing inside a platform, use the platform's own tools, like Meta's Advantage+ creative options. For a shared tracker of names and results, use a spreadsheet.