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”The fields below cover all variants; the signature specifies their allowed combinations.
optionsRequiredCliAgentOptions | CustomAgentOptions | AgentOptionsHarness and model selection to bind into one executable agent.options.harnessRequiredCliHarness | Harness | CliHarness | HarnessCLI preset, such as createCodexHarness(), bound to model when the agent is created.options.modelVariant-dependentModelSpec | undefined | ModelSpec | ModelSpec | 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.