cancel
Showing results for 
Search instead for 
Did you mean: 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results for 
Search instead for 
Did you mean: 

Genie Agent refuses to add scalar SQL function from Unity Catalog

charl-p-botha
Databricks Partner

We would like to add some scalar SQL functions to our Genie Agents, for context that can't be provided via other mechanisms. In testing this, we have discovered that scalar functions are not supported, although the documentation explicitly states that they are.

The documentation at https://learn.microsoft.com/en-us/azure/databricks/genie-agents/tune-quality#how-does-genie-use-sql-... states the following:

"Genie supports both scalar functions, which return a single value, and table-valued functions, which return a table of rows."

When we attempt to attach a test UC scalar function, SQL or Python, that returns the number 42, it errors out with: "You must select a function that returns a table.", see attached screenshot.

Are the docs incorrect, or should the Genie Agent in fact support scalar functions, which would be convenient. In the meantime, we'll work around this by wrapping the scalar in a table.

2 REPLIES 2

ivanvyd
New Contributor III

@charl-p-botha I think your reading is right. The current docs say Genie supports both scalar and table-valued Unity Catalog functions, and the August 27 release notes explicitly say that both can be attached as Genie Agent tool.

Given the UI message, the table-valued wrapper looks like a reasonable workaround for now rather than an intended requirement.

If it persists, it may be worth capturing the workspace cloud/region, function definition and DESCRIBE FUNCTION EXTENDED output, then raising it with Support so they can check whether this is specific to the workspace or current UI behavior.

ThomazNeto
Databricks Partner

Hi,

The tune-quality page (updated Sep 11) says "Genie supports both scalar functions, which return a single value, and table-valued functions, which return a table of rows", and the Aug 27 release note is explicit: "Agent authors can now attach both scalar and table-valued Unity Catalog functions as tools for a Genie Agent." Nowhere in the docs is there a "must return a table" restriction. So the UI message you're getting is either a rollout lag in your workspace or a bug, not intended behavior.
https://docs.databricks.com/aws/en/genie-agents/tune-quality#how-does-genie-use-sql-functions
https://docs.databricks.com/aws/en/ai-bi/release-notes/2026

Two things worth checking before you file it. First, where you're adding it: the docs describe the flow as Configure, then the Examples tab, SQL functions. If your workspace still shows an older add-function dialog somewhere else, that may be the one that hasn't caught up. Second, the function needs a proper COMMENT, since Genie can't see the body and only reasons over the description (the Sep 3 note added showing that description in the agent). A scalar returning 42 with no description won't be much use to the agent even once it attaches.

Your workaround is fine in the meantime, a one-row table function wrapping the scalar. When you open the ticket, include cloud/region, the CREATE FUNCTION statement and DESCRIBE FUNCTION EXTENDED output as Ivan suggested, plus a link to that Aug 27 release note so support can't argue it isn't supposed to work.

Would be good to hear back on what they say, this affects more people than just you.

Thomaz A. Rossito Neto
Principal Data & AI — CI&T
thomazn@ciandt.com
linkedin.com/in/thomaz-antonio-rossito-neto