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 SDK visualization

haaland
Databricks Partner

The documentation says you can send in an optional enable_visualization boolean when starting a conversation or sending a message to the agent:

start_conversation_and_wait(space_id: str, content: str [, enable_visualization: Optional[bool], timeout: datetime.timedelta = 0:20:00])

create_message_and_wait(space_id: str, conversation_id: str, content: str [, enable_visualization: Optional[bool], timeout: datetime.timedelta = 0:20:00]) 

ref: https://databricks-sdk-py.readthedocs.io/en/stable/workspace/dashboards/genie.html

But I get error message when I try to send in this argument:

Example call: 

response = w.genie.start_conversation_and_wait(
space_id=agent_id,
content="some natural language question",
enable_visualization = True,
timeout=timedelta(minutes=2),
)

Error message:
TypeError: GenieAPI.start_conversation_and_wait() got an unexpected keyword argument 'enable_visualization'

Is the enable_visualization option no longer available?

 

 

6 REPLIES 6

Gecofer
Contributor III

Hi @haaland

The TypeError indicates that the databricks-sdk version loaded by your Python environment does not expose that parameter, even though it appears in the current stable documentation. I would first compare the installed version and runtime signature:

import inspect
import databricks.sdk

print(databricks.sdk.__version__)
print(inspect.signature(w.genie.start_conversation_and_wait))

Then upgrade the SDK and restart the Python process:

%pip install --upgrade databricks-sdk
dbutils.library.restartPython()

If enable_visualization still does not appear in the signature after upgrading, the published documentation may be ahead of the currently released package or the option may not yet be available in that API surface. In that case, please share the installed SDK version so it can be verified against the release notes.

haaland
Databricks Partner

Hi!

The sdk version is 0.141.0.

The signature is
(space_id: 'str', content: 'str', timeout=datetime.timedelta(seconds=1200)) -> 'GenieMessage'

i.e. still missing enable_visualization.

ivanvyd
New Contributor III

@haaland please try restarting the python process and check databricks.sdk.__file__ as well as the version / signature. That should rule out a stale import or another SDK installation being loaded.

I agree with @Gecofer . And if it still resolves to 0.141.0 from the expected path with that old signature, this looks worth raising as an packaging discrepancy.

Ivan Vydrin
Lead Software & AI Engineer · Tech Fabric LLC

haaland
Databricks Partner

Hi! 
Not sure what I did to fix it, but now  it accepts the enable_visualization argument. 

Signature now prints out as:

(space_id: 'str', content: 'str', *, enable_visualization: 'Optional[bool]' = None, timeout=datetime.timedelta(seconds=1200)) -> 'GenieMessage'

Gecofer
Contributor III

Great, thanks for confirming!

Since the signature now includes enable_visualization, it looks like the SDK itself was correct and the issue was most likely related to the Python process still using a previously loaded version/module.

Restarting the Python process after upgrading or changing the SDK is therefore an important step here.

Glad it is working now!

Louis_Frolio
Databricks Employee
Databricks Employee

Hello @haaland, I took a look at both internal and external documentation and here is what I found.

Glad it's working, and @Gecofer and @ivanvyd had the right diagnosis. enable_visualization was never removed. It shipped in databricks-sdk v0.120.0 (July 2026), alongside the viz attachment type and download_message_attachment_visualization(), and nothing through 0.141.0 took it back out. So a 0.141.0 version string next to a signature that lacks the argument means the files on disk and the code running in your Python process had drifted apart: either a stale process still holding the classes your WorkspaceClient was built from, or a second interpreter or SDK copy doing the loading.

The checks Gecofer and Ivan suggested are the way to confirm which:

import inspect, sys
import databricks.sdk

print(sys.executable)
print(databricks.sdk.__version__)
print(databricks.sdk.__file__)
print(inspect.signature(w.genie.start_conversation_and_wait))

In a notebook, upgrade, restart Python, then rebuild the client:

%pip install --upgrade databricks-sdk
dbutils.library.restartPython()

After the restart the signature should show enable_visualization: Optional[bool] = None. If it still doesn't, compare sys.executable and databricks.sdk.__file__ against the environment where you ran the install. For a Databricks App, pin databricks-sdk>=0.120.0 in requirements.txt and redeploy.

On what the flag actually does: it asks Genie to generate a visualization but doesn't guarantee one. When the question and data support a chart, the response carries a viz attachment (Beta) next to the query attachment, with a title and the query_attachment_id it came from. For a rendered PNG, call w.genie.download_message_attachment_visualization(name=...) with name in the form spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/attachments/{attachment_id}. That only works once the message status is COMPLETED, so the _and_wait variants you're using are the right fit.

References:

Regards,
Louis.