createAgent
Purpose and behavior
Section titled “Purpose and behavior”Compose a harness and a model into a frozen agent, without starting a process or making a network request. A reasoning level or maxOutputTokens the harness cannot apply throws code configuration at once. Without a model, a CLI harness keeps its native default; the built-in harness throws.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”Variant 1 — CliAgentOptions
Section titled “Variant 1 — CliAgentOptions”optionsRequiredCliAgentOptionsHarness and model selection to bind into one executable agent.options.harnessRequiredCliHarnessCLI preset, such as createCodexHarness(), bound to model when the agent is created.options.modelOptionalModelSpec | undefinedModel name or { name, reasoning, maxOutputTokens }; the preset rejects unsupported reasoning or maxOutputTokens here. Omitted, the CLI uses its default model, except that Kimi usage authentication and a Codex modelProvider require one.
Variant 2 — CustomAgentOptions
Section titled “Variant 2 — CustomAgentOptions”optionsRequiredCustomAgentOptionsHarness and model selection to bind into one executable agent.options.harnessRequiredHarnessBuilt-in Outpost harness with its configured model provider.options.modelRequiredModelSpecModel name or { name, reasoning, maxOutputTokens }. The model provider rejects unsupported reasoning or output limits here; the service checks the model name when it is called.
Variant 3 — AgentOptions
Section titled “Variant 3 — AgentOptions”The fields below cover all variants; the signature specifies their allowed combinations.
optionsRequiredAgentOptionsHarness and model selection to bind into one executable agent.options.harnessRequiredCliHarness | HarnessCLI preset, such as createCodexHarness(), bound to model when the agent is created.options.modelVariant-dependentModelSpec | undefined | ModelSpecModel name or { name, reasoning, maxOutputTokens }; the preset rejects unsupported reasoning or maxOutputTokens here. Omitted, the CLI uses its default model, except that Kimi usage authentication and a Codex modelProvider require one.

