agent-search supercharges your RAG flow by improving accuracy with our open-source framework, backed by the Onyx team’s work on agentic search with LangGraph: https://onyx.app/blog/agent-search-with-langgraph?ref=blog.langchain.com.
Onyx builds AI search and knowledge experiences for teams that need dependable, source-grounded answers. Agent-search distills those production learnings into a developer SDK so you can ship more reliable retrieval flows without rebuilding the orchestration stack from scratch.
If you want more about the motivations behind the system, the runtime tradeoffs, and why certain design choices are opinionated, start with the live GitHub Pages essay: https://nickbohm555.github.io/agent-search/architecture.html.
If you do not have much time to read, the basic idea is simple: take a large question, break it into subquestions, answer each one with stronger RAG techniques, optionally let a human review the subquestions, and then synthesize everything into one final answer. The flow below shows that path.
flowchart TD
Q["Main question"] --> D["Decompose"]
D --> HITL{"Subquestion HITL?"}
HITL -->|On| REV["Review / edit subquestions"]
HITL -->|Off| SQ["Subquestions"]
REV --> SQ
SQ --> S1["Subquestion 1"]
SQ --> S2["Subquestion 2"]
SQ --> S3["Subquestion N"]
S1 --> QE1{"Subquery expansion?"}
QE1 -->|On| EXP1["Expand query"]
QE1 -->|Off| RET1["Retrieve evidence"]
EXP1 --> RET1
RET1 --> RR1{"Rerank?"}
RR1 -->|On| RERANK1["Rerank results"]
RR1 -->|Off| ANS1["Answer subquestion"]
RERANK1 --> ANS1
CP1["Custom prompt: subquestion answers"] -.-> ANS1
ANS1 --> SA1["Sub-answer + citations"]
S2 --> QE2{"Subquery expansion?"}
QE2 -->|On| EXP2["Expand query"]
QE2 -->|Off| RET2["Retrieve evidence"]
EXP2 --> RET2
RET2 --> RR2{"Rerank?"}
RR2 -->|On| RERANK2["Rerank results"]
RR2 -->|Off| ANS2["Answer subquestion"]
RERANK2 --> ANS2
CP1 -.-> ANS2
ANS2 --> SA2["Sub-answer + citations"]
S3 --> QE3{"Subquery expansion?"}
QE3 -->|On| EXP3["Expand query"]
QE3 -->|Off| RET3["Retrieve evidence"]
EXP3 --> RET3
RET3 --> RR3{"Rerank?"}
RR3 -->|On| RERANK3["Rerank results"]
RR3 -->|Off| ANS3["Answer subquestion"]
RERANK3 --> ANS3
CP1 -.-> ANS3
ANS3 --> SA3["Sub-answer + citations"]
SA1 --> SYN["Final synthesis"]
SA2 --> SYN
SA3 --> SYN
CP2["Custom prompt: synthesis"] -.-> SYN
SYN --> OUT["Final answer"]
For the full, canonical SDK docs, see https://pypi.org/project/agent-search-sdk/.
The PyPI package is an in-process Python SDK for agent-search. It is intentionally narrow: consumers should call advanced_rag(...) and treat that as the supported entrypoint. The SDK always requires both:
- A chat model (for example
langchain_openai.ChatOpenAI) - A vector store that implements
similarity_search(query, k, filter=None)
It does not auto-build these dependencies for you.
Install (PyPI)
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install agent-search-sdk
python -c "import agent_search; print(agent_search.__file__)"Quick Start
from langchain_openai import ChatOpenAI
from agent_search import advanced_rag
from agent_search.vectorstore.langchain_adapter import LangChainVectorStoreAdapter
vector_store = LangChainVectorStoreAdapter(your_langchain_vector_store)
model = ChatOpenAI(model="gpt-4.1-mini", temperature=0.0)
response = advanced_rag(
"What is pgvector?",
vector_store=vector_store,
model=model,
)
print(response.output)Included Features
- Multi-step agentic retrieval: Breaks a large question into subquestions, works them in parallel, and synthesizes a final answer from grounded evidence.
- Subquestion HITL review: Adds one high-leverage human review point so operators can inspect or edit subquestions before the expensive work continues.
- Advanced retrieval controls: Supports optional query expansion and reranking so you can trade off recall, precision, and cost per run.
- Custom prompts: Lets you override subanswer and synthesis instructions so you can tune output behavior without replacing the runtime’s evidence wiring.
- Resumable runtime: Supports checkpointed pause-and-resume flows for HITL runs so work can continue without restarting the graph.
