Research preview

Overview

SID-2 is an agentic retrieval model. It searches your data and returns ranked IDs for the documents needed to answer a question.

Static vs agentic retrieval

A static retrieval pipeline runs a fixed sequence of steps and returns whatever it found, even when that is wrong. It cannot react to what it sees. In practice, static pipelines accumulate a long tail of failures on tasks like multi-step or multi-hop questions.

A static retrieval pipeline: a question passes through an optional LLM rewrite, a search backend, an optional reranker, and then results. Each query follows the same sequence; there is no loop to inspect results or choose another search.

SID-2 searches, reads the results, adapts, and searches again until it has enough. If a question is easy and the results are found quickly, it can choose to end early. If the question is hard, it can make more searches until it finds the right results or exhausts its turns. This complete search task is an episode.

One SID-2 episode begins with a question and ends with ranked IDs. The question reaches SID-2 along an arrow labeled + tools. SID-2 sends search and read tool calls to your search backend and episode cache, which return snippets or chunks and metadata. Parallel arrows in both directions represent multiple calls across turns. The report comes from SID-2, not directly from the backend.

You own your data and the code around the model. You implement the search tools that run against your backend, format the results, and run the loop. Using SID-2 doesn't require you to reindex your data or store it somewhere else. It only sees the results your tools return.

What is an episode?

An episode is one complete search task for your question, from the initial question until SID-2 reports the relevant IDs or the run ends. Within that one task, the agent can make many individual keyword searches, vector searches, and read calls across multiple turns. A turn is one response from the model and can contain several tool calls.

Documents, chunks, and snippets

We use document (or doc) and chunk interchangeably: one indexed record with its own ID. That record may be a complete source document or a chunk taken from a larger document, as in a vector search index.

A snippet is a short, query-relevant excerpt from that record, usually much shorter than a chunk in a vector search index. Search tools show snippets so the model can judge relevance without reading every chunk in full. A short chunk may fit entirely in its snippet.

A read call usually returns the full chunk, or a requested character range within it. Reading the full chunk does not necessarily mean reading the entire original source document.

Implementing the agent loop

Start with Installation to install the SDK and create a SID API key.

You implement the search tools and orchestration of requests to SID-2. The model decides which searches to make, what filters to set, and how many times to iterate.

Quickstart: using the reference implementation

For simple use cases with a single corpus with a keyword search and vector search tool, you can build from the reference implementation. vector_search and keyword_search (vectorSearch and keywordSearch in TypeScript and Go) are left unimplemented. Plug them into your own store:

SID_API_KEY=your-api-key uv run --with sid-sdk --with openai reference_implementation.py
pip install sid-sdk openai
SID_API_KEY=your-api-key python reference_implementation.py
npm install @sid-ai/sid-sdk openai
npm install --save-dev tsx
SID_API_KEY=your-api-key npx tsx reference_implementation.ts
go mod init sid-example
go get github.com/sidhq/sid-go github.com/openai/openai-go/v3
SID_API_KEY=your-api-key go run reference_implementation.go
BASETEN_API_KEY=your-api-key uv run --with sid-sdk --with openai reference_implementation_baseten.py
pip install sid-sdk openai
BASETEN_API_KEY=your-api-key python reference_implementation_baseten.py
npm install @sid-ai/sid-sdk openai
npm install --save-dev tsx
BASETEN_API_KEY=your-api-key npx tsx reference_implementation_baseten.ts
go mod init sid-example
go get github.com/sidhq/sid-go github.com/openai/openai-go/v3
BASETEN_API_KEY=your-api-key go run reference_implementation_baseten.go
SAGEMAKER_ENDPOINT_NAME=your-endpoint AWS_DEFAULT_REGION=your-region uv run --with sid-sdk --with openai --with "responses-sagemaker @ git+https://github.com/sidhq/responses-sagemaker" reference_implementation_sagemaker.py
pip install sid-sdk openai git+https://github.com/sidhq/responses-sagemaker
SAGEMAKER_ENDPOINT_NAME=your-endpoint AWS_DEFAULT_REGION=your-region python reference_implementation_sagemaker.py

Plug your search tools and document structure into the implementation.

  1. vector_search / keyword_search: return a list of objects with "id", "content", and any extra fields (e.g. "title") your tools pass to DocumentCache.add_document (addDocument in TypeScript, AddDocument in Go) as display attributes.
  2. INSTRUCTIONS: the system prompt.
  3. QUESTION: what you want answered.
  4. TOOL_EXAMPLES: few-shot tool calls that demonstrate using the search tools, including additional features your backend supports.

Implementing the agent loop from scratch

One SID-2 episode begins with a question and ends with ranked IDs. The question reaches SID-2 along an arrow labeled + tools. SID-2 sends search and read tool calls to your search backend and episode cache, which return snippets or chunks and metadata. Parallel arrows in both directions represent multiple calls across turns. The report comes from SID-2, not directly from the backend. An outer dashed box labeled Agent loop encloses the whole process. Inside it, Making a request highlights the question, the supplied tools, and SID-2, and Formatting documents highlights your search backend and episode cache.

With more complex tool sets and multi-corpus setups, you will need to adapt more of the reference implementation's agent loop.

SID-2 is trained with the following classes of tools:

  • Search tools: the model submits a query, filter set, limit and snippet size, and gets a formatted list of documents returned. Use text_search for keyword search and search for vector search. For multiple corpora, prepend the corpus name, for example email_text_search.
  • Read tools: the model submits a document ID, potentially with a character range, and gets the formatted chunk referenced by this ID, in full or for that character range.

The report tool, report_helpful_ids, is fixed and cannot be changed or modified. The model submits a list of document IDs it believes to be most relevant, terminating the agent loop.

Content