LlamaIndex 教程:用 LlamaParse Index 构建文档智能体工作流
Document Agents Workflow Automation Guide | LlamaIndex
LlamaIndex 发布教程,演示如何用 LlamaParse Index 解析并索引非结构化文档,再接入 Claude Sonnet 4 与 FunctionAgent 构建可推理的文档智能体。示例以 JPMorgan Chase 存款账户披露文件为数据集,智能体可查询透支政策、补卡费与止付费并调用计算器工具汇总费用。
正文
当前显示原文,中文全文译文尚未就绪。
Follow us on
Enterprise documents—like bank statements, contracts, and disclosures—are dense, complex, and often packed with valuable information that's difficult to access at scale. Traditional document processing tools struggle to go beyond basic extraction.
With LlamaParse Index, we're enabling a new paradigm: seamlessly parse and index unstructured documents, retrieve relevant context, and plug it directly into AI agents using LlamaIndex's open-source agentic framework. In this tutorial, we'll walk through how to set up your first LlamaParse Index and use it in a fully functional AI agent.
We'll be working with a challenging real-world dataset: a collection of deposit account disclosures and rate agreements from JPMorgan Chase.
The goal? Build an agent that can intelligently reason over the documents to answer complex banking questions—like calculating overdraft fees based on user behavior.
👉 You can follow along in the official documentation
🎥 Or watch the video tutorial
Explore our free and paid plans today.
Learn more
Start by installing the required dependencies:
sh
LLAMACLOUD_API_KEY - to access your LlamaParse index; ANTHROPIC_API_KEY - to access Claude for powering your agent
First, create your index in the LlamaParse dashboard by uploading your documents (Chase account PDFs in this case). Then connect to it using the LlamaIndex SDK:
python
Verify that your index is working by running a basic retrieval test:
python
This returns raw nodes—chunks of document text from relevant pages—but no final answer yet. To get actual answers, we need to integrate an LLM.
Step 4: Add an LLM and Create a Query Engine
Integrate Claude Sonnet 4 as your language model:
python
Create a query engine and ask the same question:
python
Output:
The monthly service fee for Chase Total Checking is $12 (increasing to $15, effective August 24, 2025).
This is basic RAG (retrieval-augmented generation). Now let's build a more sophisticated agent.
Create tools that your agent can use:
1. A simple calculator tool:
python
2. A query tool for the Chase documents:
python
Use LlamaIndex's FunctionAgent with the Workflows abstraction:
python
Now test the agent with a compound scenario that requires multiple document lookups and calculations:
python
The agent intelligently:
Queries overdraft policies to understand when fees apply; Looks up replacement card fees for rush delivery; Finds stop payment fees for phone requests; Calculates total fees using the add tool; Provides a detailed breakdown with timing
Key Features Demonstrated
Smart Document Retrieval: The agent doesn't just search—it understands context and retrieves relevant information from multiple document sections.
Multi-Step Reasoning: It breaks down complex scenarios into component parts, querying different aspects of the banking policies.
Tool Integration: Seamlessly combines document retrieval with calculations and business logic.
Streaming Execution: You can observe the agent's thought process in real-time, seeing each tool call and reasoning step.
This tutorial demonstrates how LlamaParse and LlamaIndex transform dense, unstructured documents into actionable insights automatically. By indexing real-world data and connecting it to an event-driven, tool-using agent, you go far beyond traditional document search or basic RAG pipelines.
The result is a system that can:
Reason across multiple document sections; Calculate complex scenarios with precision; Adapt its queries based on context; Explain its reasoning transparently
This approach works for any domain with complex documents—legal contracts, technical manuals, regulatory filings, medical records, and more.
💡 Want to try it yourself?
Check out the complete documentation and video walkthrough.
Ready to build your own document agents? Start with your first LlamaParse index today and let us know how you're using agents built with LlamaIndex—we'd love to feature your use case.