Skip to main content
Builder Feature - Document Agent is included with Builder, Team, and Business plans. Free plan users can also use Document Agent with purchased credits.

Overview

Document Agent is an autonomous AI agent that researches your indexed PDFs and documents. It doesn’t just retrieve chunks — it has access to specialized tools (search, read sections, read pages, navigate document trees) and uses them iteratively, planning its own research strategy to build comprehensive answers. Think of it as deploying an agent into your document. It decides what to search for, which sections to read, navigates the hierarchy, follows cross-references, and synthesizes findings — all autonomously. It supports structured output via JSON schemas, extended thinking for complex reasoning, and real-time streaming. Use Document Agent when you need an agent that can deeply research a specific document — contracts, filings, research papers, technical manuals — with full citation traceability.

Key Capabilities

Inline Citations

Every claim in the response is backed by citations pointing to specific pages, sections, and content from the source document.

Structured Output

Provide a JSON Schema and receive structured data extracted from the document — perfect for pipelines, automation, and data processing.

Extended Thinking

The agent uses extended thinking to reason through complex queries, plan its tool usage, and synthesize multi-part answers with configurable token budgets.

Streaming

Stream responses as Server-Sent Events for real-time UI updates. Watch the agent work through the document as it builds its answer.

Model Selection

Choose the model that fits your task — from fast and efficient to maximum capability with 1M token context windows.

Autonomous Tool Use

The agent autonomously plans its research strategy — deciding which tools to call, what to search for, which sections to read next — rather than relying on a single retrieval pass.

How It Works

1

Index Your Document

Upload or provide a URL to your PDF. Nia parses it into a hierarchical document tree — sections, subsections, figures, tables — preserving structure and context.
2

Deploy the Agent

Send a query to the Document Agent along with the source_id of your indexed document. Optionally provide a JSON schema for structured output.
3

Autonomous Research

The agent plans its research strategy using extended thinking, then autonomously calls tools in a loop — searching across sections, reading specific pages, navigating the document tree, following cross-references — until it has gathered all relevant information. You can watch this happen in real-time via streaming.
4

Synthesized Report

The agent produces a comprehensive answer with inline citations. Each citation links back to the exact page, section, and content in the source document. If a JSON schema was provided, the response also includes structured output conforming to your schema.

API Usage

Basic Query

Ask a question about an indexed document and receive a cited answer:
Response:

Structured Output Query

Extract structured data from documents by providing a JSON schema:
Response:

Streaming

Stream the response as Server-Sent Events for real-time updates:
SSE events arrive as the agent works through the document, enabling responsive UIs that show progress in real time.

Parameters


Model Selection Guide

Choose the right model based on your task requirements:
Start with the default. claude-opus-4-7 with its 1M context window handles even the longest documents. Scale down to Sonnet or Haiku when you need faster responses or lower costs for simpler queries.

Use Cases

Legal Documents

Extract parties, obligations, termination clauses, and liability caps from contracts. Use structured output to feed data directly into case management systems.

Financial Filings

Query 10-Ks, 10-Qs, and annual reports. Extract risk factors, revenue breakdowns, and forward-looking statements with page-level citations for audit trails.

Technical Manuals

Ask about specifications, procedures, and safety requirements. The agent navigates complex hierarchical documents to find precise answers across sections.

Research Papers

Interrogate methodology, results, and conclusions. Compare findings across sections. Use structured output to extract experimental parameters and metrics into tables.

Structured Output Patterns

Query: “Extract quarterly revenue figures and year-over-year growth rates.”Schema:
The agent reads the financial statements, locates revenue tables, and returns clean structured data ready for analysis.
Query: “Extract the paper’s key details: authors, abstract, datasets used, and reported metrics.”Schema:
The agent extracts structured metadata from any research paper, making it easy to build literature review databases.
Query: “Identify all compliance requirements and their current status mentioned in this audit report.”Schema:
Turn unstructured audit reports into actionable compliance checklists with a single API call.

Use Document Agent when:
  • Your question requires synthesizing information from multiple sections
  • You need structured data extracted from documents
  • You need page-level citation traceability
  • The question requires reasoning, not just retrieval
Use Nia Search when:
  • You need fast, simple lookups across many sources
  • Low latency is critical
  • The question maps directly to a specific passage