Code interpreter AI agent tools
Important
This feature is in Public Preview.
Add code interpreter tools to AI agents using the Mosaic AI Agent Framework to enable agents to execute arbitrary code provided by an interacting user, retrieved from a code base, or written by the agent.
To learn more about agent tools, see AI agent tools and to create tools that execute custom task-specific operations, see Create custom AI agent tools with Unity Catalog functions
Built-in Python executor tool
Azure Databricks also provides a built-in Unity Catalog function allowing AI agents to dynamically execute Python code within queries dynamically.
system.ai.python_exec
is available by default and can be used like any other Unity Catalog function-based tool.
The following example shows you how to use the python_exec
function in a SQL query:
SELECT python_exec("""
import random
numbers = [random.random() for _ in range(10)]
print(numbers)
""")
Next steps
After you create an agent tool, add the tool to an AI agent. See Add Unity Catalog tools to agents.