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

# Knowledge API Skill

> Perform semantic search across the organization's knowledge base using vector embeddings and natural language queries.

<CardGroup cols={2}>
  <Card title="Type" icon="tag">
    `knowledge_api`
  </Card>

  <Card title="Technology" icon="brain">
    Vector Search & Embeddings
  </Card>
</CardGroup>

**Purpose:** The Knowledge API skill enables agents to perform semantic search across your organization's knowledge base using natural language, finding relevant information from documentation, policies, tickets, and more.

***

## Common Use Cases

<CardGroup cols={2}>
  <Card icon="book">
    **Searching documentation**

    Find relevant guides, API docs, runbooks, and technical documentation
  </Card>

  <Card icon="file-contract">
    **Finding relevant policies**

    Discover compliance requirements, security policies, and procedures
  </Card>

  <Card icon="magnifying-glass">
    **Discovering similar issues**

    Find past tickets, incidents, and resolutions for similar problems
  </Card>

  <Card icon="brain">
    **Context-aware retrieval**

    Retrieve information based on meaning, not just keywords
  </Card>
</CardGroup>

***

## How It Works

<Steps>
  <Step title="Content Ingestion">
    Knowledge sources are indexed: documentation sites, code repositories, ticketing systems, communication archives
  </Step>

  <Step title="Embedding Generation">
    Text is converted to vector embeddings that capture semantic meaning
  </Step>

  <Step title="Semantic Search">
    Queries are converted to embeddings, matched with similar content, and ranked by relevance
  </Step>

  <Step title="Reranking (Optional)">
    Results can be reranked using advanced models for better accuracy
  </Step>
</Steps>

***

## Configuration

**Example Configuration:**

```json theme={null}
{
  "knowledge_sources": ["docs", "code"],
  "max_results": 10,
  "similarity_threshold": 0.7,
  "enable_reranking": true,
  "include_snippets": true
}
```

<AccordionGroup>
  <Accordion title="📋 Full Configuration Reference" icon="gear">
    | Parameter              | Type    | Default  | Description                      |
    | ---------------------- | ------- | -------- | -------------------------------- |
    | `knowledge_sources`    | array   | \[]      | Which sources to search          |
    | `max_results`          | number  | 10       | Maximum results to return        |
    | `similarity_threshold` | number  | 0.7      | Minimum similarity score (0-1)   |
    | `enable_reranking`     | boolean | true     | Use reranking for better results |
    | `reranking_model`      | string  | "cohere" | Reranking model to use           |
    | `filter_by_date`       | boolean | false    | Filter to recent content only    |
    | `days_lookback`        | number  | 90       | How many days back to search     |
    | `include_snippets`     | boolean | true     | Include content excerpts         |
    | `snippet_length`       | number  | 200      | Characters per snippet           |
    | `include_metadata`     | boolean | true     | Include source, date, author     |
  </Accordion>
</AccordionGroup>

***

## Quick Start

```bash theme={null}
# Create skill
kubiya skill create --name "Knowledge Search" --type knowledge_api --enabled

# Associate with agent
kubiya skill associate agent <agent-id> <skill-id>
```

<Card title="View Complete Examples" icon="lightbulb" href="/core-concepts/skills/examples#knowledge-search">
  See full search patterns, incident response queries, and policy compliance examples
</Card>

***

## Query Examples

### Technical Documentation

**Query:**

```
"How do I configure authentication in the API?"
```

**Results:**

```json theme={null}
{
  "results": [
    {
      "title": "API Authentication Guide",
      "source": "docs",
      "similarity_score": 0.92,
      "snippet": "To configure authentication, add the following to your API configuration: Set JWT_SECRET environment variable...",
      "url": "https://docs.company.com/api/auth"
    }
  ]
}
```

### Past Incidents

**Query:**

```
"Database connection pool exhaustion causing API timeouts"
```

**Results:**

```json theme={null}
{
  "results": [
    {
      "title": "INC-4567: API Timeouts Due to Connection Pool",
      "source": "tickets",
      "similarity_score": 0.94,
      "snippet": "Root cause: Connection pool size set to 10, insufficient for traffic. Resolution: Increased pool size to 50..."
    }
  ]
}
```

### Policy Compliance

**Query:**

```
"What are the data retention requirements for customer information?"
```

**Results:**

```json theme={null}
{
  "results": [
    {
      "title": "Data Retention Policy",
      "source": "policies",
      "similarity_score": 0.96,
      "snippet": "Customer personal data must be retained for 7 years after account closure per GDPR requirements..."
    }
  ]
}
```

***

## Security Best Practices

<AccordionGroup>
  <Accordion title="Restrict Knowledge Sources" icon="filter">
    Limit `knowledge_sources` to only necessary sources.

    ```json theme={null}
    "knowledge_sources": ["docs", "policies"]  # Not all sources
    ```
  </Accordion>

  <Accordion title="Set Similarity Threshold" icon="gauge-simple">
    Use appropriate `similarity_threshold` to ensure quality results.

    ```json theme={null}
    "similarity_threshold": 0.75  # Higher threshold = more relevant results
    ```
  </Accordion>

  <Accordion title="Filter Sensitive Content" icon="shield-check">
    Use metadata filters to exclude sensitive or restricted content.

    ```json theme={null}
    metadata_filters:
      classification: ["public", "internal"]  # Exclude confidential
    ```
  </Accordion>
</AccordionGroup>

<Tip>
  **Best Practice:** Enable reranking for customer-facing agents to ensure the most accurate results.
</Tip>

***

## Troubleshooting & Related Skills

<AccordionGroup>
  <Accordion title="No Results Found" icon="magnifying-glass-minus">
    **Solutions:**

    * Lower `similarity_threshold` value
    * Check knowledge sources are indexed and syncing
    * Verify query isn't too specific
  </Accordion>

  <Accordion title="Irrelevant Results" icon="ban">
    **Solutions:**

    * Increase `similarity_threshold` for higher quality
    * Enable reranking for better relevance
    * Use more specific query phrasing
  </Accordion>

  <Accordion title="Slow Search Performance" icon="hourglass-end">
    **Solutions:**

    * Reduce `max_results` value
    * Disable reranking if not needed
    * Limit `knowledge_sources` to fewer sources
  </Accordion>
</AccordionGroup>

### Related Skills

<CardGroup cols={2}>
  <Card title="Contextual Awareness" icon="sitemap" href="/core-concepts/skills/contextual-awareness">
    Query structured data in context graph
  </Card>

  <Card title="Agent Communication" icon="users" href="/core-concepts/skills/agent-communication">
    Delegate to knowledge-specific agents
  </Card>

  <Card title="Python Skill" icon="python" href="/core-concepts/skills/python">
    Process and analyze search results
  </Card>

  <Card title="View All Skills" icon="layer-group" href="/core-concepts/skills/built-in-skills">
    Return to built-in skills overview
  </Card>
</CardGroup>
