Build a content agent
This recipe shows you how to build a multi-step agent that analyzes a video collection and produces structured creative output. The example constructs a micro-drama outline with scene breakdowns, character arcs, and clip references.
Use cases:
- Micro-drama outlines: Extract narrative elements and construct scene breakdowns from video footage
- Training curricula: Identify learning objectives and demonstrations for instructional design
- Compliance audits: Find claims, disclosures, and regulation references for review
- Content plans: Discover topics, audience signals, and gaps for editorial strategy
Key concepts
- Knowledge store: A persistent store of your videos and images plus the understanding the platform derives from them — spatiotemporal context, a typed ontology, and embeddings — that together enable corpus-level reasoning.
- Ingestion configuration: A configuration that controls how the platform processes content added to a knowledge store. You set the
ingestion_configparameter at creation time and cannot change it afterward. - Instructions: Additional guidance that shapes Jockey’s behavior for a specific domain or task.
- Structured output: A JSON schema you provide with your request. Jockey constrains its output to match your schema, so you retrieve machine-readable results instead of plain text. For a guide on designing schemas and parsing responses, see the Structured output page.
- Multi-turn session: A conversation where each request builds on previous turns. The first request creates a session, and follow-up requests reference that session to continue the conversation. For details, see the Multi-turn sessions page.
Workflow
This recipe combines three capabilities into a reusable agent pattern. First, you create a knowledge store with a domain-specific ingestion configuration. This configuration controls what the platform extracts from your videos during processing. Then, you call the Responses API with a JSON schema, instructions that give Jockey a specific role and domain guidance, and a prompt. Jockey reasons across your knowledge store and returns structured output that matches your schema. Finally, you use the session identifier to refine the results in a follow-up turn. You can adapt this pattern to any creative or analytical domain.
Prerequisites
- You’ve already created a knowledge store with at least one item in
readystatus. See the Quickstart page for details. - You’re familiar with the request and response format. See the Create a response page for details.
Complete example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
Create a domain-focused knowledge store
Create a knowledge store with an ingestion configuration tailored to your domain, so the platform extracts the signals your task needs.
Function call: You call the knowledge_stores.create method.
Parameters:
name: The name of the knowledge store.ingestion_config: An object that controls what the platform extracts during processing. You cannot change it after creation. It contains anenrichment_configobject:type: The enrichment type. Set to"description"for a natural-language description, or"json_schema"for precise typed fields. For details, see the Configure ingestion page.description: A natural-language description of what to extract. This example focuses on narrative elements: characters, emotions, conflicts, and dramatic turning points.
Return value: An object of type KnowledgeStore with a field named id representing the unique identifier of the newly created knowledge store. Pass it to the Responses API calls that follow.
After creating the store, add video assets and wait for processing to complete. See the Quickstart page for the full upload and processing workflow.
Request a narrative outline
Generate the structured outline from the collection.
Function call: You call the responses.create method with domain instructions, a prompt, and a text parameter that describes your narrative schema.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store to reason over.input: An array of input items. Each item is a message you send to Jockey. This example asks Jockey to create a micro-drama, focusing on the strongest emotional arc.instructions: A per-request system prompt that shapes Jockey’s behavior for a domain or task. This example uses a micro-drama creator role that identifies narrative elements.text: An object that specifies the response format. To return structured JSON, set theformatfield: itsschema_field defines the structure the output must match, and itsnamefield identifies the schema. Design the schema to fit your use case; the inline comments in the example describe each field. For the schema rules, see the Structured output page.
Return value: An object of type ResponseObject. Read the session_id field to continue in the follow-up turn, and the output items for the outline. The response also includes id, status, and usage.
Process the results
The text field of each content part in a message item of the output array is a JSON string that matches your schema. Parse it with json.loads(), then iterate the scenes array to read each scene. Keep the session_id from the response for the next step.
Refine the output in a follow-up turn
Continue the session with a new prompt that adjusts the result. Jockey retains the context from the first turn.
Function call: You call the responses.create method again with the session_id and the same schema.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store. Must match the store from the first request.session_id: The session identifier from the first response.input: An array of input items. Each item is a message you send to Jockey. This example asks Jockey to sharpen the conflict and find a stronger turning point.text: The same schema as the first request.
Return value: An object of type ResponseObject with the same structure as the first outline. Parse it the same way.
Example response
The text field inside each content part is a JSON string that matches your schema. After parsing, a typical result looks like this:
Notes
- The
video_referencefield contains the asset identifier of the knowledge store item. - The
timestampfield is a range inMM:SS-MM:SSformat indicating the clip boundaries. - Jockey returns narrative outlines with clip references (video identifiers and timestamps), not rendered video files. Use these references with your editing tool or pipeline to assemble the final content.
Variations
Change the ingestion configuration, instructions, or prompt to adapt this pattern for different domains and creative directions.
- Change the genre: Set the
instructionsparameter to “horror micro-drama creator”, “comedy sketch writer”, or “documentary short producer.” - Focus on a character: Change the prompt to “Build the drama around the most frequently appearing person.”
- Create a series: Use a multi-turn session to extend the story: “Create episode 2, continuing from this ending.”
- Change the domain: Replace the ingestion configuration, instructions, and schema to build a training curriculum designer, compliance auditor, or content planner.
Jupyter notebook
See also
- Structured output - more on JSON Schema responses
- Multi-turn sessions - more on session-based conversations
- Configure ingestion - control what the platform extracts during processing
- Create a response - API reference for the Responses endpoint