Vibe querying with TypeDB Studio

AI-assisted development with TypeDB using the Agent Mode feature of TypeDB Studio

Alex Walker


You’re probably familiar with vibe coding — the practice of describing what you want in plain English and letting an AI write the code. In this article we show how the concept translates to databases using the Agent Mode feature of TypeDB Studio.

What is vibe querying?

Vibe querying is exactly what it sounds like. Instead of writing this:

match
  $p isa person, has name $n, has email $e;
fetch {
  "name": $n,
  "email": $e,
};

You write this:

Get all people with their names and emails.

The AI reads your database schema, understands the structure of your data, and generates TypeQL in the chat. You click Run, and the results appear inline in your chat window.

An illustration of the Agent Mode page in TypeDB Studio, complete with your schema, query history, prompt to generate a query, query text, and the text output of that query.
From left to right: the Studio navigation sidebar; your schema; your chat window (prompt + query + text output); your query history.

Why vibe querying?

Why use Agent Mode in TypeDB Studio? Agent mode can be used for asking questions about your database, building your schema and querying your data – all the essential day-to-day DB operations. It’s particularly useful for:

  • Newcomers to TypeQL who know what they want but not how to express it. Agent mode is an effective way to learn the query language. You describe intent, see the syntax, and internalise the patterns.
  • Domain experts who understand the data model deeply but don’t write TypeQL daily. A biologist querying a drug-interaction database shouldn’t need to remember whether it’s fetch or select.
  • Developers in exploration mode who are poking around a new dataset, trying to understand what’s in there. It’s a great way to familiarise with the TypeDB sample datasets such as social-network, and that’s what we’ll be describing in the next section.

Overall it’s just a more hassle-free way to build with TypeDB.

Try it now:

Case study: exploring the social network sample in agent mode

The easiest way to try this is to boot up a free TypeDB Cloud cluster with the social-network sample dataset preloaded; alternatively you can also initialise it in TypeDB CE (Cloud page / CE setup guide)

What’s in my schema?

Suppose this is your first time browsing the social network dataset. You probably want to get the lay of the land. Ask the AI agent “what’s in my schema?” and it will come up with a detailed description you can read.

User prompt: "What's in my schema". Agent response: "Core entity hierarchy (main 'things'): ...; Relations (how things connect) ..."
The AI agent breaks down the database schema by hierarchy, hence by domain.

Behind the scenes, TypeDB Studio has attached the schema as context to the LLM that powers agent mode, which has attempted to decipher the schema for the user (you).

Could you draw my schema as a UML diagram in ASCII art?

I am a visual learner – so had to give this one a try.

Not exactly Picasso – but successful nonetheless; agent mode can indeed render your schema as ASCII art.

Come up with some interesting queries

Before agent mode: poke around in schema, scratch head, read docs, do actual hard work.

After agent mode: “Hey benevolent AI bot, could you just dream up some interesting queries for me?”

Not bad – its top three suggestions are simple enough:

List all people and their attributes

match
  $p isa person;
fetch { "person": { $p.* } };

Show a ‘contact card’ per person

match
  $p isa person;
  try { $p has username $u; };
  try { $p has email $e; };
  try { $p has phone $ph; };
fetch { "username": $u, "email": $e, "phone": $ph };

List unique friendship pairs

match
  $a isa person, has username $au;
  $b isa person, has username $bu;
  friendship (friend: $a, friend: $b);
  $au < $bu;
fetch { "person_1": $au, "person_2": $bu };

Running the generated query

Let’s go ahead and run the second of these queries – showing a ‘contact card’ per person:

match
  $p isa person;
  try { $p has username $u; };
  try { $p has email $e; };
  try { $p has phone $ph; };
fetch { "username": $u, "email": $e, "phone": $ph };

Let’s switch to table view:

Cool. We have our contact cards! That being said, there’s a lot of nulls. Is the query definitely correct?

Sending your query results back to the agent for feedback

Let’s hop back to the log output view for now. Remember that magic wand icon in the top right? Click that, and you’ll automagically send a new message containing the full log. The agent attempts to interpret these results. In the case of a successful query, it’ll typically suggest follow-up queries you could run. In the case of an error, it’ll try to diagnose the error and come up with a fixed query.

In this case when we send back the query, it suggests several follow-up queries, one of which is indeed a sanity check on whether any phone numbers exist at all in our dataset. It turns out they do not, so the phone property is largely for illustrative purposes.

Fix my query

LLMs are genuinely impressive these days – and TypeDB’s AI agent is backed by GPT-5.2, a very powerful model. It still gets things wrong sometimes, though. Consider the following generated query:

At first the AI agent generates a query based on the idea of using subqueries inside a fetch, but unfortunately this returns a syntax error. We click the “magic wand” icon in the top right of the log, and this happens …

The agent tries a different approach and writes a correct query.

Fix your query

The “Fix with AI” button isn’t limited to Agent Mode. If you’re using the Query page to write TypeQL yourself, and you get an error – or an unexpectedly empty result set – you can hit “Fix with AI” (the magic wand button) and it’ll send the query log to a new Agent Mode conversation and have the agent describe what it thinks might be wrong.

The AI-assisted database querying landscape today

LLMs are perfectly capable of generating database queries in SQL, Cypher, and so on.

From our research so far we’ve found that TypeDB Studio is a trailblazer in its early release of a fully-integrated AI assistant. Unlike other data platforms, the Studio agent is always aware of your data context (your schema) – and it allows you to actually run queries without leaving the assistant chat – a streamlined and better user experience.

How semantic richness and strict schema empower generative AI

Agents that deal with complexity fail in predictable ways when they lack semantic grounding. They create invalid states. They make assumptions about the definitions and structures of concepts when there isn’t a clear, semantically rich schema setting those things out.

TypeDB exhibits the following properties that are all of great value to an AI agent:

  • A strong and highly expressive type system that clearly sets out what is semantically valid and what is not;
  • Strict semantic validation to inform the agent when output is incorrect and how;
  • A very terse, natural English query language to reduce context size and produce output highly readable to both humans and machines.

You can learn more about the power of semantic richness in: Why agents need ontologies

Conclusion

Agent mode provides a totally new way of interacting with TypeDB. Its self-healing capabilities allow it to easily fix mistakes providing for an overall smooth experience. You don’t need prior knowledge of TypeQL – just ask questions in natural language and get answers.

Get started with TypeDB Studio

Here are some quick links to get up and running with TypeDB Studio and with vibe querying and to learn more:

Share this article

TypeDB Newsletter

Stay up to date with the latest TypeDB announcements and events.

Subscribe to newsletter

Further Learning

Feedback