> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.airweave.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.airweave.ai/_mcp/server.

# Stream Agentic Search

POST https://api.airweave.ai/collections/{readable_id}/search/agentic/stream
Content-Type: application/json

Streaming agentic search via Server-Sent Events. Returns real-time events as the agent searches.

Reference: https://docs.airweave.ai/api-reference/collections/stream-agentic

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.airweave.ai` (Production, default)
- `http://localhost:8001` (Local)

## Request

### Path parameters

- `readable_id` (string, required)

### Body (application/json)

This endpoint expects an AgenticSearchRequest.

- `query` (string, required) — Search query text.
- `thinking` (boolean, optional, default: false) — Enable extended thinking / chain-of-thought.
- `filter` (list of FilterGroup, optional, nullable) — Filter groups (combined with OR).
- `limit` (integer, optional, nullable) — Max results. None means agent decides.

## Response

### 200

SSE stream of agentic search events.

- Streaming response of `AgenticSearchEvent`.
- started: AgenticSearchStartedEvent
- thinking: AgenticSearchThinkingEvent
- tool_call: AgenticSearchToolCallEvent
- reranking: AgenticSearchRerankingEvent
- done: AgenticSearchDoneEvent
- error: AgenticSearchErrorEvent

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### FilterGroup

A group of filter conditions combined with AND. Multiple filter groups are combined with OR, allowing expressions like: (A AND B) OR (C AND D) Examples: Single group (AND): \{"conditions": \[ \{"field": "airweave\_system\_metadata.source\_name", "operator": "equals", "value": "slack"}, \{"field": "airweave\_system\_metadata.entity\_type", "operator": "equals", "value": "SlackMessageEntity"} ]} Multiple groups (OR between groups, AND within): \[ \{"conditions": \[\{"field": "name", "operator": "equals", "value": "doc1"}]}, \{"conditions": \[\{"field": "name", "operator": "equals", "value": "doc2"}]} ] Breadcrumb filtering: \{"conditions": \[ \{"field": "breadcrumbs.name", "operator": "contains", "value": "Engineering"} ]}

- `conditions` (list of FilterCondition, required) — Filter conditions within this group, combined with AND

### AgenticSearchStartedEvent

- `type` (enum, required)
  - Allowed values: `started`
- `request_id` (string, required)
- `tier` (string, required)
- `collection_readable_id` (string, required)
- `query` (string, required)
- `thinking` (boolean, optional, nullable)
- `filter` (list of AgenticSearchStartedEventFilterItems, optional, nullable)
- `limit` (integer, optional, nullable)

### AgenticSearchThinkingEvent

- `type` (enum, required)
  - Allowed values: `thinking`
- `duration_ms` (integer, required)
- `diagnostics` (AgenticSearchThinkingEventDiagnostics, required)
- `thinking` (string, optional, nullable) — Extended reasoning text from the LLM.
- `text` (string, optional, nullable) — Conversational text output before tool calls.

### AgenticSearchToolCallEvent

- `type` (enum, required)
  - Allowed values: `tool_call`
- `tool_name` (enum, required)
  - Allowed values: `search`, `read`, `add_to_results`, `remove_from_results`, `count`, `get_children`, `get_siblings`, `get_parent`, `review_results`, `return_results_to_user`
- `duration_ms` (integer, required)
- `diagnostics` (AgenticSearchToolCallEventDiagnostics, required)

### AgenticSearchRerankingEvent

- `type` (enum, required)
  - Allowed values: `reranking`
- `duration_ms` (integer, required)
- `diagnostics` (AgenticSearchRerankingEventDiagnostics, required)

### AgenticSearchDoneEvent

- `type` (enum, required)
  - Allowed values: `done`
- `results` (list of SearchResult, required) — Full result set.
- `duration_ms` (integer, required)
- `diagnostics` (AgenticSearchDoneEventDiagnostics, optional, nullable)

### AgenticSearchErrorEvent

- `type` (enum, required)
  - Allowed values: `error`
- `message` (string, required) — Error message.
- `duration_ms` (integer, optional)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### FilterCondition

