Auditable RAG & Agentic
Workflows with LlamaIndex
Enterprise retrieval-augmented generation with cryptographic audit trails. Every query, retrieved node, tool call, structured output, and final response — permanently recorded and verifiable.
No credit card required • Cryptographic proofs included
RAG systems retrieve and generate —
but proving what was retrieved and why is hard.
Regulatory Compliance
When agents answer from private documents, auditors need immutable records of the query, source chunks, and the generated answer — not just the final text.
Retrieval Provenance
Hallucinations and stale data create liability. Enterprises need tamper-proof evidence of which nodes were retrieved, scored, and passed to the LLM at decision time.
Agentic Traceability
Tool-using agents chain retrieval, search, and synthesis. Stakeholders need verifiable trails of every tool invocation and structured output along the way.
Installation
pip install "audifact-sdk[llamaindex]" "llama-index>=0.10.0"
python sdk/examples/frameworks/llamaindex_rag_and_agent.py
AUDIFACT_API_KEY=af_YOUR_KEY python ...
Auditable LlamaIndex Workflows
QueryEngine — retrieval + generation
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from pydantic import BaseModel, Field
from audifact.llamaindex import AudifactLlamaIndexTracer
class Answer(BaseModel):
answer: str
confidence: float = Field(..., ge=0.0, le=1.0)
documents = SimpleDirectoryReader("contracts").load_data()
index = VectorStoreIndex.from_documents(documents)
# Optional structured output via output_cls=
query_engine = index.as_query_engine(output_cls=Answer)
tracer = AudifactLlamaIndexTracer(
api_key="af_YOUR_API_KEY",
agent_name="contract-rag",
# include_context=False # default: hashes + metadata only
)
traced = tracer.wrap(query_engine)
response = traced.query(
"What is the liability cap and indemnification period?"
)
# Emits: retrieval (decision) → response (outcome)
Traces QueryEngine.query / .aquery and Retriever.retrieve
ReActAgent, FunctionAgent & tool-using agents
from llama_index.core.agent import ReActAgent # FunctionAgent, OpenAIAgent, etc.
from llama_index.core.tools import FunctionTool
from audifact.llamaindex import AudifactLlamaIndexTracer
# Works with any LlamaIndex agent exposing .chat / .run
tools = [
FunctionTool.from_defaults(fn=web_search),
FunctionTool.from_defaults(fn=summarize_docs),
]
agent = ReActAgent.from_tools(tools, llm=..., verbose=True)
tracer = AudifactLlamaIndexTracer(
api_key="af_YOUR_API_KEY",
agent_name="research-agent",
include_context=True, # tool_calls + sources in output_json
)
traced_agent = tracer.wrap(agent)
response = traced_agent.chat(
"Research RAG agent adoption and summarize with sources."
)
# Emits: agent_execution → agent_response
Traces ReActAgent, FunctionAgent, and any agent with .chat / .run
Safe demo — nothing written to ledger. Use your real API key to record production RAG and agent runs.
Every retrieval and generation step is captured
Structured decisions and outcomes with cryptographic hashes. Full document content only when you opt in with include_context=True.
Cryptographic guarantees for RAG and agentic systems
Every retrieval, generation, and tool call is hash-chained. Any alteration breaks verification.
Prove exactly which documents informed an answer — exportable proofs for auditors and compliance teams.
Pydantic models from output_cls land cleanly in output_json for replay and validation.
Default hashes-only mode protects sensitive corpora. Opt in to full retrieval context when audit requires it.
Prove every retrieval.
Sign every answer.
One line of .wrap() — full audit trails for RAG and agentic LlamaIndex workflows. No credit card required.
Enterprise plans include dedicated support, custom retention, and on-prem options.