benchen4395 GitHub avatar

alpha_agentic_search

benchen4395

Alpha Agentic Search is a production-ready, teachable, and runnable agentic search framework with a 5-layer memory RAG stack (L1–L5) that follows a Route→Rewrite→Retrieve→Read pipeline to deliver stable, controllable, low-latency search, inspired by Perplexity and already deployed in Kuaishou AI Search.

Stars

15

7-day growth

No data

Forks

0

Open issues

0

License

No data

Last updated

2026-07-28

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It stands out for its hierarchical memory design (L1–L5) that makes search improve over time, a fully configurable multi-stage architecture where each stage (router/rewriter/retriever/answer) can independently choose a provider and prompt, and the transparent execution event mechanism that shows all pipeline steps with timing, all open-sourced under MIT license.

Who it is for

  • AI search beginners
  • AI engineers seeking a practical framework
  • AI search architects
  • Hobbyists wanting to build personal search assistants

Use cases

  • Building a personal search assistant that learns from history
  • Creating an enterprise QA system with offline and online retrieval
  • Researching academic papers via RAG on Wikipedia and Wikidata
  • Providing real-time answers with web search and knowledge graph integration

Strengths

  • 5-layer memory RAG (QA cache, commonsense, history, web, knowledge graph) for progressive improvement
  • Modular, no-hard-code configuration: each stage can switch model/provider/prompt independently
  • Claude Code-style execution events transparently display every pipeline step with latency
  • Supports both local (Ollama) and remote LLMs (OpenAI-compatible), with fallback strategies for retrieval layers

Considerations

  • Current multi-hop search still leans on single-turn retrieval with fuzzy matching; precise multi-hop agent loop is pending
  • L2 (Wikipedia) and L5 (Knowledge Graph) require offline indexing before they can return results; without indexing they fall back empty
  • Documentation and README are primarily in Chinese, which may pose a barrier for non-Chinese users

README quick start

Alpha Agentic Search — 分层记忆 RAG 检索问答系统

说在前面的话:

自agent被提出以来,学术界有太多的search agent框架:从最开始的search r1,到后面各种用于刷榜的web search。各位同行大佬们的奇思妙想都给我们无尽的思考;但对工业界、AI搜初学者、以及想搭建个人搜索助手极客们,层次化、稳定可控、耗时短,永远是最基础的需求。

业界那么多AI搜索应用,真正火出圈的也就perplexity、秘塔等;一个很重要的点:如何让你的搜索越用越好用,搭建一套完整的多级检索和自动更新的harness框架,可能远比单个模型优化、或者高耗时容忍的multi-agent自进化更重要。

我们这里开源 Alpha Agentic Search (AAS) 框架,它主打的就是“稳定、可控、低耗时”!并在快手AI搜上面有了相应的落地。无论你是一名初学者,一位刚入行的AI工程师,还是一位资深AI搜索架构师,相信这套系统对您都有所启发。


简介:

一个可运行、可教学、也可作生产原型的 Agentic Search 项目: 用 Route → Rewrite → Retrieve → Read 的经典链路做联网问答, 并在检索侧接入了一套 5 层记忆 RAG 栈(L1–L5),实现 Perplexity 式的 “越用越强”

两大设计原则:

  1. 多 Provider / 多 Stage:每个阶段(路由 / 改写 / 回答)都能独立选模型、改 prompt,业务代码零硬编码。
  2. 统一向量空间:L1–L5 全部使用 FlagEmbedding BGE-M3 编码,跨层可比、可融合。

二期优化点:(未来一个月内)

  1. 多跳搜索的精准实现:当前依然倾向于单轮检索 (+模糊搜索实现的多跳问答);后续会增加 Controllableloop agent;
  2. 多模态 / 富媒体搜索:未来考虑”返回图片、表格、代码块”多模态搜索;并支持答案的图片来源和Markdown 表格渲染。

1. 快速开始

# 1) 本地 LLM(router / rewriter 阶段默认走 ollama)
ollama pull qwen3:4b-instruct-2507-q8_0
ollama serve

# 2) 依赖(建议在 conda 环境 search-agent 中安装)
pip install -r requirements.txt

# 3) summary 阶段默认走 DeepSeek(OpenAI 兼容协议)
export DEEPSEEK_API_KEY="sk-xxx"

# 4) 启动(CLI);启动会打印当前各 stage 使用的模型
python main.py

# 或启动 Web 图形界面(Gradio)
python main_web.py --port 7860

说明:RAG 的 L2/L5 需要离线索引才会真正召回;未构建索引时这两层自然返回空, 系统仍可正常用 L1/L3/L4 工作。索引构建见 rag/README.md §3.3。

CLI 内置命令:config(查看模型配置)、clear(清空记忆)、:stream on|off(切换流式)、exit

Claude Code 风格的执行透明化:CLI 与 Web 都会把 Agent 的每个流水线步骤 (路由 / 改写 / 检索 / 回答)实时展示出来并标注 ⏱️ 耗时。

  • CLI:每步以 🔀 工具路由 → ... ⏱️ 120ms 的形式打印为一行 trace。
  • Web:每步渲染为一个可折叠的步骤块,最终回答在其下方流式输出; 界面为宽扁单屏布局(左侧聊天、右侧配置栏),无需下滑即可看到输入框与全部控件。

详见 §2.1「执行事件机制」。


2. 系统架构

                         ┌──────────────────────────────┐
   用户输入  ──────────► │ main.py (CLI) / main_web.py(Web)│
                         └───────────────┬──────────────┘
                                         ▼
                         ┌──────────────────────────────┐
                         │  agent.py  AgenticSearchAgent  │  主控编排
                         └───────────────┬──────────────┘
                                         │
     ┌──────────────┬───────────────────┼───────────────────┬──────────────┐
     ▼

Description

Alpha Agentic Search — 分层记忆 RAG 检索问答系统

Related repositories

Similar projects matched by category, topics, and programming language.

makecindy
Featured
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI & Machine LearningLarge Language Models
958
uzairansaruzi
Featured
uzairansaruzi GitHub avatar

hermex

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

AI & Machine LearningLarge Language Models
941
hahhforest
Featured
hahhforest GitHub avatar

pi-textbook

A hands-on course that walks through building a Pi-style coding agent from scratch across 15 checkpoints, starting from an offline agent trajectory.

AI & Machine LearningLarge Language Models
625