Skip to main content

Overview

By default, when you pass a KnowledgeBase as context to a Task, the knowledge base is set up (documents are indexed) and queried automatically (query_knowledge_base=True). To disable automatic RAG retrieval, set query_knowledge_base=False on the Task. This gives you fine-grained control over when the agent receives knowledge base context, letting you:
  • Disable RAG retrieval for specific tasks that don’t need it
  • Index documents once and query selectively across different tasks
  • Mix knowledge-base-aware and knowledge-base-free tasks using the same agent

Usage

Default Behavior (Query Enabled)

By default, query_knowledge_base=True retrieves relevant chunks and injects them into the agent’s context:

Disabling Knowledge Base Query

Set query_knowledge_base=False to skip querying. The knowledge base is still set up but the agent will not receive any RAG context:

Selective Querying Across Tasks

A common pattern is to set up one knowledge base and use it across multiple tasks, querying it only when needed:

Combining with Vector Search Parameters

When query_knowledge_base=True, you can fine-tune the retrieval using vector search parameters on the same Task:
See the Vector Search Tuning page for more details on vector search parameters.