Summary
How can you query tables and documents with LangGraph agents and workflows?
The campaign management example uses eight tables covering offers, segments, channels and interactions. CSV files are loaded, and column comments provide context for Select AI. Loan documents in PDF format are ingested with OCI Document Understanding and prepared for RAG using LangChain and Oracle AI Vector Search.
The demonstration compares four LangGraph patterns. An agent selects between Select AI and RAG according to the query. The walkthrough then tests parallel execution of both tools, configured routing and an orchestrator that assigns predefined tasks and gathers results through a synthesizer.
Loan offers are queried, and the generated SQL is copied and checked in Autonomous. Content is also retrieved from the PDF documents. The walkthrough brings together relational data and documents centralized in Oracle Autonomous Database, with assistance from OCI Generative AI.
Start
The demonstration introduces a financial campaign management example combining relational data and documents. It compares different ways to organize queries using LangGraph agents and workflows.
Campaign management and data model case
The example uses eight tables covering campaigns, offers, segments, channels and user interactions. The walkthrough examines the relationships between campaigns and segments, campaigns and offers, and associated channels. This model supplies the relational side of the example: later loan questions use the tables centralized in Autonomous.
Loading tables CSV and column comments
The loading wizard imports tables from CSV files. The presenter highlights column comments as context that helps Select AI interpret fields and their relationships. Descriptions explain, for example, how a foreign key relates to another table. Once loading finishes, the relational model is available in Autonomous for natural language questions.
PDF Ingest with OCI Document Understanding
After the tables are loaded, personal loan documents in PDF format are ingested using OCI Document Understanding. This second source complements the relational data with document content, preparing information for the RAG queries in the following examples.
Revision tables and Autonomous data
The loaded tables are checked in the Autonomous database. The campaign table and its column comments are inspected. The document table is then located, linking the relational model review with preparation for document queries.
text, metadata and embeddings for RAG
The document table is queried to inspect its text, metadata and embeddings fields. The presenter connects this structure to the Oracle AI Vector Search and LangChain libraries used for document retrieval. The content and its vector representation prepare information searches for answering questions with an LLM.
Select AI and RAG tools agent
The first example connects an agent to two tools: one queries relational data through Select AI, while the other retrieves document information through RAG. Both use information centralized in Autonomous. The walkthrough shows how the agent selects a tool according to the request before comparing this behavior with the later workflows.
Query offers with Select AI
The question asks for loan campaign offers with a term longer than 24 months and requests Select AI. The agent sends the query to that tool, receives its response and presents it to the user. The generated SQL is available for checking the result directly in the database schema.
Validation of SQL consultation at Autonomous
The generated SQL is copied and executed in the Autonomous schema containing the example tables. It returns no rows, matching the assistant response: no loan offers with a term longer than 24 months were found. This check compares the natural language message with the actual query result.
Query document using RAG
The next question concerns the loaded documents. This time, the agent uses the RAG tool and retrieves information relevant to the query. The example shows the selection of a document retrieval tool after the earlier relational query, with both sources remaining in Autonomous.
Paralysing and aggregation of responses
The parallelization workflow sends the same query to both tools, Select AI and RAG. The test asks about customers who requested a personal loan with an amount above 10000. An aggregator combines the information received into a composite response. The presenter explains that this synthesis can be organized in different ways according to the flow configuration.
Rounding between Select AI and RAG
The third example uses routing to direct a query to a tool according to configured logic. An earlier question is repeated, and the selected route goes to RAG; the presenter explains that this behavior was preconfigured. A later PDF document query follows the same route. The tests show how configuration determines which tool is used, rather than always sending the query to both.
Orchestra, tasks and synthesis of results
The orchestrator handles specific, predefined tasks, such as preparing a report or an analysis. The walkthrough introduces the task given to the LLM and distributes requests to the Select AI and RAG tools. Both seek information to address the task, and a synthesizer combines their results. The example describes concatenation to share the response with the user.
Integration of components and closure
The closing brings together the components: LangGraph organizes agents and workflows, OCI Generative AI assists queries, and Oracle AI Vector Search retrieves document information in Autonomous. The walkthrough ends by showing how to centralize natural language questions over relational sources and documents.
Resources related
- Oracle AI LangGraph - Project code and guide
- LangGraph - agents, paralleling, routing and orchestration
- Oracle Select AI - Consultation in Natural Language
- Oracle AI Vector Search - Integration with LangChain
- OCI Document Understanding - Processing document
- OCI Generative AI - First steps with models