MARCH 27 2025

Building agents with Dgraph using Google's Gen AI Toolbox for Databases

Unleash powerful AI agents by connecting Dgraph's knowledge graph capabilities with Google's Gen AI Toolbox for seamless, secure graph database interactions.

William Lyon
William Lyon
Developer Experience, Hypermode

In a recent Hypermode Live event we were joined by Kurtis Van Gent from Google to discuss how to build AI agents using Dgraph and Google's Gen AI Toolbox for Databases.

Introduction to Gen AI agents and tools

Kurtis kicked off with an overview of AI agents, describing them as applications that use generative AI models to think and act toward specific goals. These agents can:

  • Automate complex workflows
  • Use reasoning and planning to determine necessary steps
  • Utilize tools to act on those steps by accessing data and taking concrete actions

The key components of an AI agent include:

  • Orchestration: The "brain" that coordinates how the model thinks
  • Tools: Functions that fetch data and perform actions
  • Deployment: The environment where the agent runs

Tools (or function calling) let LLMs take actions beyond just generating text. For database tools specifically, there are three main categories:

  1. Semantic search: Using embeddings to look up similar content
  2. Structured queries: Pre-written SQL statements where the LLM provides arguments
  3. Natural Language to SQL: Where the agent generates SQL statements directly

Google's Gen AI Toolbox

Gen AI Toolbox was designed to address the challenge of replicating logic across different orchestration frameworks. It creates a unified interface between orchestration frameworks and databases, making it easier to develop tools in a consistent way regardless of which framework or database you're using.

Key benefits of Toolbox include:

  • Streamlined development with a unified control plane
  • Enhanced observability through Open Telemetry
  • Better security features
  • Efficient database interaction with connection pooling

How Toolbox works

  1. Define tools: Create a YAML file that specifies database connections and tools
  2. Integrate with SDK: Add a few lines of code to load tools into your orchestration framework
  3. Invoke tools: When tools are triggered, they send HTTP requests to Toolbox, which handles database access

How does toolbox work

The configuration involves three primary elements:

  • Sources: Defines how to connect to databases (credentials, IP addresses)
  • Tools: Specifies actions to be executed on sources
  • Tool Sets: Logical groupings of tools that can be shared between agents

Key features

Toolbox provides several important features:

  • Authenticated parameters: Secures user data by validating tokens, ensuring users only access data they're authorized to see
  • Authorized invocations: Ensures tools are only triggered by authenticated users
  • Observability: Structured logging, metrics, and tracing via Open Telemetry
  • Comprehensive documentation: Searchable docs with guides and deployment instructions

Dgraph and Toolbox integration

Dgraph support was added to Toolbox early on in order to expose the benefits of knowledge graphs for AI agentic flows. Dgraph is a graph database that allows modeling, storing, and querying data as a graph. As a transactional and distributed database, it features:

  • ACID transactions
  • Multi-version concurrency control (MVCC)
  • Raft consensus for managing commits
  • A property graph model with DQL as its primary query language

Dgraph is particularly valuable for AI agents as it can serve as a knowledge graph, providing rich context for agentic workflows. It offers a hybrid approach combining the property graph model for developers with triple-based storage under the hood.

Demo: E-commerce agent with Dgraph and Toolbox

In the livestream we demonstrated an e-commerce agent using Gen AI Toolbox, Dgraph, LangChain, and Postgres, showcasing a polyglot database environment. The agent was designed to find products and generate personalized recommendations by leveraging user reviews.

The demo used:

  • Amazon product review data with user reviews loaded into Dgraph
  • Product catalog metadata stored in Postgres
  • Tools defined in Toolbox to query both databases
  • LangChain as the agent orchestration framework

When asked to find an ice maker, the agent first queried Postgres for product information. When asked to summarize reviews for a specific product, it used both databases - first finding the product ID in Postgres, then retrieving review data from Dgraph by traversing the graph for product recommendations.

Roadmap for Toolbox

The Toolbox team has several features planned:

  • Support for Model Context Protocol (MCP)
  • HTTP tools and sources for integrating with custom APIs
  • Base SDKs for core functionality that work with different languages (Go, Java, Node.js)
  • Better support for Google Colab development
  • More diverse tools for semantic search and NL to SQL
  • An advanced control plane for managing multiple Toolbox servers

Resources

Be sure to subscribe to the Hypermode event calendar to keep up with future Hypermode Live events!