> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asteragents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Knowledge Base

> Search through knowledge bases for relevant information

## What it does

The Search Knowledge Base tool allows agents to search through your organization's knowledge bases to find relevant information. It uses AI-powered semantic search combined with traditional text search for comprehensive results.

<Info>
  For complete information about Knowledge Bases, including setup, file upload, and management, see [Knowledge Bases](/features/knowledge-bases).
</Info>

## Key features

* **Semantic Search**: AI understands context and meaning, not just keywords
* **Hybrid Results**: Combines vector similarity with traditional text search
* **File Filtering**: Include or exclude specific documents from search
* **Ranked Results**: Results ordered by relevance with similarity scores
* **Multi-Format Support**: Search across PDFs, Word docs, spreadsheets, and text files
* **High Performance**: Executes in JavaScript with direct database access for optimal speed

## Parameters

| Parameter           | Type    | Required | Description                                                          |
| ------------------- | ------- | -------- | -------------------------------------------------------------------- |
| `query`             | string  | Yes      | The search query to find relevant information in knowledge bases     |
| `knowledge_base_id` | integer | Yes      | The ID of the specific knowledge base to search in                   |
| `top_k`             | integer | No       | Number of results to return (default: 10)                            |
| `include_file_ids`  | array   | No       | Optional list of file IDs to restrict search to only these documents |
| `exclude_file_ids`  | array   | No       | Optional list of file IDs to exclude from search results             |

## Common use cases

### Find policy information

```
query: "employee vacation policy"
knowledge_base_id: 123
top_k: 5
```

Search company policies and procedures for specific information.

### Research financial data

```
query: "quarterly revenue trends"
knowledge_base_id: 456
top_k: 10
```

Find financial insights from uploaded reports and documents.

### Search specific documents

```
query: "budget analysis"
knowledge_base_id: 123
include_file_ids: [45, 67, 89]
top_k: 8
```

Focus search on recently uploaded or relevant documents only.

### Exclude outdated content

```
query: "product specifications"
knowledge_base_id: 123
exclude_file_ids: [12, 34]
top_k: 10
```

Search while excluding old or deprecated documents.

### Technical documentation lookup

```
query: "API authentication methods"
knowledge_base_id: 789
top_k: 5
```

Find specific technical information from documentation collections.

## Best practices

* Use specific, descriptive queries for better results
* Start with broader searches, then use file filtering to narrow down
* Monitor similarity scores to gauge result quality
* Organize knowledge bases by topic for more focused searches
* Regularly update knowledge bases by removing outdated documents

## Troubleshooting

**"No results found"**

* Try broader or alternative search terms
* Check that the knowledge base contains relevant documents
* Verify the knowledge base ID is correct

**"Knowledge base not found"**

* Confirm the knowledge base ID exists in your organization
* Check that you have access to the specified knowledge base
* Ensure the knowledge base has been successfully created

**"Low similarity scores"**

* Try rephrasing your query with different keywords
* Use more specific terms related to your content
* Check that your documents contain the information you're searching for

**"File filtering not working"**

* Verify that the file IDs exist in the knowledge base
* Check that include/exclude file ID arrays are properly formatted
* Ensure files haven't been deleted from the knowledge base

## Related tools

* [Call API](/tools/call_api) - Fetch external data to supplement knowledge base searches
* [Run Code](/tools/execute_python) - Process and analyze search results
* [Send Email](/tools/send_email) - Share search results with team members