A single filter condition. Pydantic validates that: * `field` is a valid FilterableField enum value * `operator` is a valid FilterOperator enum value * `value` matches the expected types * The combination of field + operator + value is semantically valid Invalid filters raise `pydantic.ValidationError` automatically. Examples: \{"field": "airweave\_system\_metadata.source\_name", "operator": "equals", "value": "notion"} \{"field": "created\_at", "operator": "greater\_than", "value": "2024-01-01T00:00:00Z"} \{"field": "breadcrumbs.name", "operator": "contains", "value": "Engineering"}

- `field` (enum, required) — Field to filter on (use dot notation for nested fields).
  - Allowed values: `entity_id`, `name`, `created_at`, `updated_at`, `breadcrumbs.entity_id`, `breadcrumbs.name`, `breadcrumbs.entity_type`, `airweave_system_metadata.entity_type`, `airweave_system_metadata.source_name`, `airweave_system_metadata.original_entity_id`, `airweave_system_metadata.chunk_index`, `airweave_system_metadata.sync_id`, `airweave_system_metadata.sync_job_id`
- `operator` (enum, required) — The comparison operator to use.
  - Allowed values: `equals`, `not_equals`, `contains`, `greater_than`, `less_than`, `greater_than_or_equal`, `less_than_or_equal`, `in`, `not_in`
- `value` (FilterConditionValue, required) — Value to compare against. Use a list for 'in' and 'not_in' operators.

### AgenticSearchStartedEventFilterItems

### AgenticSearchThinkingEventDiagnostics

- `iteration` (integer, optional)
- `prompt_tokens` (integer, optional)
- `completion_tokens` (integer, optional)

### AgenticSearchToolCallEventDiagnostics

- `iteration` (integer, optional)
- `tool_call_id` (string, optional)
- `arguments` (AgenticSearchToolCallEventDiagnosticsArguments, optional) — Full LLM-generated tool input.
- `stats` (AgenticSearchToolCallEventDiagnosticsStats, optional) — Output stats. Shape depends on tool_name.

### AgenticSearchRerankingEventDiagnostics

- `input_count` (integer, optional)
- `output_count` (integer, optional)
- `model` (string, optional)
- `top_relevance_score` (double, optional)
- `bottom_relevance_score` (double, optional)

### SearchResult

Search result.

- `entity_id` (string, required) — Original entity ID.
- `name` (string, required) — Entity display name.
- `relevance_score` (double, required) — Relevance score from the search engine.
- `breadcrumbs` (list of SearchBreadcrumb, required) — Breadcrumbs showing entity hierarchy.
- `textual_representation` (string, required) — Semantically searchable text content
- `airweave_system_metadata` (SearchSystemMetadata, required) — System metadata
- `access` (SearchAccessControl, required) — Access control
- `web_url` (string, required) — URL to view the entity in its source application (e.g., Notion, Asana).
- `raw_source_fields` (map from string to any, required) — All source-specific fields.
- `created_at` (string, optional, nullable) — When the entity was created.
- `updated_at` (string, optional, nullable) — When the entity was last updated.
- `url` (string, optional, nullable) — Download URL for file entities. Only present for FileEntity types.

### AgenticSearchDoneEventDiagnostics

- `total_iterations` (integer, optional)
- `all_seen_entity_ids` (list of string, optional)
- `all_read_entity_ids` (list of string, optional)
- `all_collected_entity_ids` (list of string, optional)
- `max_iterations_hit` (boolean, optional)
- `total_llm_retries` (integer, optional)
- `stagnation_nudges_sent` (integer, optional)
- `prompt_tokens` (integer, optional)
- `completion_tokens` (integer, optional)
- `cache_creation_input_tokens` (integer, optional)
- `cache_read_input_tokens` (integer, optional)

### ValidationErrorLocItems

- string
- integer

### FilterConditionValue

Value to compare against. Use a list for 'in' and 'not_in' operators.

- string
- integer
- boolean
- list of string
- list of integer

### AgenticSearchToolCallEventDiagnosticsArguments

Full LLM-generated tool input.

### AgenticSearchToolCallEventDiagnosticsStats

Output stats. Shape depends on tool_name.

- SearchToolStats: SearchToolStats
- ReadToolStats: ReadToolStats
- CollectToolStats: CollectToolStats
- CountToolStats: CountToolStats
- NavigateToolStats: NavigateToolStats
- ReviewToolStats: ReviewToolStats
- FinishToolStats: FinishToolStats
- ErrorToolStats: ErrorToolStats

### SearchBreadcrumb

Breadcrumb in search result.

