# Function: createAgent()

```ts
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[​](#parameters "Direct link to Parameters")

| Parameter | Type                                                                      |
| --------- | ------------------------------------------------------------------------- |
| `def`     | [`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md) |

## Returns[​](#returns "Direct link to Returns")

[`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md)

## Example[​](#example "Direct link to Example")

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

```
