A Genie question takes more than one API call. Your app starts a conversation, waits for
Genie to finish, then reads the answer, SQL, or rows it returns.

I maintain LakeSpeak.NET, an independent open-source project. In this walkthrough, a .NET 8
console app uses LakeSpeak.Genie 0.4.0. Run it against a local HTTP fixture first, then use
the same client with a Genie Agent you can access.

View LakeSpeak.NET on GitHub

Run the example before configuring a workspace

Install the .NET 8 SDK.
The first run needs NuGet access. It does not need a Databricks account or the LakeSpeak CLI.

Download the companion project and extract it. The
source directory
is pinned to the tested revision. Run these commands inside the extracted project:

dotnet restore --locked-mode --source https://api.nuget.org/v3/index.json dotnet build -c Release --no-restore dotnet run -c Release --no-build --no-restore -- --fixture 

The output is:

OFFLINE HTTP fixture: no workspace, credentials, or Databricks CLI calls. There were 42 orders yesterday. SQL: SELECT count(*) AS order_count FROM orders WHERE order_date = current_date() - 1 order_count 42 OFFLINE fixture PASS (published LakeSpeak.Genie 0.4.0). 

FixtureHandler supplies the conversation and query-result responses in memory. The installed
client parses those responses. The companion checks the returned SQL and one complete row
containing 42.
The SQL shown here is fixture data. This command does not execute it against a warehouse.

Register the client in your application

The live path uses these registrations:

var services = new ServiceCollection(); services.AddDatabricksCliAuthentication(profileName); services.AddLakeSpeak(options => options.Profile = profileName); using var provider = services.BuildServiceProvider(); var genie = provider.GetRequiredService<IGenieClient>(); var response = await genie.AskAsync( agentId, question, cancellationToken: cancellationToken); 

The complete project includes the using directives and argument handling. In a hosted
application, use your existing dependency-injection container and supply the cancellation
token from the request or background task.

The response can contain answer text, generated SQL and a tabular result. Genie can also ask
for clarification. Check whether a result exists before using its rows. The example prints
an incomplete-result warning and exits with code 1 if the result is truncated.

Ask an existing Agent

For a live question, you need:

  • The Databricks CLI available to the process.
  • An existing Genie Agent shared with your identity.
  • Permission to use the Agent's warehouse and underlying data.

Copy the Agent's ID from Databricks. This console example does not resolve display names.
Replace YOUR_WORKSPACE_HOST and YOUR_AGENT_ID before running these commands:

databricks auth login --host "https://YOUR_WORKSPACE_HOST" --profile my-workspace dotnet run -c Release --no-build --no-restore -- my-workspace "YOUR_AGENT_ID" "How many orders were placed yesterday?" 

The selected CLI profile owns login and token refresh. Check DATABRICKS_HOST too: an existing
environment value can override the profile's host. The authentication guide
documents that precedence and the OAuth M2M path for unattended applications.

A live question creates conversation history and can use warehouse compute. Inspect the
returned SQL and compare the answer with a result you understand before relying on it.

When setup fails

Symptom Check
The process cannot find databricks Confirm the CLI is installed and on the PATH inherited by the application.
The request reaches the wrong workspace Check the selected profile and any DATABRICKS_HOST override.
The Agent is not found or access is denied Check that you passed an ID, then check Agent sharing, warehouse access and data permissions for that identity.
The response has text but no rows Read the response. It may be a clarification rather than a completed query result.
The .NET SDK cannot be selected The companion pins a .NET 8 SDK. Use its README's tested .NET 10 adaptation if you are working on .NET 10.

What the tests covered

The published 0.4.0 client passed this offline fixture on .NET 8 and .NET 10. A separate
installed .NET 8 consumer also completed one live synthetic question in a nonproduction AWS
workspace. Its existing starter Agent generated SELECT 1 AS probe_value and returned one
complete row containing 1.

The current-source .NET 10 M2M suite
passed all nine live tests on 7 November 2026. That suite covers questions, follow-up,
re-execution, feedback and client cancellation. It is separate from the installed-package
check. Client cancellation does not establish that remote warehouse work stopped.

These checks do not establish business-answer accuracy or GCP compatibility. The compatibility record
keeps the dated checks and their limits.

Choosing the client or the CLI

The official Databricks CLI
already provides Genie terminal commands. Use the .NET client when the conversation belongs
inside your C# application. Databricks also provides native benchmark evaluations.

LakeSpeak's separate Question Pack CLI supports versioned questions and reviewable reports.
In 0.4.0, behavior.requireQueryResult: true makes a pack reject missing or truncated results.
A complete zero-row result succeeds. The default is false; this setting does not judge
whether an answer is correct.

AI drafted and edited this tutorial using the project source and verification results.