Skip to main content
POST
Run Agent
Execute an agent workflow. Supports standard video-input workflows and generation-only workflows such as AI Avatar, Video Generation, Audio Generation, and Image Generation.

Canonical input model

Treat video_inputs as the canonical run input shape:
  • video_inputs[] entries map assets to a specific Video Input tile (agent_node_id)
  • each entry accepts one or more sources: video_ids, node_render_ids, video_urls
  • optional input_clip_start_ms / input_clip_end_ms fields can limit the source range used for a run
Top-level fields (video_ids, node_render_ids, video_urls) are shorthand for single-input runs.

Single-input shorthand

If your runnable graph has one Video Input tile, you can send top-level input arrays without specifying agent_node_id.
Example using video_ids (from the Uploads API):
Example using node_render_ids (from previous run outputs):

Multi-input workflows

If your agent has multiple runnable Video Input tiles, you must use video_inputs and provide an entry for each runnable input tile. In that mode, do not also send top-level input arrays. You can get each agent_node_id from GET /agent/[agent_id] or from the Mosaic editor’s API info panel for that tile.

Generation-Only Workflows

For workflows starting with generation nodes and no Video Input node, no video inputs should be provided. These agents generate media based on the parameters configured in the agent, or on update_params you pass at run time. Generation node type IDs: To create a generation-only agent, use Create Agent, then add one of these nodes with Update Agent. Run that agent without video_inputs, video_ids, video_urls, or node_render_ids.
For AI Avatar, create an avatar first with POST /avatar-profiles/create, then pass the avatar ID into the avatar node:
Video Generation example:
Use model: "seedance-2" and resolution: "4k" for 4K output. 4K resolution is billed at 2x normal Seedance. Audio Generation example:
Image Generation example:

Parameters

Input rules:
  • Use either top-level input arrays or video_inputs (not both in the same request).
  • If the runnable graph has multiple Video Input tiles, provide one video_inputs entry for each runnable input tile.
  • node_render_ids are valid video inputs (top-level shorthand for single-input runs, or per-entry in video_inputs).
  • mimir_assets can be combined with other input types in the same entry.
  • If you need different start/end ranges for different inputs, use video_id_inputs, node_render_inputs, video_url_inputs, or youtube_url_inputs instead of the plain string arrays.
  • input_clip_start_ms and input_clip_end_ms are independent optional fields; if both are provided, input_clip_end_ms must be greater than input_clip_start_ms.
ID source rules:
  • video_ids come from the Uploads API.
  • node_render_ids come from previous run outputs (GET /agent_run/{run_id} -> outputs[].id) or run webhooks.

Input Clipping

You can run an agent on a segment of a source video by passing millisecond offsets. This is useful when you only want the first part of a long video or when billing should match the portion actually processed. Top-level clipping applies the same range to every top-level input:
For URL inputs, Mosaic cuts the downloaded file before it is uploaded as the run input. For existing video_ids and node_render_ids, Mosaic creates a clipped timeline/render input for the requested range. You can also send only one side of the range: input_clip_start_ms only (trim from start offset to end of source):
input_clip_end_ms only (trim from 0 to end offset):
Use the object input forms when each source needs its own range:

Video URL Requirements & Limits

The video_urls field supports two types of URLs: YouTube URLs:
  • Supports standard YouTube video URLs (e.g., https://www.youtube.com/watch?v=VIDEO_ID)
  • Maximum duration: 5 hours per video
  • The system automatically validates the video exists and checks duration before processing
Signed URLs (HTTP/HTTPS):
  • Must be HTTP or HTTPS URLs pointing to video files
  • Maximum file size: 5 GB per video
  • Maximum duration: 5 hours per video

Modifying Node Parameters

You can override specific parameters for any node in your agent workflow using the update_params field. This allows you to dynamically change behavior (like clip duration, prompt text, or number of clips) at runtime. To find the correct parameters:
  1. Open your agent in the Mosaic Dashboard
  2. Click the settings menu on the node you want to modify
  3. Scroll down to the API info dropdown
  4. Open the dropdown to find the Agent node ID
  5. Click Copy params to get the JSON structure
The copied JSON will look like this, where the key is the agent_node_id (UUID) and the value object contains the parameters you can override:
Pass this entire object as the update_params value in your API request.

update_params validation behavior

Mosaic validates update_params before creating the run:
  • Unknown agent_node_id keys return 400
  • Invalid parameter types/values return 400
  • Protected/system nodes (for example Video Input/Destination/trigger nodes) cannot be overridden with update_params
If validation fails, the run is not created.

Bypassing Nodes at Runtime

Use ignore_nodes to skip one or more nodes for a single run without editing the saved agent template. For each ignored node:
  • Incoming connections to the node are rewired to its downstream nodes
  • The ignored node is removed from the runtime DAG for that run only
  • The template itself is unchanged

Uploading Media for Node Parameters

Some nodes accept images, audio, or videos as parameters. To set these programmatically, use the Uploads API to upload your files and get their UUIDs:
See the Upload Flow for the complete upload process.

Chaining Runs with node_render_ids

You can feed outputs from a previous run directly into another run by passing render IDs returned in webhooks or from GET /agent_run/[run_id] (outputs[].id). Single-input shorthand:
Canonical video_inputs form:

Mimir Integration

Mosaic can ingest video directly from Mimir using mimir_assets. This downloads the video from your Mimir instance, stores Mimir metadata (item ID, artifact type, connection details) as source_info on the video record, and makes it available for Premiere Pro linking in downstream tiles.

Prerequisites

  1. Go to Settings > Integrations in the Mosaic dashboard.
  2. Add your Mimir instance URL (e.g. https://mimir.mjoll.no) and an API key generated from your Mimir user settings.
  3. Mosaic verifies the connection on save. If verification fails, check that the URL and API key are correct.

Single Mimir asset

Multiple Mimir assets with different artifacts

Mimir assets in multi-input workflows

mimir_assets entry schema

Artifact options

Regardless of which artifact is downloaded, the Mimir item ID is always stored in source_info so Premiere Pro exports can link back to the original asset in Mimir.
mimir_assets require an organization-scoped API key (mk_ prefix). The Mimir connection itself is workspace-scoped — configure it per workspace in Settings → Integrations. If no Mimir connection is configured for the agent’s workspace, the API returns a 400 error explaining how to set one up.

How Mimir metadata flows

When a Mimir asset is ingested:
  1. Mosaic fetches the item details from your Mimir instance.
  2. The selected artifact URL (highres or proxy) is downloaded.
  3. Mimir metadata (item ID, artifact type, connection details) is stored in videos.source_info.
  4. Downstream tiles (e.g. News UK, Sun) that generate Premiere Pro projects use this metadata to link clips back to Mimir.

Agent graph best practices

  • For “shorter/tighter” edits, place Rough Cut and/or Clips before style-heavy nodes.
  • Place Reframe before Captions, Cinematic Captions, Motion Graphics, and Watermark so overlays are composed against final framing.
  • Keep update_params minimal and explicit (only send fields you want to override).

Publish to social after render

After run completion, retrieve outputs[].video_url from GET /agent_run/[run_id] and send that URL in media_urls to POST /social/post.

Response

The run_id is used to track the progress of your agent run.