An evidence graph for messy artifacts, built on AgentField and baidu/Unlimited-OCR
One-Call DX • Output • Why a graph • How It Works • Quick Start • Ask
Naive RAG chunks text and hopes similarity search finds the right piece. Ragpack AF builds an evidence graph first, then answers only from it, with a citation for every claim. It reads PDFs, scans, filings, emails, and logs, pulls out entities, claims, metrics, and events, and links them by support, contradiction, causality, and time. The contradictions and causal chains that sit in separate chunks (and stay invisible to a vector search) become explicit, cited edges.
The demo runs on public Tesla Q1 2025 SEC filings. It organizes evidence; it is not investment advice.
Drive it with the af CLI (requires af ≥ 0.1.87). It streams live progress and prints the result.
Build a set of artifacts into an evidence graph and a queryable packet:
af call ragpack-af.build_ragpack --in "$(jq -c .input demo_payload_earnings_receipts.json)"The build prints a packet_id. Ask a question against the stored packet (small input, pass it inline):
af call ragpack-af.answer_packet_question \
--in '{"packet_id": "ragpack_f53a1065758d5841", "question": "What evidence connects Tesla Q1 revenue decline to management stated risks?"}'Prefer raw HTTP? Hit the API directly with curl. The committed payload is already wrapped for the REST endpoint:
curl -X POST http://localhost:8080/api/v1/execute/async/ragpack-af.build_ragpack \
-H "Content-Type: application/json" \
-d @demo_payload_earnings_receipts.jsonOne build over three SEC filings, verified end to end:
| Metric | Value |
|---|---|
| Public artifacts | 3 |
| Graph nodes | 128 |
| Graph edges | 156 |
| Typed evidence relations | 31 |
| Relation modes | support, contradiction, causality, temporal |
| RAG chunks | 284 |
| Build run | succeeded in 150.6s |
| Query run | succeeded in 24.1s |
This is the backbone of the run: 31 typed relations linking 28 claims across 3 filings. The red edges are contradictions the filings carry against themselves. The 8-K claim "successful ramp without major disruptions" sits one red edge from the 10-Q's "simultaneous factory shutdowns for the New Model Y changeover." The blue edges trace causality from that line changeover to the 21% drop in automotive revenue. A chunk-similarity search returns neither. (Full graph: demo_outputs/earnings-receipts/graph.json.)
answer_packet_question reads only the retrieved packet chunks and returns its sources:
Every answer carries the chunk and artifact ids it used, a confidence, and what it could not find. No silent gap-filling.
Saved outputs from this run:
earnings_receipts_graph.png· the rendered evidence graphgraph.json· nodes, edges, evidence, provenancellm_packet.json· the stable RAG packetpacket_answer.json· the cited answer above
| Naive RAG | Ragpack AF |
|---|---|
| Splits text into chunks, embeds, retrieves by similarity | Extracts entities, claims, metrics, and events, then links them |
| No provenance: you trust whatever chunk came back | Every node carries a sha256 and the source artifact id |
| Cannot reason across documents | Typed edges connect claims across separate filings |
| Contradictions hide in unrelated chunks | Contradictions are explicit, queryable edges |
| Answers can drift past the evidence | Answers cite chunk and artifact ids, or report the gap |
The graph is the product. The packet is the graph, chunked and indexed so the next agent retrieves evidence instead of guessing.
Ragpack AF is a multi-reasoner AgentField system, not one giant prompt. Each step is a focused reasoner the orchestrator composes and verifies (the reasoning behind that choice: The Atomic Unit of Intelligence).
| Phase | Reasoner | Role |
|---|---|---|
| Intake | normalize_and_extract_artifacts |
Fetch text, or call the SGLang baidu/Unlimited-OCR sidecar for visual artifacts |
| Signal mining | analyze_artifact |
One artifact at a time, fan out into triage plus six signal miners (entities, states, events, claims, controls, metrics) |
| Dynamic planning | plan_relation_modes |
Choose relation specialists from the actual artifact summaries |
| Relation extraction | extract_relation_mode |
Run only the selected modes |
| Graph build | merge_graph |
Assemble graph JSON deterministically (no LLM writes the final graph) |
| Review | verify_graph_evidence, find_graph_gaps |
Flag unsupported edges and missing artifacts |
| Packet export | export_llm_packet, store_llm_packet |
Build stable chunks, store them in AgentField memory under ragpack.packet.<id> |
| Ask later | answer_packet_question |
Retrieve by packet_id and answer with citations |
Reasoning runs in the LLM. Scoring, deduplication, and graph assembly run in code.
git clone https://github.com/Agent-Field/ragpack-af.git
cd ragpack-af
cp .env.example .env
# add OPENROUTER_API_KEY (or another provider key)
docker compose up --buildThen open:
With the stack up, build a packet, then ask it a question:
# 1. Build the evidence graph + packet from public artifacts (prints a packet_id)
af call ragpack-af.build_ragpack --in "$(jq -c .input demo_payload_earnings_receipts.json)"
# 2. Ask a question against that packet (use the packet_id from step 1)
af call ragpack-af.answer_packet_question \
--in '{"packet_id": "<packet_id>", "question": "What evidence connects Tesla Q1 revenue decline to management stated risks?"}'The default OCR_BACKEND=text runs on a laptop and in CI, no GPU required. If local ports are taken:
AGENTFIELD_HTTP_PORT=28080 AGENT_NODE_PORT=28001 docker compose up --buildPoint the CLI at a non-default control plane with af call -s http://localhost:28080 ....
Refresh the public SEC payload (optional, one is committed):
python scripts/fetch_earnings_receipts_data.py --out demo_payload_earnings_receipts.jsonBuild the graph and packet:
python scripts/run_demo.py \
--server http://localhost:8080 \
--payload demo_payload_earnings_receipts.json \
--out-dir demo_outputs/earnings-receiptsRender the evidence graph (writes a self-contained HTML you can open or screenshot):
python scripts/render_graph.py \
--graph demo_outputs/earnings-receipts/graph.json \
--out assets/evidence_graph.html
# the committed PNG is a headless screenshot of that page:
# node scripts/shoot_graph.cjs assets/evidence_graph.html assets/evidence_graph.pngThe build stores the packet in AgentField memory:
{
"packet_id": "ragpack_f53a1065758d5841",
"memory_key": "ragpack.packet.ragpack_f53a1065758d5841"
}Query it. The reasoner answers only from retrieved chunks and cites them:
python scripts/query_packet.py \
--server http://localhost:8080 \
--packet-file demo_outputs/earnings-receipts/llm_packet.json \
--question "What evidence connects Tesla's Q1 2025 revenue decline to management's stated risks, and what is still missing?"OCR_BACKEND=text fetches textual web artifacts directly. For images, scans, and screenshots, enable the GPU OCR sidecar:
OCR_BACKEND=sglang docker compose --profile gpu-ocr up --buildThe sidecar serves baidu/Unlimited-OCR through SGLang. AgentField still deploys as one node: OCR is a perception backend feeding the same graph and packet pipeline. Visual parsing happens first, then AgentField adds provenance, memory, retrieval, and citations.
python3 -m py_compile main.py reasoners/*.py scripts/*.py
docker compose config
curl -fsS http://localhost:8080/api/v1/discovery/capabilities \
| jq '.capabilities[] | select(.agent_id=="ragpack-af") | {
agent_id,
entry: [.reasoners[] | select(.tags[]? == "entry") | .id],
rag: [.reasoners[] | select(.tags[]? == "rag") | .id]
}'Inspect the signed workflow chain for any run:
curl -fsS http://localhost:8080/api/v1/did/workflow/<workflow_id>/vc-chain | jq- Tesla Q1 2025 8-K shareholder update (SEC EDGAR).
- Tesla Q1 2025 10-Q sections (SEC EDGAR).
- Tesla selected XBRL company facts (
data.sec.gov).
Market price endpoints are intentionally left out: they are brittle and frequently bot-gated, and the demo does not need them.
SEC-AF · AI-native security auditor. Every finding ships with a verdict, a data-flow trace, and proof of exploitability.
SWE-AF · Autonomous engineering team. One API call ships planned, coded, tested, reviewed code.
Contract-AF · Legal contract risk analyzer. Agents spawn agents to find clause interactions solo LLMs miss.
Ragpack AF is built on AgentField, open infrastructure for production-grade autonomous agents. See what else we're building →



{ "answer": "Evidence from the Tesla Q1 2025 10-Q (artifact_2) directly shows the revenue decline: automotive sales revenue decreased $3.54 billion (21%) and total revenues decreased 9%. The filing attributes the decline partly to New Model Y factory shutdowns, lower average selling price, and US dollar strengthening, which are management-identified risk factors. The earnings 8-K (artifact_1) mentions managing supply chains without major disruptions...", "cited_chunk_ids": [ "edge::edge_972be889e060", "edge::edge_dc74cd21d8cf", "edge::edge_ad4a5444766a", "edge::edge_be4f1b6d140e", "edge::edge_31ee2d96f503" ], "cited_artifact_ids": ["artifact_1", "artifact_2"], "confidence": 0.7, "missing_evidence": [ "Vehicle production/delivery by model", "Management Q&A context from earnings call", "Detailed risk factor breakdown for trade policy and demand risks" ] }