Example

The following agent can search and analyze knowledge bases:
from agno.agent import Agent
from agno.tools.knowledge import KnowledgeTools
from agno.knowledge import Knowledge

# Initialize knowledge base
knowledge = Knowledge()
knowledge.load_documents("./docs/")

agent = Agent(
    instructions=[
        "You are a knowledge assistant that helps find and analyze information",
        "Search through the knowledge base to answer questions",
        "Provide detailed analysis and reasoning about the information found",
        "Always cite your sources and explain your reasoning",
    ],
    tools=[KnowledgeTools(knowledge=knowledge)],
)

agent.print_response("What are the best practices for API design?", stream=True)

Toolkit Params

ParameterTypeDefaultDescription
knowledgeKnowledgeNoneKnowledge base instance (required).
enable_thinkboolTrueEnable reasoning capabilities.
enable_searchboolTrueEnable knowledge search functionality.
enable_analyzeboolTrueEnable knowledge analysis capabilities.
instructionsOptional[str]NoneCustom instructions for knowledge operations.
add_instructionsboolTrueWhether to add instructions to the agent.
add_few_shotboolFalseWhether to include few-shot examples.
few_shot_examplesOptional[str]NoneCustom few-shot examples.

Toolkit Functions

FunctionDescription
thinkApply reasoning to knowledge-based problems and questions.
searchSearch the knowledge base for relevant information.
analyzePerform detailed analysis of knowledge base content.

Developer Resources