- `entity_id` (string, required) — ID of the entity in the source.
- `name` (string, required) — Display name of the entity.
- `entity_type` (string, required) — Entity class name (e.g., 'AsanaProjectEntity').

### SearchSystemMetadata

System metadata in search result.

- `source_name` (string, required) — Name of the source this entity belongs to.
- `entity_type` (string, required) — Type of the entity this entity represents in the source.
- `chunk_index` (integer, required) — Index of the chunk in the file.
- `original_entity_id` (string, required) — Original entity ID
- `sync_id` (string, optional, nullable) — ID of the sync this entity belongs to (None for federated).
- `sync_job_id` (string, optional, nullable) — ID of the sync job this entity belongs to (None for federated).

### SearchAccessControl

Access control in search result.

- `viewers` (list of string, optional, nullable) — Principal IDs who can view this entity. None if unknown.
- `is_public` (boolean, optional, nullable) — Whether this entity is publicly accessible. None if unknown.

### SearchToolStats

Stats from a search tool call.

- `result_count` (integer, optional) — Total results returned.
- `new_results` (integer, optional) — Results not seen in previous searches.
- `first_results` (list of EntitySummary, optional)

### ReadToolStats

Stats from a read tool call.

- `found` (integer, optional) — Entities successfully read.
- `not_found` (integer, optional) — Entity IDs that weren't found.
- `entities` (list of EntitySummary, optional)
- `context_label` (string, optional, nullable)

### CollectToolStats

Stats from add_to_results or remove_from_results.

- `added` (integer, optional)
- `already_collected` (integer, optional)
- `not_found` (integer, optional)
- `total_collected` (integer, optional) — Total results collected after this operation.
- `entities` (list of EntitySummary, optional)

### CountToolStats

Stats from a count tool call.

- `count` (integer, optional) — Number of entities matching the filter.

### NavigateToolStats

Stats from get_children, get_siblings, or get_parent.

- `result_count` (integer, optional)
- `context_label` (string, optional) — Human-readable label, e.g. 'children of chan-engineering'.
- `first_results` (list of EntitySummary, optional)

### ReviewToolStats

Stats from review_results.

- `total_collected` (integer, optional)
- `entity_count` (integer, optional)
- `first_results` (list of EntitySummary, optional)

### FinishToolStats

Stats from return_results_to_user.

- `accepted` (boolean, optional) — Whether the agent accepted the result set.
- `total_collected` (integer, optional)
- `warning` (string, optional, nullable) — Warning if very few results collected relative to seen.

### ErrorToolStats

Stats when a tool call errors.

- `error` (string, optional)

### EntitySummary

Entity state summary.

- `total_entities` (integer, optional, default: 0)
- `by_type` (map from string to EntityTypeStats, optional)
- `entity_id` (string, optional)
- `name` (string, optional)
- `entity_type` (string, optional)
- `source_name` (string, optional)
- `relevance_score` (double, optional, nullable)

### EntityTypeStats

Statistics for a specific entity type.

- `count` (integer, required)
- `last_updated` (string, optional, nullable)

## Examples

**Request**

```json
{
  "query": "find all deployment-related docs from last month",
  "thinking": true
}
```

**SDK Code**

```python
import requests

url = "https://api.airweave.ai/collections/readable_id/search/agentic/stream"

payload = {
    "query": "find all deployment-related docs from last month",
    "thinking": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.airweave.ai/collections/readable_id/search/agentic/stream';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"query":"find all deployment-related docs from last month","thinking":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.airweave.ai/collections/readable_id/search/agentic/stream"

	payload := strings.NewReader("{\n  \"query\": \"find all deployment-related docs from last month\",\n  \"thinking\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.airweave.ai/collections/readable_id/search/agentic/stream")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": \"find all deployment-related docs from last month\",\n  \"thinking\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.airweave.ai/collections/readable_id/search/agentic/stream")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": \"find all deployment-related docs from last month\",\n  \"thinking\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.airweave.ai/collections/readable_id/search/agentic/stream', [
  'body' => '{
  "query": "find all deployment-related docs from last month",
  "thinking": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.airweave.ai/collections/readable_id/search/agentic/stream");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": \"find all deployment-related docs from last month\",\n  \"thinking\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "query": "find all deployment-related docs from last month",
  "thinking": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.airweave.ai/collections/readable_id/search/agentic/stream")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```