Canonical data shapes used throughout the Copilot Clojure SDK.
All maps use kebab-case keywords internally. Conversion to/from camelCase JSON happens at the transport boundary (see copilot.json-rpc).
Canonical data shapes used throughout the Copilot Clojure SDK. All maps use kebab-case keywords internally. Conversion to/from camelCase JSON happens at the transport boundary (see copilot.json-rpc).
Values of the :ask-user-variant session option (wire askUserVariant).
Values of the :ask-user-variant session option (wire askUserVariant).
Auto routing tiers accepted by copilot.session/switch-auto-tier!.
Auto routing tiers accepted by `copilot.session/switch-auto-tier!`.
(autopilot-options & {:keys [continuation-enabled max-continues]})Construct autopilot continuation options (session option :autopilot, wire execution.autopilot). Optional: :continuation-enabled (boolean), :max-continues (integer)
Construct autopilot continuation options (session option :autopilot, wire execution.autopilot). Optional: :continuation-enabled (boolean), :max-continues (integer)
(bearer-token-provider f)Wrap a token-producing function as a BYOK bearer-token provider.
f is a (fn [args] ...) returning a bearer token string (or a promise).
Wrap a token-producing function as a BYOK bearer-token provider. `f` is a (fn [args] ...) returning a bearer token string (or a promise).
(canvas-action name description & {:as opts})Create a canvas action.
name and description are required.
Optional: :input-schema (JSON-schema map).
Create a canvas action. `name` and `description` are required. Optional: :input-schema (JSON-schema map).
(canvas-action-context session-id
extension-id
canvas-id
instance-id
action-name
input
&
{:as opts})Create a canvas-action-context map. Optional: :host
Create a canvas-action-context map. Optional: :host
(canvas-declaration id display-name description & {:as opts})Create a canvas declaration.
Required: id, display-name, description.
Optional: :input-schema, :actions (vector of canvas-action maps).
Create a canvas declaration. Required: `id`, `display-name`, `description`. Optional: :input-schema, :actions (vector of canvas-action maps).
(canvas-host-capabilities & {:as opts})Create a canvas-host-capabilities map. Optional: :canvases (defaults to false).
Create a canvas-host-capabilities map. Optional: :canvases (defaults to false).
(canvas-host-context capabilities)Create a canvas-host-context map. capabilities is required.
Create a canvas-host-context map. `capabilities` is required.
(canvas-lifecycle-context session-id
extension-id
canvas-id
instance-id
&
{:as opts})Create a canvas-lifecycle-context map. Optional: :host
Create a canvas-lifecycle-context map. Optional: :host
(canvas-open-context session-id
extension-id
canvas-id
instance-id
input
&
{:as opts})Create a canvas-open-context map. Optional: :host
Create a canvas-open-context map. Optional: :host
(canvas-open-response & {:as opts})Create a canvas-open response. Optional keys: :url :title :status
Create a canvas-open response. Optional keys: :url :title :status
(capi-config & {:keys [enabled]})Construct the built-in Copilot API policy (session option :capi, wire github.capi). :enabled false keeps a BYOK-only model catalog.
Construct the built-in Copilot API policy (session option :capi, wire github.capi). :enabled false keeps a BYOK-only model catalog.
(client-info &
{:keys [editor-name editor-version extension-name
extension-version]})Construct the ClientInfo map declared on the connect handshake
(client option :client-info). All keys are optional strings; empty values
are dropped, and connect is not sent when every field is empty.
Keys: :editor-name :editor-version :extension-name :extension-version
Construct the ClientInfo map declared on the `connect` handshake (client option :client-info). All keys are optional strings; empty values are dropped, and `connect` is not sent when every field is empty. Keys: :editor-name :editor-version :extension-name :extension-version
Client modes (client option :mode). "coding-agent" (the default) keeps the CLI-like coding tools and defaults; "empty" enables only what each session asks for, so every create/resume must pass :available-tools. The legacy name "copilot-cli" is accepted as an alias of "coding-agent".
Client modes (client option :mode). "coding-agent" (the default) keeps the CLI-like coding tools and defaults; "empty" enables only what each session asks for, so every create/resume must pass :available-tools. The legacy name "copilot-cli" is accepted as an alias of "coding-agent".
(client-options & {:as opts})Create a client options map.
Optional keys: :cli-path - path to CLI executable (default: "copilot") :cli-args - extra CLI arguments (vector of strings) :cwd - working directory for CLI process :port - TCP port (default 0 = random) :use-stdio - use stdio transport (default true) :cli-url - URL of existing server (mutually exclusive with :cli-path/:use-stdio) :log-level - :none :error :warning :info :debug :all (default :info) :auto-start - auto-start on first use (default true) :auto-restart - auto-restart on crash (default true) :env - environment variables map :github-token - GitHub auth token :use-logged-in-user - use logged-in user auth (default true unless :github-token set) :session-idle-timeout-seconds - server-wide idle timeout for sessions in seconds :session-fs - session filesystem provider map (see session-fs-config) :copilot-home - custom path to the copilot home directory :tcp-connection-token - token for TCP connections :bearer-token-provider - BYOK bearer-token provider map (see bearer-token-provider) :builtin-plugin-directories - extra builtin plugin dirs (JSON: builtinPluginDirectories) :in-process - use in-process FFI transport (JSON: inProcess) :request-handler - CopilotRequestHandler map for outbound HTTP (see copilot-request-handler) :client-info - application identity sent on the connect handshake (see client-info) :mode - "coding-agent" (default) or "empty" (see client-modes) :network - network callbacks registered with network.setProvider: {:scope "connection"|"runtime" :resolve-proxy (fn [{:keys [url]}] -> PAC proxy string or nil) :authenticate-negotiate (fn [{:keys [spn]}] -> base64 token or nil) :authenticate-basic (fn [{:keys [proxy realm previous-rejected]}] -> {:username u :password p} or nil)}
Create a client options map.
Optional keys:
:cli-path - path to CLI executable (default: "copilot")
:cli-args - extra CLI arguments (vector of strings)
:cwd - working directory for CLI process
:port - TCP port (default 0 = random)
:use-stdio - use stdio transport (default true)
:cli-url - URL of existing server (mutually exclusive with :cli-path/:use-stdio)
:log-level - :none :error :warning :info :debug :all (default :info)
:auto-start - auto-start on first use (default true)
:auto-restart - auto-restart on crash (default true)
:env - environment variables map
:github-token - GitHub auth token
:use-logged-in-user - use logged-in user auth (default true unless :github-token set)
:session-idle-timeout-seconds - server-wide idle timeout for sessions in seconds
:session-fs - session filesystem provider map (see session-fs-config)
:copilot-home - custom path to the copilot home directory
:tcp-connection-token - token for TCP connections
:bearer-token-provider - BYOK bearer-token provider map (see bearer-token-provider)
:builtin-plugin-directories - extra builtin plugin dirs (JSON: builtinPluginDirectories)
:in-process - use in-process FFI transport (JSON: inProcess)
:request-handler - CopilotRequestHandler map for outbound HTTP (see copilot-request-handler)
:client-info - application identity sent on the connect handshake (see client-info)
:mode - "coding-agent" (default) or "empty" (see client-modes)
:network - network callbacks registered with network.setProvider:
{:scope "connection"|"runtime"
:resolve-proxy (fn [{:keys [url]}] -> PAC proxy string or nil)
:authenticate-negotiate (fn [{:keys [spn]}] -> base64 token or nil)
:authenticate-basic (fn [{:keys [proxy realm previous-rejected]}]
-> {:username u :password p} or nil)}(cloud-session-options & {:as opts})Create cloud-session options. Optional: :repository
Create cloud-session options. Optional: :repository
(cloud-session-repository owner name & {:as opts})Create cloud-session repository metadata. Optional: :branch
Create cloud-session repository metadata. Optional: :branch
(command-context session-id command command-name args)Construct a command context map.
Construct a command context map.
(command-definition name handler)(command-definition name description handler)Define a slash command. handler is a function of one arg (command-context map).
Define a slash command. `handler` is a function of one arg (command-context map).
(commands-invoke-request name & {:keys [input]})Construct a commands invoke request map.
name - command name
Optional: :input (string)
Construct a commands invoke request map. `name` - command name Optional: :input (string)
(commands-list-request &
{:keys [include-builtins include-client-commands
include-skills]})Construct a commands list request map.
Optional: :include-builtins (boolean), :include-client-commands (boolean), :include-skills (boolean)
Construct a commands list request map.
Optional: :include-builtins (boolean), :include-client-commands (boolean),
:include-skills (boolean)(copilot-request-handler f)Wrap a function as a CopilotRequestHandler for outbound HTTP requests.
f is a (fn [request] ...) returning a response map.
Wrap a function as a CopilotRequestHandler for outbound HTTP requests. `f` is a (fn [request] ...) returning a response map.
(custom-agent-config name prompt & {:as opts})Create a custom agent configuration.
name - unique agent name
prompt - agent prompt content
Optional: :display-name :description :tools :mcp-servers :infer
:skills (vector of skill name strings to preload)
:args-schema (opaque map emitted as argsSchema)
Create a custom agent configuration.
`name` - unique agent name
`prompt` - agent prompt content
Optional: :display-name :description :tools :mcp-servers :infer
:skills (vector of skill name strings to preload)
:args-schema (opaque map emitted as argsSchema)(elicitation-context session-id
message
&
{:keys [requested-schema mode elicitation-source url]})Construct an elicitation context map.
Construct an elicitation context map.
(elicitation-result action)(elicitation-result action content)Construct an elicitation result map.
action is one of "accept", "decline", "cancel".
content is an optional map of form values.
Construct an elicitation result map. `action` is one of "accept", "decline", "cancel". `content` is an optional map of form values.
(exit-plan-mode-request session-id)Construct an exit plan mode request map.
Construct an exit plan mode request map.
(exit-plan-mode-response approved)Construct an exit plan mode response map.
Construct an exit plan mode response map.
(get-auth-status-response m)Parse an auth.getStatus response.
Parse an auth.getStatus response.
(get-status-response m)Parse a status.get response.
Parse a status.get response.
(github-token-response result)Encode a :github-token-provider result as the gitHubToken.getToken reply.
result - a token string, a map {:access-token s :token-type s :expires-in secs}
(camelCase keys are also accepted), or :cancelled / nil to decline.
:expires-in is the remaining lifetime in seconds; the runtime
requires more than one hour, and it defaults to 28800 (8 hours,
the typical GitHub token lifetime).
Encode a :github-token-provider result as the gitHubToken.getToken reply.
`result` - a token string, a map {:access-token s :token-type s :expires-in secs}
(camelCase keys are also accepted), or :cancelled / nil to decline.
:expires-in is the remaining lifetime in seconds; the runtime
requires more than one hour, and it defaults to 28800 (8 hours,
the typical GitHub token lifetime).(image-generation-config & {:keys [enabled watermark save-to-disk]})Construct an image generation opt-in map (session option :image-generation, wire tools.imageGeneration). Optional: :enabled, :watermark, :save-to-disk (booleans)
Construct an image generation opt-in map (session option :image-generation, wire tools.imageGeneration). Optional: :enabled, :watermark, :save-to-disk (booleans)
(image-options & {:keys [size quality style]})Create image options map for image generation. Options: :size (e.g. "1024x1024"), :quality ("hd" or "standard"), :style ("natural" or "vivid")
Create image options map for image generation.
Options: :size (e.g. "1024x1024"), :quality ("hd" or "standard"), :style ("natural" or "vivid")(infinite-session-config & {:as opts})Create an infinite session configuration.
Optional: :enabled (default true), :background-compaction-threshold (0.0-1.0, default 0.80), :buffer-exhaustion-threshold (0.0-1.0, default 0.95)
Create an infinite session configuration.
Optional: :enabled (default true),
:background-compaction-threshold (0.0-1.0, default 0.80),
:buffer-exhaustion-threshold (0.0-1.0, default 0.95)(mcp-local-server-config command args tools & {:as opts})Create a local/stdio MCP server configuration.
command - command string
args - vector of argument strings
tools - vector of tool name strings (or ["*"] for all)
Optional: :type :timeout :env :cwd
Create a local/stdio MCP server configuration. `command` - command string `args` - vector of argument strings `tools` - vector of tool name strings (or ["*"] for all) Optional: :type :timeout :env :cwd
(mcp-remote-server-config type url tools & {:as opts})Create a remote MCP server configuration.
type - :http or :sse
url - remote server URL
tools - vector of tool name strings
Optional: :timeout :headers
Create a remote MCP server configuration. `type` - :http or :sse `url` - remote server URL `tools` - vector of tool name strings Optional: :timeout :headers
(memory-configuration & {:keys [enabled]})Construct a MemoryConfiguration map (opt-in persistent session memory).
Optional: :enabled (boolean). Maps to the camelCase wire key memory.
Construct a MemoryConfiguration map (opt-in persistent session memory). Optional: :enabled (boolean). Maps to the camelCase wire key `memory`.
(message-options prompt & {:as opts})Construct message options for sending a message.
prompt - the message string
Optional: :attachments (vector of attachment maps), :mode (:enqueue or :immediate),
:response-format (keyword from response-formats), :image-options (image options map),
:agent-mode (string agent name to route the message to),
:display-prompt (string shown in the UI in place of the raw prompt),
:request-headers (map of string->string custom HTTP headers for outbound model requests),
:source (message provenance: "user", "system", or "agent-<id>";
see message-source),
:response-schema (JSON Schema map for structured output, sent as a
json_schema responseFormat),
:client-turn-id (opaque caller-chosen turn identifier, wire clientTurnId)
Construct message options for sending a message.
`prompt` - the message string
Optional: :attachments (vector of attachment maps), :mode (:enqueue or :immediate),
:response-format (keyword from response-formats), :image-options (image options map),
:agent-mode (string agent name to route the message to),
:display-prompt (string shown in the UI in place of the raw prompt),
:request-headers (map of string->string custom HTTP headers for outbound model requests),
:source (message provenance: "user", "system", or "agent-<id>";
see `message-source`),
:response-schema (JSON Schema map for structured output, sent as a
`json_schema` responseFormat),
:client-turn-id (opaque caller-chosen turn identifier, wire `clientTurnId`)(message-source kind)(message-source kind agent-id)Construct a MessageSource value for the :source message option: (message-source :user) => "user", (message-source :system) => "system", (message-source :agent "id") => "agent-id".
Construct a MessageSource value for the :source message option: (message-source :user) => "user", (message-source :system) => "system", (message-source :agent "id") => "agent-id".
(model-billing multiplier & {:keys [token-prices picker-price-category]})Construct a model billing map.
multiplier - billing multiplier (double)
Optional: :token-prices (model-billing-token-prices map),
:picker-price-category (one of "high" "low" "medium" "very_high")
Construct a model billing map.
`multiplier` - billing multiplier (double)
Optional: :token-prices (model-billing-token-prices map),
:picker-price-category (one of "high" "low" "medium" "very_high")(model-billing-token-prices &
{:keys [batch-size cache-price input-price
output-price]})Construct a model billing token prices map.
Optional: :batch-size (int), :cache-price (int), :input-price (int), :output-price (int)
Construct a model billing token prices map.
Optional: :batch-size (int), :cache-price (int),
:input-price (int), :output-price (int)(model-capabilities-override & {:keys [supports limits vision]})Construct a model capabilities override map.
supports - map of capability flags (e.g. {:vision true})
limits - map of limits with snake_case wire keys, e.g.
(model-limits-override :max-output-tokens 8192)
=> {:max_output_tokens 8192}
vision - optional vision limits map
Construct a model capabilities override map.
`supports` - map of capability flags (e.g. {:vision true})
`limits` - map of limits with snake_case wire keys, e.g.
(model-limits-override :max-output-tokens 8192)
=> {:max_output_tokens 8192}
`vision` - optional vision limits map(model-info m)Parse a raw model info map from JSON-RPC response.
Parse a raw model info map from JSON-RPC response.
(model-limits-override &
{:keys [max-prompt-tokens max-output-tokens
max-context-window-tokens vision]})Construct the :limits map of model-capabilities-override. The wire keys
inside capabilities limits are snake_case (max_output_tokens, ...).
Optional: :max-prompt-tokens, :max-output-tokens, :max-context-window-tokens,
:vision (map with snake_case keys)
Construct the :limits map of `model-capabilities-override`. The wire keys
inside capabilities limits are snake_case (max_output_tokens, ...).
Optional: :max-prompt-tokens, :max-output-tokens, :max-context-window-tokens,
:vision (map with snake_case keys)(named-provider-config &
{:keys [type base-url api-key api-key-command
bearer-token wire-api transport azure headers
model-provider]
provider-name :name})Construct a NamedProviderConfig map for the :providers session option (wire inference.providers[]). Model definitions reference it by :name, which cannot contain '/'.
Required: :name, :base-url Optional: :type, :api-key, :api-key-command, :bearer-token, :wire-api, :transport, :azure, :headers, :model-provider
Construct a NamedProviderConfig map for the :providers session option
(wire inference.providers[]). Model definitions reference it by :name,
which cannot contain '/'.
Required: :name, :base-url
Optional: :type, :api-key, :api-key-command, :bearer-token, :wire-api,
:transport, :azure, :headers, :model-provider(network-set-provider-params network)Build the network.setProvider params for a :network client option, or nil when no callback is set. Each registered callback is marked with an empty object; :scope is "connection" (runtime default) or "runtime".
Build the network.setProvider params for a :network client option, or nil when no callback is set. Each registered callback is marked with an empty object; :scope is "connection" (runtime default) or "runtime".
(parse-assistant-image-data data)Parse assistant image data from a response map.
Parse assistant image data from a response map.
(parse-client-mode mode)Normalize a :mode client option (string or keyword) to :coding-agent or :empty. Throws ex-info for unknown values.
Normalize a :mode client option (string or keyword) to :coding-agent or :empty. Throws ex-info for unknown values.
(parse-content-block block)Parse a content block from a mixed text+image response.
Parse a content block from a mixed text+image response.
Known refusal reasons of session.permissions.setMode. :managed-policy ("managed_policy"): managed (enterprise) policy does not allow the mode.
Known refusal reasons of session.permissions.setMode. :managed-policy
("managed_policy"): managed (enterprise) policy does not allow the mode.(permission-request kind & {:as extra})Construct a permission request map.
kind is one of :shell :write :mcp :read :url.
Construct a permission request map. `kind` is one of :shell :write :mcp :read :url.
(permission-result kind & {:as extra})Construct a permission result map.
kind is one of :approved :denied-by-rules
:denied-no-approval-rule-and-could-not-request-from-user
:denied-interactively-by-user
Optional :decision-context (opaque map emitted as decisionContext).
Construct a permission result map. `kind` is one of :approved :denied-by-rules :denied-no-approval-rule-and-could-not-request-from-user :denied-interactively-by-user Optional :decision-context (opaque map emitted as decisionContext).
(permissions-set-mode-result m)Parse a session.permissions.setMode result into {:success :mode :reason}. A refused change has :success false and, when known, :reason "managed_policy".
Parse a session.permissions.setMode result into {:success :mode :reason}.
A refused change has :success false and, when known, :reason
"managed_policy".(ping-response m)Parse a raw ping response map.
Parse a raw ping response map.
(policy-helper-failure x)Extract the latest unresolved managed-settings policy helper failure (wire policyHelperFailure) from a refused session.create / session.resume (the thrown ex-info, its ex-data, or the JSON-RPC error :data) or from a managed settings snapshot. Returns nil when absent. Helper-authored text is untrusted: render it as plain text.
Keys: :category :failure-mode :message :previous-policy-retained :reason :authority :code :details :diagnostic :help-link
Extract the latest unresolved managed-settings policy helper failure
(wire policyHelperFailure) from a refused session.create / session.resume
(the thrown ex-info, its ex-data, or the JSON-RPC error :data) or from a
managed settings snapshot. Returns nil when absent. Helper-authored text
is untrusted: render it as plain text.
Keys: :category :failure-mode :message :previous-policy-retained :reason
:authority :code :details :diagnostic :help-link(provider-config & {:as opts})Create a provider configuration map for BYOK (Bring Your Own Key).
Required: :base-url Optional: :type (:openai :azure :anthropic), :wire-api, :api-key, :bearer-token, :azure {:api-version ...}, :api-key-command (command whose stdout is used as the API key), :model-provider ("openai" "anthropic" "azure_openai" "ollama" "lm_studio" "foundry_local" "llama_cpp"), :transport, :headers
On SDK protocol 4 this legacy single provider is sent as the named
"default" connection (inference.providers), selected with
inference.defaultProvider, with Copilot API models disabled
(github.capi.enabled false), which preserves v1 behavior.
Create a provider configuration map for BYOK (Bring Your Own Key).
Required: :base-url
Optional: :type (:openai :azure :anthropic), :wire-api, :api-key,
:bearer-token, :azure {:api-version ...},
:api-key-command (command whose stdout is used as the API key),
:model-provider ("openai" "anthropic" "azure_openai" "ollama"
"lm_studio" "foundry_local" "llama_cpp"),
:transport, :headers
On SDK protocol 4 this legacy single provider is sent as the named
"default" connection (`inference.providers`), selected with
`inference.defaultProvider`, with Copilot API models disabled
(`github.capi.enabled` false), which preserves v1 behavior.(provider-model-config &
{:keys [provider id model-id wire-model max-prompt-tokens
max-context-window-tokens max-output-tokens
capabilities]
display-name :name})Construct a ProviderModelConfig map for the :models session option (wire inference.models[]). Select the model with "<provider>/<id>".
Required: :provider, :id Optional: :model-id, :wire-model, :name, :max-prompt-tokens, :max-context-window-tokens, :max-output-tokens, :capabilities
Construct a ProviderModelConfig map for the :models session option
(wire inference.models[]). Select the model with "<provider>/<id>".
Required: :provider, :id
Optional: :model-id, :wire-model, :name, :max-prompt-tokens,
:max-context-window-tokens, :max-output-tokens, :capabilities(remote-enable-request & {:keys [mode]})Construct a remote enable request map.
Optional: :mode (one of "export" "off" "on")
Construct a remote enable request map. Optional: :mode (one of "export" "off" "on")
(remote-enable-result m)Parse a remote enable result map.
m - raw JSON map with :remoteSteerable (boolean, required) and :url (string, optional)
Parse a remote enable result map. `m` - raw JSON map with :remoteSteerable (boolean, required) and :url (string, optional)
Valid remote session mode values.
Valid remote session mode values.
(response-format->str fmt)Convert a response format keyword to its JSON string representation.
Convert a response format keyword to its JSON string representation.
(resume-session-config & {:as opts})Create a resume-session configuration map. Accepts the same keys as
session-config plus :disable-resume, :github-token,
:commands, :on-elicitation-request, :instruction-directories, and
:allow-transcript-recovery. :trust-working-directory is create-only and is
not sent on resume.
Create a resume-session configuration map. Accepts the same keys as `session-config` plus :disable-resume, :github-token, :commands, :on-elicitation-request, :instruction-directories, and :allow-transcript-recovery. :trust-working-directory is create-only and is not sent on resume.
(sandbox-config &
{:keys [enabled user-policy add-current-working-directory
sandbox-mcp-servers sandbox-lsp-servers
sandbox-extensions allow-bypass]
:or {enabled true}})Construct a sandbox configuration map (session option :sandbox-config, wire permissions.sandbox).
Optional: :enabled (default true), :user-policy, :add-current-working-directory, :sandbox-mcp-servers, :sandbox-lsp-servers, :sandbox-extensions, :allow-bypass (lets the agent ask to run an individual command outside the sandbox; the request goes through the normal permission flow)
Construct a sandbox configuration map (session option :sandbox-config,
wire permissions.sandbox).
Optional: :enabled (default true), :user-policy, :add-current-working-directory,
:sandbox-mcp-servers, :sandbox-lsp-servers, :sandbox-extensions,
:allow-bypass (lets the agent ask to run an individual command
outside the sandbox; the request goes through the normal
permission flow)(section-override action)(section-override action content)Create a section override.
action is one of :replace :remove :append :prepend.
content is optional string.
Create a section override. `action` is one of :replace :remove :append :prepend. `content` is optional string.
(session-config & {:as opts})Create a session configuration map. All keys are optional.
Recognised keys (kebab-case): :session-id :model :reasoning-effort :config-dir :tools :system-message :available-tools :excluded-tools :provider :on-permission-request :on-user-input-request :hooks :working-directory :streaming :mcp-servers :custom-agents :skill-directories :disabled-skills :infinite-sessions :model-capabilities :enable-config-discovery :include-sub-agent-streaming-events :github-token :commands :on-elicitation-request :session-fs (session filesystem provider map) :instruction-directories (list of directories to search for instruction files) :enable-citations :excluded-builtin-agents :session-limits :memory-config :otlp-protocol :enable-web-socket-responses :exp-assignments :rewind-enabled :additional-directories :disabled-mcp-servers :github-mcp-tool-config :canvas-provider :custom-agents-local-only :tool-search :experimental-mode :content-exclusion :on-mcp-auth-request (fn invoked to supply an MCP OAuth host token)
v2.6.0 / v3.0.0 keys:
:ask-user-variant ("legacy" or "elicitation")
:github-token-provider (fn [request] -> token string, token map, or
:cancelled; mutually exclusive with :github-token)
:sandbox-config (see sandbox-config, includes :allow-bypass)
:feature-flags (map of flag name -> value)
:allowed-models (vector of model ids)
:auth-client-id-metadata-url (string)
:agent-directories :hook-directories (vectors of paths)
:trust-working-directory (create only: "session" trusts the working
directory for this session, "user" persists it)
:allow-transcript-recovery (resume only)
:image-generation (see image-generation-config)
:autopilot (see autopilot-options)
:providers (see named-provider-config) :models (see provider-model-config)
:default-provider (string; on resume an explicit nil clears it)
:capi (see capi-config)
:on-shell-authentication-request (fn [request] -> value string or nil)
:store-memory (fn [memory] ...)
Create a session configuration map. All keys are optional.
Recognised keys (kebab-case):
:session-id :model :reasoning-effort :config-dir
:tools :system-message :available-tools :excluded-tools
:provider :on-permission-request :on-user-input-request :hooks
:working-directory :streaming :mcp-servers :custom-agents
:skill-directories :disabled-skills :infinite-sessions
:model-capabilities :enable-config-discovery
:include-sub-agent-streaming-events
:github-token :commands :on-elicitation-request
:session-fs (session filesystem provider map)
:instruction-directories (list of directories to search for instruction files)
:enable-citations :excluded-builtin-agents :session-limits :memory-config
:otlp-protocol :enable-web-socket-responses :exp-assignments
:rewind-enabled :additional-directories :disabled-mcp-servers
:github-mcp-tool-config :canvas-provider :custom-agents-local-only
:tool-search :experimental-mode :content-exclusion
:on-mcp-auth-request (fn invoked to supply an MCP OAuth host token)
v2.6.0 / v3.0.0 keys:
:ask-user-variant ("legacy" or "elicitation")
:github-token-provider (fn [request] -> token string, token map, or
:cancelled; mutually exclusive with :github-token)
:sandbox-config (see `sandbox-config`, includes :allow-bypass)
:feature-flags (map of flag name -> value)
:allowed-models (vector of model ids)
:auth-client-id-metadata-url (string)
:agent-directories :hook-directories (vectors of paths)
:trust-working-directory (create only: "session" trusts the working
directory for this session, "user" persists it)
:allow-transcript-recovery (resume only)
:image-generation (see `image-generation-config`)
:autopilot (see `autopilot-options`)
:providers (see `named-provider-config`) :models (see `provider-model-config`)
:default-provider (string; on resume an explicit nil clears it)
:capi (see `capi-config`)
:on-shell-authentication-request (fn [request] -> value string or nil)
:store-memory (fn [memory] ...)(session-fs-config initial-cwd session-state-path & {:keys [conventions]})Create a session filesystem configuration.
initial-cwd - initial working directory
session-state-path - path for session state storage
Optional: :conventions ("windows" or "posix")
Create a session filesystem configuration.
`initial-cwd` - initial working directory
`session-state-path` - path for session state storage
Optional: :conventions ("windows" or "posix")(session-fs-file-info name size is-directory is-file & {:as opts})Create a session filesystem file info map.
name - file or directory name
size - size in bytes
is-directory - boolean
is-file - boolean
Optional: :created-at (ISO 8601 string), :modified-at (ISO 8601 string)
Create a session filesystem file info map. `name` - file or directory name `size` - size in bytes `is-directory` - boolean `is-file` - boolean Optional: :created-at (ISO 8601 string), :modified-at (ISO 8601 string)
(session-hooks & {:as opts})Create a session hooks map.
Optional keys: :on-pre-tool-use (fn [input invocation] ...) :on-post-tool-use (fn [input invocation] ...) :on-pre-mcp-tool-call (fn [input invocation] ...) :on-user-prompt-submitted (fn [input invocation] ...) :on-session-start (fn [input invocation] ...) :on-session-end (fn [input invocation] ...) :on-error-occurred (fn [input invocation] ...) :on-subagent-start (fn [input invocation] ...) hook type "subagentStart": input has :agentName :agentDisplayName :agentDescription; may return {:additionalContext "..."} :on-subagent-stop (fn [input invocation] ...) hook type "subagentStop": input adds :agentId :agentType :stopReason :response; may return {:decision "block" :reason "..."} or {:modifiedResponse "..."}
Create a session hooks map.
Optional keys:
:on-pre-tool-use (fn [input invocation] ...)
:on-post-tool-use (fn [input invocation] ...)
:on-pre-mcp-tool-call (fn [input invocation] ...)
:on-user-prompt-submitted (fn [input invocation] ...)
:on-session-start (fn [input invocation] ...)
:on-session-end (fn [input invocation] ...)
:on-error-occurred (fn [input invocation] ...)
:on-subagent-start (fn [input invocation] ...) hook type "subagentStart":
input has :agentName :agentDisplayName :agentDescription;
may return {:additionalContext "..."}
:on-subagent-stop (fn [input invocation] ...) hook type "subagentStop":
input adds :agentId :agentType :stopReason :response;
may return {:decision "block" :reason "..."} or
{:modifiedResponse "..."}(session-lifecycle-event m)Parse a raw session lifecycle event from JSON-RPC notification.
Parse a raw session lifecycle event from JSON-RPC notification.
(session-limits & {:keys [max-ai-credits]})Construct a session spending-limits map.
Optional: :max-ai-credits (number) → wire key maxAiCredits.
Construct a session spending-limits map. Optional: :max-ai-credits (number) → wire key `maxAiCredits`.
(session-metadata m)Parse a raw session metadata map.
Parse a raw session metadata map.
(shell-authentication-request m)Parse shellAuthentication.request params into the map passed to an :on-shell-authentication-request handler. :input-kind is "secret" (mask the input), "text", or "confirm" (answer "yes" or cancel).
Parse shellAuthentication.request params into the map passed to an :on-shell-authentication-request handler. :input-kind is "secret" (mask the input), "text", or "confirm" (answer "yes" or cancel).
(shell-authentication-response result)Encode a shell authentication handler result as the reply: a string (or {:action "accept" :value s}) accepts with that value; nil, :cancel, or {:action "cancel"} cancels.
Encode a shell authentication handler result as the reply: a string (or
{:action "accept" :value s}) accepts with that value; nil, :cancel, or
{:action "cancel"} cancels.(skills-load-diagnostics errors warnings)Construct a skills load diagnostics map.
errors - vector of error strings
warnings - vector of warning strings
Construct a skills load diagnostics map. `errors` - vector of error strings `warnings` - vector of warning strings
(slash-command-info allow-during-agent-execution
description
kind
name
&
{:as opts})Construct a slash command info map.
allow-during-agent-execution - boolean
description - description string
kind - one of "builtin" "client" "skill"
name - command name
Optional: :aliases (vector of strings), :experimental (boolean),
:input (slash-command-input map)
Construct a slash command info map.
`allow-during-agent-execution` - boolean
`description` - description string
`kind` - one of "builtin" "client" "skill"
`name` - command name
Optional: :aliases (vector of strings), :experimental (boolean),
:input (slash-command-input map)(slash-command-input hint & {:keys [completion]})Construct a slash command input map.
hint - hint string for the command input
Optional: :completion ("directory")
Construct a slash command input map.
`hint` - hint string for the command input
Optional: :completion ("directory")(stored-memory m)Parse memoryStore.store params into the map passed to a :store-memory callback: {:session-id :subject :fact :citations :reason}.
Parse memoryStore.store params into the map passed to a :store-memory
callback: {:session-id :subject :fact :citations :reason}.(system-message-append)(system-message-append content)Append-mode system message (default). Content is appended after SDK sections.
Append-mode system message (default). Content is appended after SDK sections.
(system-message-customize)(system-message-customize sections)(system-message-customize sections content)Customize-mode system message. Override individual sections.
Customize-mode system message. Override individual sections.
(system-message-replace content)Replace-mode system message. Caller provides entire system message.
Replace-mode system message. Caller provides entire system message.
(tool name description parameters handler & {:keys [idempotent]})Construct a tool definition.
name - tool name string
description - description for the LLM
parameters - JSON Schema map (or nil)
handler - (fn [args invocation] ...) -> any (may return a promise)
Optional: :idempotent true marks the tool as safe to retry (repeated calls
with the same arguments have no additional side effects).
Construct a tool definition.
`name` - tool name string
`description` - description for the LLM
`parameters` - JSON Schema map (or nil)
`handler` - (fn [args invocation] ...) -> any (may return a promise)
Optional: :idempotent true marks the tool as safe to retry (repeated calls
with the same arguments have no additional side effects).(tool-binary-result data mime-type type)(tool-binary-result data mime-type type desc)Construct a binary result entry.
data - base64-encoded string
mime-type - MIME type string
type - result type string
desc - optional description
Construct a binary result entry. `data` - base64-encoded string `mime-type` - MIME type string `type` - result type string `desc` - optional description
(tool-invocation session-id tool-call-id tool-name arguments)Construct a tool invocation context map.
Construct a tool invocation context map.
(tool-result text result-type)(tool-result text result-type opts)Construct a normalised tool result map.
text - string result for the LLM
result-type - one of :success :failure :rejected :denied
opts - optional map of :error :session-log :tool-telemetry
:binary-results-for-llm
Construct a normalised tool result map.
`text` - string result for the LLM
`result-type` - one of :success :failure :rejected :denied
`opts` - optional map of :error :session-log :tool-telemetry
:binary-results-for-llm(tool-shell-output event-or-data)Parse the data of a tool.shell_output event (or the whole event) into {:tool-call-id :text :sequence :stream}. :stream is "stdout" (also when omitted), "stderr", or "terminal".
Parse the data of a tool.shell_output event (or the whole event) into
{:tool-call-id :text :sequence :stream}. :stream is "stdout" (also when
omitted), "stderr", or "terminal".Event type of live, append-only shell output chunks (ephemeral).
Event type of live, append-only shell output chunks (ephemeral).
(trace-context & {:keys [traceparent tracestate]})Construct a trace context map.
Construct a trace context map.
(user-input-request question & {:as opts})Construct a user input request.
question - string
Optional: :choices (vec of strings), :allow-freeform (bool)
Construct a user input request. `question` - string Optional: :choices (vec of strings), :allow-freeform (bool)
(user-input-response answer was-freeform)Construct a user input response.
answer - string
was-freeform - boolean
Construct a user input response. `answer` - string `was-freeform` - boolean
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |