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
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.
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.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.
API Usage
Basic Query
Ask a question about an indexed document and receive a cited answer:Structured Output Query
Extract structured data from documents by providing a JSON schema:Streaming
Stream the response as Server-Sent Events for real-time updates:Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
source_id | string | Yes | — | Data source ID of the indexed document |
query | string | Yes | — | Question to ask about the document |
json_schema | object | No | — | JSON Schema for structured output extraction |
model | string | No | claude-opus-4-6-1m | Model to use for the agent |
thinking_enabled | boolean | No | true | Enable extended thinking for complex reasoning |
thinking_budget | integer | No | 10000 | Token budget for thinking (1,000 - 50,000) |
stream | boolean | No | false | Stream response as Server-Sent Events |
Model Selection Guide
Choose the right model based on your task requirements:| Model | Context Window | Best For | Speed | Cost |
|---|---|---|---|---|
claude-opus-4-6-1m | 1M tokens | Complex reasoning over long documents, multi-step analysis, structured extraction from dense filings | Slower | Highest |
claude-sonnet-4-20250514 | 200K tokens | Balanced performance for most document queries, good reasoning with faster responses | Moderate | Moderate |
claude-haiku-35-20241022 | 200K tokens | Quick lookups, simple fact extraction, high-volume processing | Fastest | Lowest |
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
Financial Data Extraction
Financial Data Extraction
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.
Research Paper Metadata
Research Paper Metadata
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.
Compliance Checklist
Compliance Checklist
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.
Document Agent vs. Standard Search
| Aspect | Document Agent | Nia Search |
|---|---|---|
| Approach | Autonomous agent — plans strategy, calls tools in a loop, follows leads | Single-pass retrieval over indexed chunks |
| Citations | Page, section, and content-level citations | Source-level citations |
| Structured Output | JSON Schema support for typed extraction | Not available |
| Thinking | Extended thinking with configurable budgets | Not available |
| Best For | Complex questions requiring reasoning across sections | Quick factual lookups |
| Latency | Higher (multi-step agent loop) | Lower (single retrieval) |
- 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
- You need fast, simple lookups across many sources
- Low latency is critical
- The question maps directly to a specific passage

