LangChain Deep Agents with Oracle

Use langchain-oci to connect LangChain Deep Agents to OCI Generative AI, other LangChain model providers, and Oracle AI Database.

Deep Agents is an open source agent harness in the LangChain ecosystem for long-running, multi-step work. The Oracle integration is not a separate or forked agent framework. The create_deepagents_agent() factory composes Oracle capabilities with the upstream deepagents.create_deep_agent() implementation and returns a compiled LangGraph graph.

Why Use LangChain Deep Agents with Oracle

Use the integration when an agent must plan research, work across a large body of Oracle data, preserve intermediate files, or resume work in a later session.

The upstream Deep Agents harness provides planning, subagent delegation, a virtual file system, and the agent loop. The Oracle integration adds the following options:

Architecture

A LangChain Deep Agent with Oracle typically follows this flow:

  1. Prepare data: Load documents and embeddings into an Oracle vector table, and create the Oracle Text search index required by the generated ADB search tool.
  2. Register a datastore: Configure langchain_oci.datastores.ADB with the table name and a short description of the indexed content.
  3. Choose models: Use the OCI Generative AI model and default OCI embeddings, or pass prebuilt LangChain chat and embedding models.
  4. Create the agent: Call create_deepagents_agent() with the datastore, embedding model, prompt, and optional Deep Agents features.
  5. Use generated tools: Let the agent inspect datastore statistics, search for relevant chunks, and retrieve complete documents.
  6. Persist state: Optionally store thread checkpoints, application-managed memory, and virtual files in Oracle AI Database.
  7. Invoke or stream: Run the compiled graph with LangGraph invocation, asynchronous invocation, or streaming APIs.

Use the same embedding model and vector dimensions when you index documents and when the agent searches them. A mismatch can make search results inaccurate or cause a database error.

Integration Components

Use these components to assemble the integration.

Component Package Role
create_deepagents_agent() langchain-oci[deepagents] Combines a LangChain chat model, custom tools, Oracle datastores, and upstream Deep Agents features.
ADB langchain-oci Adapts an Oracle vector table as a datastore and provides vector and Oracle Text retrieval.
OracleVS langchain-oracledb Stores documents, metadata, and embeddings in Oracle AI Database.
OracleSaver langgraph-oracledb Persists per-thread LangGraph checkpoints so an agent can resume.
OracleStore langgraph-oracledb Stores application-managed namespaced values with optional vector search.
StoreBackend deepagents Maps Deep Agents file operations to a LangGraph store such as OracleStore.

Choose Reasoning and Embedding Models

Use the factory without a model argument to create a ChatOCIGenAI model. Provide an OCI compartment and service region or endpoint, and select an OCI Generative AI model with model_id.

Pass model= to use a prebuilt LangChain chat model from another provider. Pass embedding_model= to use a prebuilt LangChain embedding model from another provider. In this mode, each supplied model owns its own connection and credentials. Oracle AI Database credentials are still required for Oracle retrieval and persistence.

This separation lets an application change the reasoning model or embedding model without replacing its Oracle data, search, checkpoint, memory, or file layers. The embedding model must match the model, vector dimensions, and embedding settings used to index the Oracle vector table.

Resources