Databricks AI Agent
Use the Databricks AI Agent node to build an AI agent whose runs show up in MLflow Tracing in your Databricks workspace. The node runs the same agent as the AI Agent node: it takes the same chat model, memory, tool, and output parser sub-nodes and offers the same options. What it adds is Export Traces to MLflow. With the option on, each run creates one trace in an MLflow experiment, with a span for every model call and tool call, so the team that runs your Databricks workspace can inspect n8n agents next to the rest of their AI systems.
On this page, you'll find the prerequisites, setup steps, node parameters, what a trace contains, and how the export behaves when something fails.
Prerequisites
To run the agent, you need a chat model sub-node with its own credential, such as the Databricks Chat Model node. To export traces, you also need:
A Databricks OAuth2 credential in n8n, with a service principal or user login. A service principal must be a member of the workspace with the Workspace access entitlement.
CAN EDIT on the experiment that receives the traces. CAN READ isn't enough: the export fails with a
403that says the identity doesn't have permission to edit the experiment.For the default experiment the node creates under
/Shared, no extra grant. Databricks gives all workspace users CAN MANAGE on objects in the/Sharedfolder by default, so the identity can create the experiment and write to it. The same default means every workspace user can open and delete those traces. For workflows that handle personal or confidential data, set Experiment to a path in a folder you control. Alternatively, create the experiment first and set its permissions before you turn on the export.
Permission changes take a minute or more to reach the trace service. A run right after a change can still use the old permissions.
Set up the node
Add a Databricks AI Agent node to your workflow, for example after a Chat Trigger node.
Select the + on the Chat Model connector and add a chat model, such as the Databricks Chat Model node. Add memory, tools, and an output parser the same way you would for the AI Agent node. The Databricks Vector Store node and the Databricks Genie One MCP server both work as tools.
Set Source for Prompt (User Message) and the node options.
To export traces, select a Databricks OAuth2 credential under Credential to connect with and turn on Export Traces to MLflow.
In Experiment, leave the name empty to let the node create an experiment for the workflow, or enter the path or ID of an existing experiment. Refer to Node parameters.
Run the workflow. In Databricks, open Experiments in the sidebar, select the experiment, then the Traces tab. Each run of the agent appears as one trace with a preview of the question and the answer.
Node parameters
Source for Prompt (User Message): Where the user message comes from: Connected Chat Trigger Node or Define below. Works like the same field on the AI Agent node. The node doesn't offer the Connected Guardrails Node source.
Require Specific Output Format: Turn on to connect an output parser sub-node that shapes the agent's output.
Enable Fallback Model: Turn on to connect a second chat model that the agent uses when the main model fails.
Export Traces to MLflow: Whether to send each run to MLflow Tracing in the workspace of the credential selected on this node. Turned off by default.
Experiment: Where the traces are stored. Shown when Export Traces to MLflow is on.
By Name: The experiment path, for example
/Shared/my-agent-traces. The node creates the experiment if it doesn't exist. Leave the field empty to use/Shared/n8n-workflows-<workflow-id>, one experiment for each workflow.By ID: The numeric ID of an existing experiment, as shown in its URL in Databricks. An ID that doesn't exist doesn't fail the run: the agent answers, and the export fails afterwards with a warning in the n8n log.
Node options
The options are the ones of the AI Agent node. Refer to Tools Agent for System Message, Max Iterations (default 10), Return Intermediate Steps, Automatically Passthrough Binary Images, Tracing Metadata, and Enable Streaming. Two more options:
Automatically Passthrough Binary PDFs: Whether to pass binary PDF documents from the input to the model as part of the message. Turned off by default. Use it with a model that accepts PDF input.
Batch Processing: Batch Size sets how many input items the agent processes at once (default
1), and Delay Between Batches waits the given number of milliseconds between batches (default0). Use it to stay under the rate limit of a pay-per-token model service.
What the node exports
Each item the node processes becomes one trace. A trace holds a tree of spans:
The agent run at the top, with the user message as input and the final answer as output.
One span for each model call, with the full message list sent to the model and its completion in OpenAI format. The message list includes the system message, the conversation history loaded from memory, and any images or PDFs passed to the model as base64. The span also records tool calls and the token usage of the call.
One span for each tool call, with the arguments and the result. A vector store tool's span shows the documents it returned.
One span for each retriever call, when a tool such as the Vector Store Question Answer Tool queries a vector store through a retriever.
Every span carries its start and end time. The trace itself carries:
client_request_id: the n8n execution ID, so a trace in the workspace maps back to one execution in n8n.The tags
n8n.source(n8n),n8n.workflowId, andn8n.node(the node's name).A request preview and a response preview, the first 1,000 characters of the question and the answer, shown as the two columns of the trace list.
The total token usage of the run, so the trace list shows cost per run without opening a span.
A state:
OK, orERRORwhen the run failed. A failed model call makes the traceERRORwith the Databricks error message on the model span. A tool that throws is recorded as anERRORtool span, while the trace staysOKwhen the agent recovers and answers.
Streaming runs export the same spans, with end times and token counts filled in. When you cancel a run, the export stops with it. The experiment then shows no trace for the run, or a trace without spans. Either way, n8n logs an export failure. A model span is named ChatOpenAI rather than after the model service, because the Databricks Chat Model node calls the gateway through an OpenAI-compatible client.
How export failures behave
Trace export is observability, so it never changes the result of a run:
When the node can't prepare the export, because the credential doesn't work, the experiment lookup fails, or the identity lacks permission, the agent still runs and answers. n8n writes
Databricks AI Agent: could not prepare MLflow trace exportwith the reason to its log.When the trace write fails after the run, the run's output stands and n8n logs
Databricks AI Agent: MLflow trace export failedwith the Databricks error. The warning appears in the n8n server log only, not in the execution.A partial export is possible: Databricks can register the trace but reject the upload of its spans. The trace then appears in the list without spans.
The one hard failure is a missing credential. With Export Traces to MLflow on and no credential selected, the node fails before any model call with
Select a Databricks credential to export traces to MLflow.
The export makes three calls for each trace: it registers the trace in the experiment, requests a signed upload URL, and uploads the spans to that URL. The upload URL carries its own short-lived credential, so the workspace token is never sent to it.
Related resources
AI Agent and Tools Agent for the agent's options and common issues
Databricks Vector Store, including a worked example of an agent that answers from a Databricks index
Migrating from the community package: refer to Migrate from the n8n-nodes-databricks community package
MLflow Tracing and MLflow experiment permissions in the Databricks documentation
View n8n's Advanced AI documentation.
Common issues
Select a Databricks credential to export traces to MLflow
Export Traces to MLflow is on, but the node has no credential. Select a Databricks OAuth2 credential under Credential to connect with, or turn the option off.
No traces appear in the experiment
The run succeeded but the experiment stays empty. Check the n8n server log for a line that starts with Databricks AI Agent:. It names the cause: a 403 means the identity lacks CAN EDIT on the experiment, a 404 with RESOURCE_DOES_NOT_EXIST means the By ID experiment doesn't exist, and a token error means the credential can't reach the workspace. After granting a permission, wait a minute before you run again.
A trace has no spans
Databricks registered the trace but rejected the span upload, so the trace list shows the run without its tree. Check the n8n server log for the upload error and the identity's CAN EDIT permission on the experiment.
Agent issues
For problems with the agent itself, such as a model that doesn't call tools or hits a rate limit, refer to Choose a model for agents on the Databricks Chat Model page and the AI Agent common issues.
Last updated
Was this helpful?