Section 6: Working with Collections
What Are Collections?
Collections are a powerful way to handle structured data within a document or to group multiple documents into one logical unit.
They allow you to:
- Extract tabular data from a single document (e.g. bid line items, inspection issues)
- Process multiple related documents together as a bundle (e.g. multiple bids, amendments, invoices)
Think of a collection as a sub-table or sub-agent that lives inside your main agent.
Collections Best Practices
Two Primary Use Cases
1. Intra-Document Collections (Structured Tables)
Use when a single document contains multiple rows of related data
(e.g. a lease document with a table of payment schedules)
- Period
- Monthly Rent
- Rate/SQF
- Escalations
2. File Bundles (Grouped Inputs)
Use when you want to analyze multiple related documents together (e.g. 3 contractor bids for one project, or 5 amendments to the same loan)
Set Up:
- Upload multiple files via a User Input Collection
- Each document is a row in the collection
- Each row can have its own properties and sub-workflows
Real Example:
A bundle of contractor bids is uploaded and processed using:
- Collection of bids
- Sub-collection of line items inside each bid
- Final “winner” selected based on extracted fields
Property Behavior Inside Collections
Once inside a collection:
- You can define new properties (just like outside the main agent)
- Properties inside a collection behave like a mini-agent
- You can use AI, Python, JSON, Selects — just like at the top level
When to use Single File vs. Collection File Bundles
When building Go agents, determining whether to use single file inputs or collection file bundles is critical for structuring your workflow effectively. Here’s a breakdown based on common use cases:
Single File Input
Use Case: When each entity or row in your dataset corresponds to a single document.
Examples:
- A lease document where all required information is contained within one file.
- Simple workflows with no amendments, extensions, or related supplementary documents.
Limitations:
- Cannot handle scenarios where multiple documents (e.g., amendments, commencement letters) need to be associated with a single entity.
- Each row is limited to one file, making it unsuitable for workflows with interconnected documents.
Collection File Bundles
Use Case: When each entity requires multiple related documents to be processed together.
Examples:
- Lease workflows with amendments, commencement letters, or extension agreements.
- Scenarios where multiple document types (e.g., industrial vs. office leases) need to be grouped under one entity.
- Loan agreements with supplementary financial statements or appendices.
Advantages:
- Allows multiple files to be associated with a single entity, offering flexibility for complex document sets.
- Ideal for workflows where changes or updates (e.g., amendments) must be tracked and processed together.
Setup: Configure the agent to accept collections as inputs instead of single files. This enables multiple files to be uploaded per row and referenced collectively during processing.
Key Considerations
- Define the Entity Early: Before building, decide what each row represents (e.g., a lease, a loan agreement). This will guide whether single or collection inputs are appropriate.
- Future-proofing: If there’s potential for amendments, related documents, or multi-document workflows, opt for collections to avoid rework.
- Complexity: Collections require more upfront configuration but provide significant flexibility for nuanced workflows.
By aligning your input structure with your use case, you ensure a scalable and efficient agent workflow.
Key Takeaway
Collections are your go-to when you’re working with repeated structures or grouped documents.
Use them to:
- Cleanly organize multipart data
- Enable sub-workflows
- Maintain modular, scalable agent logic
Updated about 15 hours ago
