Agno 框架接入 Qdrant 向量库构建智能体知识库
Agno 是支持记忆、知识库、人机协同与 MCP 的多智能体框架,可与 Qdrant 向量数据库配合完成知识存储与检索。文中给出安装依赖、配置连接、创建知识库并挂载到智能体的完整示例。
## 阿格诺 [阿格诺](<https://github.com/agno-agi/agno>) 是一个令人难以置信的快速的多代理框架,运行时间和 UI 。它使您能够构建具有内存,知识, human-in-the-loop 能力, 以及模型背景协议( MCP) 支持的多代理系统 。 您可以以多代理团队( 提供更多自主性) 或步态代理工作流程( 提供更多控制) 来协调代理。 Agno 与 Qdrant 作为知识库的矢量数据库进行无缝协作, 从而可以高效存储和检索您 AI 代理的信息 。 Agno既支持同步操作,也支持同步操作,使得它能够灵活地用于各种使用案例和部署情景. ## 使用量 - 安装所需的依赖关系 ```bash pip install agno qdrant-client ``` - 设置 Qdrant 连接的环境变量 ```bash export QDRANT_API_KEY="<your-qdrant-api-key>" export QDRANT_URL="<your-qdrant-url>" ``` - 创建具有 Qdrant 知识库的代理 ```python import os from agno.agent import Agent from agno.knowledge.knowledge import Knowledge from agno.vectordb.qdrant import Qdrant # Configure Qdrant vector database api_key = os.getenv("QDRANT_API_KEY") qdrant_url = os.getenv("QDRANT_URL") COLLECTION_NAME = "my-knowledge-base" vector_db = Qdrant( collection=COLLECTION_NAME, url=qdrant_url, # or you can just url="http://localhost:6333" api_key=api_key, # (optional) ) # Create a knowledge base with Qdrant knowledge_base = Knowledge( vector_db=vector_db, ) # Add content to the knowledge base knowledge_base.add_content( url="https://example.com/document.pdf" ) # Create an agent with the knowledge base agent = Agent( knowledge=knowledge_base, debug_mode=True, ) # Use the agent response = agent.print_response("What information do you have?") ``` ## 进一步阅读 - [Agno 文档](<https://docs.agno.com/introduction>) - [与 Agno 的 Qdrant 集成](<https://docs.agno.com/integrations/vectordb/qdrant/overview>) - [Qdrant 同步](<https://docs.agno.com/integrations/vectordb/qdrant/usage/async-qdrant-db>) - [Agno GitHub 仓库](<https://github.com/agno-agi/agno>)
查看原始来源