Skip to main content

What a routine is

A routine is a scheduled agent run on your side: Claude Code, Codex or Cursor wakes up on a timer you set, opens the Lavendly MCP server and makes a video. Lavendly does the making and the posting (generate, render, publish to your channel). The schedule itself lives in your agent, not in Lavendly. Lavendly schedules posts (schedule_video), never agent runs.

Your template is a film you already like

Make one film by hand, in the Studio or with your agent, until you are happy with it. That film is the template. It holds everything that should stay the same: the look, the music, the structure, the scenes that never change (an intro, a product shot, a sign-off). Each run copies the template and changes only two things: the subject and the hook. Today it is cold brew, tomorrow matcha, the day after oat milk. Same channel, same feel, a new video every day. Two rules make this cheap and safe:
  • A scene that already has a clip is reused and never charged. Only the scenes you change get generated, so a run usually costs one or two clips.
  • The template is never edited by the run. The run makes a new film from a copy, so tomorrow starts from the same template.
To change the series, change the template. Swap the music, tighten the intro, try a new opening shot: the next run picks it up, because every run reads the template fresh.

Example: a daily coffee short

A 3-scene vertical short for a coffee channel. Scene 1 is a hook about the day’s drink (generated), scene 2 is the same pour shot every day (reused), scene 3 is the brand sign-off (reused). One music track runs across the film.

1. Set up once

Find the two ids the routine needs, by asking your agent once:
  • the template film: list_workflows, then note the id of “Coffee daily (template)”
  • the channel: list_channels, then note the id of your TikTok channel
Use the hosted MCP endpoint. A scheduled run in the cloud cannot start a local npx server.

2. Give Claude Code the schedule

Run /schedule in Claude Code (or create a routine on the Routines page of Claude Code on the web), with the Lavendly connector attached, and paste:
That prompt is the whole routine. Setting it up with a channel and a credit cap is your yes to posting: the run does not stop to ask.

3. What the run does

Budget

  • estimate_cost first, every run. The routine stops before spending if the price is over your cap or your balance is short.
  • max_credits on every spending call. The server holds the cap, so a confused run cannot spend more than you approved.
  • idempotency_key with the date. A retried step replays the first answer, so a hiccup never makes two films, charges twice or posts twice.
  • Watch the month. get_ledger and get_monthly_usage show what the routine has spent; your plan’s monthly cap still applies.
Rendering is free. A run like this one spends only on scene 1: one short clip a day. Check the exact number with estimate_cost on your own template.

Post now or later

publish_video posts as soon as the film is ready. To post at your channel’s best hour instead, use schedule_video with a when in the future: the run makes the film at 09:00 and Lavendly posts it at 18:00. Review queued posts with list_scheduled_posts and stop one with cancel_scheduled_post. To review before anything goes out, leave step 8 out and the run ends with the finished film in your project.

Example: a weekly roundup

A Monday recap built from the week’s films. Nothing new is generated, so it costs nothing but the render, which is free.

Other agents

  • Codex: run codex exec "<the routine prompt>" from cron or a scheduled CI job, with Lavendly in ~/.codex/config.toml.
  • Cursor: run cursor-agent -p "<the routine prompt>" from cron or a scheduled CI job, with Lavendly in ~/.cursor/mcp.json.
Connection details for each agent are on the MCP overview, and every tool used here is in the tools reference.