Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add latestaiagents/agent-skills --skill agentic-raggit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/latestaiagents/agent-skills/agentic-rag)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/agentic-rag"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/agentic-rag.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00063 | $0.01936 |
| Opus 5 | $0.00032 | $0.00968 |
| Sonnet 5 | $0.00013 | $0.00387 |
| Haiku 4.5 | $0.00006 | $0.00194 |
Grade A, and why
agentic-rag scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 271 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agentic RAG
Build RAG systems that reason, plan, and adaptively retrieve information.
When to Use
- Questions require multiple retrieval steps
- Need to combine information from different sources
- Query needs decomposition into sub-queries
- Results need validation or refinement
- Complex reasoning over retrieved documents
Simple RAG vs Agentic RAG
Simple RAG:
Query → Retrieve → Generate → Answer
Agentic RAG:
Query → Plan → [Retrieve → Analyze → Decide]*n → Synthesize → Answer
Core Architecture
┌─────────────────────────────────────────────────────────┐
│ User Question │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌───────────────────┐
│ Query Analyzer │
│ (Decompose?) │
└─────────┬─────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Sub-Q 1 │ │ Sub-Q 2 │ │ Sub-Q 3 │
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Retrieve │ │ Retrieve │ │ Retrieve │
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ │ │
└───────────────┼───────────────┘
│
▼
┌───────────────────┐
│ Synthesizer │
│ (Combine & Cite) │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Final Answer │
└───────────────────┘
Implementation with LangGraph
from langgraph.graph import StateGraph, END
from langchain_openai import ChatOpenAI
from typing import TypedDict, List, Annotated
import operator
class AgentState(TypedDict):
question: str
sub_questions: List[str]
retrieved_docs: Annotated[List, operator.add]
current_step: int
final_answer: str
# Nodes
def analyze_query(state: AgentState) -> AgentState:
"""Decompose complex query into sub-questions."""
llm = ChatOpenAI(model="gpt-4")
prompt = f"""Analyze this question and break it into sub-questions if needed.
Question: {state['question']}
Return a JSON list of sub-questions, or just the original if simple."""
response = llm.invoke(prompt)
sub_questions = parse_questions(response.content)
return {"sub_questions": sub_questions, "current_step": 0}
def retrieve_for_subquery(state: AgentState) -> AgentState:
"""Retrieve documents for current sub-question."""
current_q = state["sub_questions"][state["current_step"]]
docs = retriever.invoke(current_q)
return {
"retrieved_docs": docs,
"current_step": state["current_step"] + 1
}
def should_continue(state: AgentState) -> str:
"""Check if more sub-questions to process."""
if state["current_step"] < len(state["sub_questions"]):
return "retrieve"
return "synthesize"
def synthesize_answer(state: AgentState) -> AgentState:
"""Combine all retrieved info into final answer."""
llm = ChatOpenAI(model="gpt-4")
context = "\n\n".join([doc.page_content for doc in state["retrieved_docs"]])
prompt = f"""Based on the following context, answer the question.
Cite sources using [1], [2], etc.
Question: {state['question']}
Context:
{context}
"""
response = llm.invoke(prompt)
return {"final_answer": response.content}
# Build graph
workflow = StateGraph(AgentState)
workflow.add_node("analyze", analyze_query)
workflow.add_node("retrieve", retrieve_for_subquery)
workflow.add_node("synthesize", synthesize_answer)
workflow.set_entry_point("analyze")
workflow.add_edge("analyze", "retrieve")
workflow.add_conditional_edges("retrieve", should_continue, {
"retrieve": "retrieve",
"synthesize": "synthesize"
})
workflow.add_edge("synthesize", END)
agent = workflow.compile()
# Run
result = agent.invoke({"question": "Compare AWS and GCP pricing for ML workloads"})
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 271 lines · 63 tokens per session scan A 9915cb27e9f2
agentic-rag is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 63 tokens to every session and 1,936 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
mem0-integration
Mem0 memory layer integration for AI agents. Implement persistent, semantic memory for long-term context retention and personalization.
vector-memory
HNSW vector search for pattern similarity retrieval and knowledge graph maintenance with PageRank scoring, community detection, and 3-tier memory management.
chroma-integration
Chroma local vector database setup and operations for development and production.
haystack-pipeline
Haystack NLP pipeline configuration for document processing and QA.
langchain-retriever
LangChain retriever implementation with various retrieval strategies for RAG applications.
llamaindex-agent
LlamaIndex agent and query engine setup for RAG-powered agents.