Skip to main content

Function: createAgent()

function createAgent(def: AgentDefinition): AgentDefinition;

Pure factory for agent definitions: cycle-detects the sub-agent graph and returns the same object, stamped with a non-enumerable AGENT_BRAND so discovery recognizes it. Safe at module top-level; no adapter is built. Don't Object.freeze the definition before passing it in — the brand is written onto the argument.

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