---
title: pipeline | CodeWeaver Docs
description: API reference for codeweaver.server.agent_api.search.pipeline
url: "https://docs.knitli.com/api/server/agent_api/search/pipeline"
type: static
generatedAt: "2026-04-17T17:21:09.678Z"
---

# pipeline
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/server/agent_api/search/pipeline.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F&text=pipeline)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F&text=pipeline)[Share on Bluesky](https://bsky.app/intent/compose?text=pipeline%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F&title=pipeline)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F&t=pipeline)[Share on Email](mailto:?subject=pipeline&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F)[Share on WhatsApp](https://wa.me/?text=pipeline%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fpipeline%2F&text=pipeline)
# `codeweaver.server.agent_api.search.pipeline`
[Section titled “codeweaver.server.agent_api.search.pipeline”](#codeweaverserveragent_apisearchpipeline)
Search pipeline orchestration.

This module handles the core search pipeline including:

 - Query embedding (dense and sparse)
 - Vector store search
 - Reranking (when provider available)

## Function: `build_query_vector`
[Section titled “Function: build_query_vector”](#function-build_query_vector)

**

```
build_query_vector()
```

Build query vector for search from embeddings.

Args: query_result: QueryResult containing embeddings keyed by intent query: Natural language query string

Returns: A StrategizedQuery containing sparse and/or dense vectors and the chosen strategy

Raises: ValueError: If both embeddings are None

## Function: `embed_query`
[Section titled “Function: embed_query”](#function-embed_query)

**

```
embed_query()
```

Embed query using configured embedding providers.

Tries dense embedding first, then sparse. Returns result with whichever succeeded. If both fail, raises ValueError.

Args: query: Natural language query to embed context: Optional FastMCP context for structured logging dense_provider: Injected dense embedding provider sparse_provider: Injected sparse embedding provider

Returns: QueryResult with dense and/or sparse embeddings

Raises: ValueError: If no embedding providers configured or both fail

## Function: `execute_vector_search`
[Section titled “Function: execute_vector_search”](#function-execute_vector_search)

**

```
execute_vector_search()
```

Execute vector search against configured vector store.

Args: query_vector: Query vector (dense, sparse, or hybrid) context: Optional FastMCP context for structured logging vector_store: Injected vector store instance

Returns: List of search results from vector store

Raises: ValueError: If no vector store provider configured

## Function: `raise_value_error`
[Section titled “Function: raise_value_error”](#function-raise_value_error)

**

```
raise_value_error()
```

Raise QueryError with message including current query.

## Function: `rerank_results`
[Section titled “Function: rerank_results”](#function-rerank_results)

**

```
rerank_results()
```

Rerank search results using configured reranking provider(s) with cascading fallback.