Monday, January 19, 2026

Codelab: Constructing an AI Agent With Couchbase AI Companies & Agent Catalog


On this CodeLab, you’ll discover ways to construct a Resort Search Agent utilizing LangChain, Couchbase AI Companies, and Agent Catalog. We may also incorporate Arize Phoenix for observability and analysis to make sure our agent performs reliably.

This tutorial takes you from zero to a completely purposeful agent that may seek for accommodations, filter by facilities, and reply pure language queries utilizing real-world knowledge.

Notice: Yow will discover the complete Google CodeLab pocket book for this CodeLab right here.

What Are Couchbase AI Companies?

Constructing AI functions typically includes juggling a number of providers: a vector database for reminiscence, an inference supplier for LLMs (like OpenAI or Anthropic), and separate infrastructure for embedding fashions.

Couchbase AI Companies streamlines this by offering a unified platform the place your operational knowledge, vector search, and AI fashions dwell collectively. It gives:

  • LLM inference and embeddings API: Entry widespread LLMs (like Llama 3) and embedding fashions immediately inside Couchbase Capella, with no exterior API keys, no additional infrastructure, and no knowledge egress. Your software knowledge stays inside Capella. Queries, vectors, and mannequin inference all occur the place the information lives. This allows safe, low-latency AI experiences whereas assembly privateness, compliance necessities. Thus, the important thing worth: knowledge and AI collectively, with out sending delicate data exterior your system.
  • Unified platform: Database + Vectorization + Search + Mannequin
  • Built-in vector search: Carry out semantic search immediately in your JSON knowledge with millisecond latency.

Why Is This Wanted?

As we transfer from easy chatbots to agentic workflows, the place AI fashions autonomously use instruments, latency, and complexity of setup develop into bottlenecks. By co-locating your knowledge and AI providers, you cut back the operational overhead and latency. Moreover, instruments just like the Agent Catalog assist with managing a whole lot of agent prompts and instruments and supply inbuilt logging in your brokers.

Conditions

Earlier than we start, guarantee you’ve:

  • A Couchbase Capella account.
  • Python 3.10+ put in.
  • Primary familiarity with Python and Jupyter notebooks.

Create a Cluster in Couchbase Capella

  1. Log into Couchbase Capella.
  2. Create a brand new cluster or use an present one. Notice that the cluster must run the most recent model of Couchbase Server 8.0 with the Knowledge, Question, Index, and the Eventing providers.
  3. Create a bucket.
  4. Create a scope and assortment in your knowledge.

Step 1: Set up Dependencies

We’ll begin by putting in the required packages. This consists of the couchbase-infrastructure helper for setup, the agentc CLI for the catalog, and the LangChain integration packages.

Step 2: Infrastructure as Code

As an alternative of manually clicking via the UI, we use the couchbase-infrastructure bundle to programmatically provision our Capella atmosphere. This ensures a reproducible setup.

We’ll:

  1. Create a Mission and Cluster.
  2. Deploy an Embedding Mannequin (nvidia/llama-3.2-nv-embedqa-1b-v2) and an LLM (meta/llama3-8b-instruct).
  3. Load the travel-sample dataset.

Couchbase AI Companies gives OpenAI-compatible endpoints which might be utilized by the brokers.

Guarantee to comply with the steps to setup the safety root certificates. Safe connections to Couchbase Capella require a root certificates for TLS verification. Yow will discover this within the ## 📜 Root Certificates Setup part of the Google Colab Pocket book.

Step 3: Integrating Agent Catalog

The Agent Catalog is a robust instrument for managing the lifecycle of your agent’s capabilities. As an alternative of hardcoding prompts and power definitions in your Python information, you handle them as versioned belongings. You possibly can centralize and reuse your instruments throughout your improvement groups. You can even look at and monitor agent responses with the Agent Tracer.

Initialize and Obtain Property

First, we initialize the catalog and obtain our pre-defined prompts and instruments.

Index and Publish

We use agentc to index our native information and publish them to Couchbase. This shops the metadata in your database, making it searchable and discoverable by the agent at runtime.

Step 4: Making ready the Vector Retailer

To allow our agent to seek for accommodations semantically (e.g., “cozy place close to the seaside”), we have to generate vector embeddings for our lodge knowledge.

We outline a helper to format our lodge knowledge right into a wealthy textual content illustration, prioritizing location and facilities.

Step 5: Constructing the LangChain Agent

We use the Agent Catalog to fetch our instrument definitions and prompts dynamically. The code stays generic, whereas your capabilities (instruments) and character (prompts) are managed individually. We may also create our ReAct brokers.

Step 6: Working the Agent

With the agent initialized, we are able to carry out complicated queries. The agent will:

  1. Obtain the consumer enter.
  2. Determine it wants to make use of the search_vector_database instrument.
  3. Execute the search in opposition to Capella.
  4. Synthesize the outcomes right into a pure language response.

Instance Output:

Agent: I discovered a lodge in Giverny that gives free breakfast known as Le Clos Fleuri. It’s positioned at 5 rue de la Dîme, 27620 Giverny. It gives free web and parking as nicely.

Notice: In Capella Mannequin Companies, the mannequin outputs will be cached (each semantic and customary cache). The caching mechanism enhances the RAG’s effectivity and velocity, significantly when coping with repeated or related queries. When a question is first processed, the LLM generates a response after which shops this response in Couchbase. When related queries are available in later, the cached responses are returned. The caching period will be configured within the Capella Mannequin providers.

Including Semantic Caching

Caching is especially beneficial in eventualities the place customers might submit related queries a number of occasions or the place sure items of data are ceaselessly requested. By storing these in a cache, we are able to considerably cut back the time it takes to reply to these queries, enhancing the consumer expertise.

Step 7: Observability With Arize Phoenix

In manufacturing, it is advisable know why an agent gave a particular reply. We use Arize Phoenix to hint the agent’s “thought course of” (the ReAct chain).

We are able to additionally run evaluations to examine for hallucinations or relevance.

By inspecting the Phoenix UI, you may visualize the precise sequence of instrument calls and see the latency of every step within the chain.

Conclusion

We’ve efficiently constructed a strong Resort Search Agent. This structure leverages:

  1. Couchbase AI Companies: For a unified, low-latency knowledge and AI layer.
  2. Agent Catalog: For organized, versioned administration of agent instruments and prompts. Agent catalog additionally gives tracing. It gives customers to make use of SQL++ with traces, leverage the efficiency of Couchbase, and get perception into particulars of prompts and instruments in the identical platform.
  3. LangChain: For versatile orchestration.
  4. Arize Phoenix: For observability.

This strategy scales nicely for groups constructing complicated, multi-agent techniques the place knowledge administration and power discovery are crucial challenges.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles