createKimiHarness
Purpose and behavior
Section titled “Purpose and behavior”Create the Kimi Code CLI preset without starting the CLI; createAgent({ harness, model }) binds it and rejects reasoning and maxOutputTokens. It captures and resumes session bundles, forks with kimi fork and accepts acknowledged steering through its authenticated in-sandbox server. Native hooks, MCP servers or leases without live input use interruption/resume. Token usage is read from the session after exit.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”settingsOptionalKimiSettings | undefinedKimi Code settings; model, reasoning and maxOutputTokens belong on createAgent() and are rejected here.settings.hooksOptionalreadonly KimiHook<keyof KimiHookEvents>[] | undefinedNative Kimi hooks declared with defineKimiHook. The collection is copied at composition; callbacks require live process input on the sandbox lease.settings.regionOptional"mainland-cn" | "global" | undefinedKimi account deployment: “global” for kimi.ai (default) or “mainland-cn” for kimi.com, which selects the OAuth file and sign-in endpoints. Setting it with usage authentication fails when the harness is created.settings.authenticationOptionalAgentAuthentication | undefined“account” copies the region’s OAuth file and device_id from ~/.kimi-code (or KIMI_CODE_HOME, or the account.file profile directory) and runs kimi login in the sandbox. Usage forms forward KIMI_API_KEY and require a model on createAgent(); account key and variable fail when the agent is composed.settings.variablesOptionalReadonly<Record<string, string>> | undefinedEnvironment variables for Kimi commands, merged over .outpost/.env; KIMI_CODE_NO_AUTO_UPDATE defaults to 1. A name also set by the sandbox provider fails with code configuration.settings.conversationsOptionalConversationStore | undefinedStore that captures, locates and restores Kimi session bundles instead of the default native store, such as createTransportConversations(createKimiConversations(), …). A store that declares another format is rejected when the harness is created.settings.mcpServersOptionalMcpServers | undefinedMCP servers merged into .kimi-code/mcp.json in the agent home, keyed by server name; other servers in the file are kept. On the local provider this is your own home. Each referenced variable must be declared.settings.profileOptionalAgentProfile | undefinedPortable declaration from defineAgentProfile(), projected into Kimi Code requests. MCP servers merge with mcpServers and duplicate names fail at harness creation. Kimi Code refuses any built-in tool allowlist at createAgent(). Kimi refuses profile instructions on interactive requests.

