Audifact
RAG + AGENTIC

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

THE PROBLEM

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.

GETTING STARTED

Installation

SDK + LlamaIndex
pip install "audifact-sdk[llamaindex]" "llama-index>=0.10.0"
Uses AudifactLlamaIndexTracer — drop-in .wrap() for QueryEngine, Retriever, and Agent
Run the example
python sdk/examples/enterprise/llamaindex_rag_and_agent.py AUDIFACT_API_KEY=af_YOUR_KEY python ...
Demo mode without API key; real signed events when AUDIFACT_API_KEY is set
PRODUCTION-READY EXAMPLES

Auditable LlamaIndex Workflows

Privacy by default: include_context=False emits hashes + lightweight metadata. Set include_context=True to capture retrieved nodes, tool calls, and structured outputs in context_json / output_json.
BASIC RAG

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)
include_context=True adds retrieved node ids, scores, and content to output_json. Pydantic answers land cleanly via model_dump().
full source →

Traces QueryEngine.query / .aquery and Retriever.retrieve

AGENTIC RAG

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
Captures tool_calls, sources, hybrid source_nodes, and structured Pydantic responses when present.
full source →

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.

TRANSPARENCY

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.

🔎
Retrieval
decision_type: retrieval
QueryEngine.query / Retriever.retrieve
input_hash: a3f9c2e1
public_decision: human-readable query
Recorded in explorer
📄
RAG Response
outcome_type: response / retrieved
retrieved_nodes: id, score, content
Pydantic output_cls → output_json
duration_ms + num_source_nodes
Linked to retrieval decision
🤖
Agent Execution
decision_type: agent_execution
agent_name + run_id
chat / run input captured
Tool-using agent turn start
Tamper-evident turn
🔧
Agent Response
outcome_type: agent_response
tool_calls + sources captured
structured Pydantic in output_json
final response + duration_ms
Cryptographically signed
All events visible in the Explorer with full hash chain verification.
WHY ENTERPRISE CHOOSES AUDIFACT + LLAMAINDEX

Cryptographic guarantees for RAG and agentic systems

Tamper-evident ledger

Every retrieval, generation, and tool call is hash-chained. Any alteration breaks verification.

Regulatory readiness

Prove exactly which documents informed an answer — exportable proofs for auditors and compliance teams.

Structured output capture

Pydantic models from output_cls land cleanly in output_json for replay and validation.

Privacy-aware context

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.