Skip to main content
POST
Video Searching Agent (SSE Stream)
Product: Visual Agents Use case: Managed endpoints powering Memories.ai’s open-source video search and editing agents (queries, video clipping/editing, screenplay extraction) Host: https://mavi-backend.memories.ai/serve/api/v2 Auth: Authorization: sk-mavi-... (no Bearer prefix)
The Video Searching API exposes the same agentic capabilities as the open-source Video Searching Agent through a managed, token-authenticated endpoint. It searches YouTube, TikTok, Instagram, and X/Twitter, then returns structured findings via Server-Sent Events (SSE).
This endpoint returns an SSE stream. In the playground above, click Send to fire the request. The response panel will show the raw SSE events as they arrive. For full streaming consumption, use the code examples below.

SSE Streaming

Real-time progress, tool calls, and final results streamed as typed SSE events.

17 Built-in Tools

YouTube, TikTok, Instagram, X/Twitter search & profile tools, Exa.ai neural search, and video analysis.

Pay-per-use

Billed per Gemini call and per third-party tool invocation. No idle cost.

Code Examples

SSE Event Types

The stream emits named events using the standard event: / data: SSE format. Each data payload is JSON.

started

Emitted once when the agent session begins.

progress

Emitted at each agent step to indicate progress.

clarification

Emitted when enable_clarification is true and the query is ambiguous. The stream ends after this event.

tool_call

Emitted when the agent invokes a tool.

tool_result

Emitted after a tool finishes execution.

error

Emitted when a step or the entire run encounters a non-fatal error.

complete

Final event containing the full structured response. The stream closes after this event.

Response Fields

Top-level

VideoRef

Available Tools

The agent autonomously selects from these tools during the agentic loop:

Billing & Cost Breakdown

Each API call may trigger multiple billable events depending on which tools the agent selects. All charges are deducted automatically after successful execution — there is no upfront reservation per tool call.

Gemini Model (Token-based)

The agent currently uses Gemini 3.1 Pro (gemini-3.1-pro-preview). Gemini is called at two stages, both billed by token count using the same MODEL billing type as the Gemini VLM API. A typical request with 3 agent steps produces 4 Gemini billing events (1 classification + 3 loop iterations). The exact token counts are returned in usage_metrics.token_usage.

Social Platform Search Tools

These tools call third-party scraping APIs (Apify or RapidAPI). The agent picks the available channel automatically.

Creator / Profile Tools

Exa.ai Tools

exa_get_content is the only tool billed per item rather than per call. If the agent extracts content from 5 URLs in a single invocation, 5 × $0.001 = $0.005 is charged.

YouTube Tools — Free

Video Analysis Tools — Billed by Underlying Service

These tools call existing Memories.ai internal services that have their own billing. No additional agent-level charge is applied. See the corresponding API docs for pricing:

Cost Example

A typical discovery query like “Find trending AI videos on TikTok this week” may incur: You can inspect the exact tools invoked and their counts in the complete event’s usage_metrics.tool_invocations and tools_used fields.

Error Handling

If the request body is invalid, the endpoint returns a standard JSON error (not SSE):
For errors during the agentic loop, an error SSE event is emitted and the stream may still complete with partial results.

Rate Limits

This endpoint uses the Lite rate-limit tier. Check your plan for specific limits.
The streaming endpoint keeps the connection open for up to 5 minutes. A keep-alive ping comment is sent every 15 seconds to prevent proxy timeouts.

Authorizations

Authorization
string
header
required

Body

application/json
query
string
required

Natural-language search query

Example:

"Find trending AI coding tool videos on TikTok from the past week"

platforms
enum<string>[]

Restrict to specific platforms. If omitted, all platforms are searched.

Available options:
youtube,
tiktok,
instagram,
twitter
max_results
integer
default:10

Maximum number of video results to return

time_frame
enum<string>

Recency filter for video results

Available options:
past_24h,
past_week,
past_month,
past_year
max_steps
integer
default:10

Maximum agent iteration steps

enable_clarification
boolean
default:false

When true, the agent may return a clarification event instead of searching if the query is ambiguous

Response

SSE stream of agent events (started → progress → tool_call → tool_result → complete)

session_id
string

Unique session identifier

query
string

Original user query

answer
string

Natural-language answer summarizing findings

video_references
object[]

Structured list of discovered videos

platforms_searched
string[]
total_videos_analyzed
integer
total_creators_analyzed
integer
confidence_score
number
data_freshness
string
steps_taken
integer
tools_used
string[]
execution_time_seconds
number
usage_metrics
object