Skip to main content

A document-to-agent-context compiler.

Project description

AgentPack

AgentPack improves the context pipeline for document-grounded agents.

Instead of forcing AI agents to parse messy, disparate file formats (PDFs, CSVs, Markdown, text) at runtime, AgentPack is an offline document-to-agent-context compiler. It takes unstructured knowledge bases, turns them into clean semantic chunks with citations, retrieves the right evidence, and sends only high-signal context to the model.

The Benchmark

Given the same LLM, AgentPack provides better context than raw document stuffing or naive RAG.

I benchmarked AgentPack against standard RAG baselines on 42 complex financial queries from Patronus AI FinanceBench. The results prove that AgentPack reduces context bloat, improves evidence retrieval, preserves citations, and helps the exact same LLM produce more grounded answers.

Benchmark Highlights:

  • 161x Reduction in Token Cost: Cut context token usage from 424k to 2.6k, saving ~$0.10 per query.
  • 2x Context Relevance: Vastly outperformed naive chunking in retrieving semantically complete financial tables.
  • "Lost in the Middle" Prevention: Outperformed raw document stuffing in correctness by preventing the LLM from drowning in noise.

Read the full scientific methodology and results in BENCHMARK.md.

Installation

You can install AgentPack via pip or npm.

Option 1: Using pip (Python)

pip install agent-context-packager

Option 2: Using npm (Node.js/CLI binary)

npm install -g agent-context-packager

Option 3: From Source

git clone https://github.com/Vedant1202/agentpack.git
cd agentpack
python3 -m venv venv
source venv/bin/activate
pip install -e .

Quick Start

1. Scan for Secrets (Recommended)

Before compiling a pack, ensure you aren't accidentally leaking API keys or secrets into the LLM context window. AgentPack automatically installs Yelp's detect-secrets.

detect-secrets scan > .secrets.baseline

2. Compile a Pack

Point AgentPack at any folder containing your documents (.txt, .md, .csv, .pdf).

agentpack pack ./my_docs --out ./agentpack-output

Key Compilation Options:

  • --include "*.md,*.txt": Only pack specific files or extensions.
  • --ignore "tests/,drafts/": Exclude specific directories or files.
  • --remove-empty-lines: Compress text files to save LLM tokens.
  • --no-gitignore: Ignore .gitignore rules and pack everything.

2. Retrieve

AgentPack comes with a built-in hybrid search engine (SQLite FTS5 + FastEmbed vector search) to test your chunks instantly.

agentpack retrieve ./agentpack-output "eligibility criteria" --top-k 5

3. V1 Deterministic Eval

Benchmark AgentPack against naive chunking using our offline evaluation harness.

agentpack eval ./benchmarks/my_dataset

Comprehensive CLI Documentation

AgentPack provides a rich CLI for auditing, validating, and testing your context packs (including Generative QA evaluations).

📖 Read the full CLI Reference

Supported Parsers

  • TXT: Paragraph-aware splitting.
  • Markdown: Semantic heading-aware section path tracking.
  • CSV: Uses Pandas & Tabulate to convert tabular data into Markdown tables.
  • PDF: Accurate page-by-page PyMuPDF extraction.

Architecture Overview

flowchart LR
    Docs[Raw Docs] --> Parsers[Parsers]
    Parsers --> Chunker[Chunker]
    Chunker --> Pack[Context Pack]
    Pack --> Agent[LLM Agent]

For a deep dive into how AgentPack parses, chunks, and indexes data, see Architecture & Internals.

Current Limitations & Roadmap

AgentPack is currently focused on text-based semantic extraction. The following features are on the roadmap but not yet implemented:

  • Image Understanding / Vision: AgentPack does not currently run OCR or vision models on images embedded within PDFs or Markdown files. Images are currently ignored during the parsing phase.
  • Complex Table Structures: While basic CSVs are supported, highly nested or merged-cell tables within PDFs are not perfectly reconstructed yet.
  • Web Crawling: You currently need to provide local files. Direct URL scraping is planned.
  • Cloud Vector DB Integration: Retrieval currently runs locally using SQLite FTS5 and FastEmbed. Connectors for Pinecone, Weaviate, or Qdrant are planned.

Built with ❤️ for Agents.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_context_packager-0.1.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_context_packager-0.1.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file agent_context_packager-0.1.0.tar.gz.

File metadata

  • Download URL: agent_context_packager-0.1.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agent_context_packager-0.1.0.tar.gz
Algorithm Hash digest
SHA256 abe9dc2fb99cee7bc5c071c056443d9d7beb043e6a499707cc102c4c7ecbb73d
MD5 1d772827d24531e8662e629f1494165f
BLAKE2b-256 226f52d00d8a741c3dfc29a0ec0f93e7f0d158f2402dd3f664d5b09258d5ed47

See more details on using hashes here.

File details

Details for the file agent_context_packager-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_context_packager-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c056e3bfdf83b6d2213c66e9e99fcaf4b4fb88004fd657855d126aaa9e43b3a3
MD5 87dbd174a0a8acc9f33c153a6b83b503
BLAKE2b-256 c3006b21ffc802d3b3ec15c4097054a889c2907930f6dc87402255e206769ece

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page