Skip to main content

Function: createAgent()

Function: createAgent()

function createAgent(def: AgentDefinition): AgentDefinition;

Pure factory for agent definitions. Returns the passed-in definition after cycle-detecting the sub-agent graph. Accepts the full AgentDefinition shape and is safe to call at module top-level.

The returned value is a plain AgentDefinition — no adapter construction, no side effects. Register it with agents({ agents: { name: def } }) or run it standalone via runAgent(def, input).

Parameters

ParameterType
defAgentDefinition

Returns

AgentDefinition

Example

const support = createAgent({
  instructions: "You help customers.",
  model: "databricks-claude-sonnet-4-5",
  tools: {
    get_weather: tool({ ... }),
  },
});

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs