Agentic search
This recipe shows you how to perform agentic search over a knowledge store. Jockey interprets your query, reasons across the content, and returns structured results that you can shape and refine. Each result can include an item reference, timestamp, description, and relevance. Use the results in a search interface or a processing pipeline.
For a direct, single-call search that retrieves ranked matches, see Search a knowledge store. Use agentic search when your query is interpretive or subjective, or when you want Jockey to explain and refine the results.
Use cases:
- Interpretive queries: Search for moments that need interpretation, ranking, or judgment
- Explained results: Receive a description and a relevance explanation for each match
- Custom output: Shape the results into a structure your application consumes
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.
- 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.
Workflow
This recipe combines two elements: a JSON schema that defines the result data structure and a prompt that describes what you want to find. Jockey reasons across your knowledge store, matches moments against visual content, audio, and semantic meaning, and returns structured search results. You can adapt this recipe to search for different content types or match different criteria.
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. The example pairs a result schema with a prompt that searches for presentations. Adapt the schema and prompt to match what you want to find.
Code explanation
Python
Node.js
To run an agentic search, call the responses.create method with a text parameter that describes your result schema and a prompt that describes what to find.
Parameters:
knowledge_store_id: The unique identifier of the knowledge store to search.input: An array of input items. Each item is a message you send to Jockey. This example searches for moments where someone presents to an audience.text: An object that specifies the response format. To return structured JSON, set theformatfield: itsschema_field defines the structure the results 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 containing, among other information, the following fields:
id: The unique identifier of the response.knowledge_store_id: The knowledge store this response was generated against.session_id: The session identifier. Pass it in a follow-up request to continue the conversation.status: The status of the response. The possible values arecompleted,failed,in_progress, andincomplete.output: The response output items. Thetextfield of each content part in amessageitem is a JSON string that matches your schema. Parse it withjson.loads(), then iterate theresultsarray to read each match.usage: Token usage statistics, including theinput_tokensandoutput_tokensfields.
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:
Note
The item_reference field is the unique identifier of the knowledge store item that contains the match, as a plain UUID. The timestamp field gives the matching range in MM:SS-MM:SS format. Re-add the ksi_ prefix to this value to use it with the knowledge store items endpoints.
Variations
Change the prompt and schema to adapt this recipe for different search scenarios. Jockey matches against visual content, audio, and semantic meaning.
- Search by visual description: Change the prompt to describe a scene, such as “outdoor scenes with water” or “product being held up to camera.”
- Search by audio or speech: Search for spoken content, such as “someone laughing” or “mentions of quarterly revenue.”
- Search by tone or mood: Describe the feel of a moment, such as “heated discussion” or “celebratory reactions.”
- Rank results: Ask Jockey to rank matches: “Find and rank the top 5 most visually striking moments.”
- Narrow the scope: Add the
instructionsparameter to constrain the search. For example, “Only search the first 2 minutes of each video.” - Refine with follow-up turns: Use a multi-turn session to adjust results: “Show me more like the third result.”
Jupyter notebook
See also
- Search a knowledge store: Retrieve ranked clips and images without agentic reasoning
- Assemble highlight reels: Find clips for assembly
- Structured output: More on JSON Schema responses
- Create a response: API reference for the responses endpoint