Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
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 AI agent tools using 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 a Unity Catalog tool, add it to your agent. See Create an agent tool.