Code Mode gives an agent one Effect AI Tool for a small JavaScript program. The program can call a
fixed set of application Tools through named globals, then return one JSON value. It fits questions
that need authorized reads and writes, overlapping independent I/O, and a compact answer.
For example, an invoice analyst can answer a question this way:
constcode=`async () => {
const result = await warehouse.query({
sql: "SELECT region, SUM(revenue) AS total FROM invoice_summary GROUP BY region",
});
return result.rows.sort((a, b) => Number(b.total) - Number(a.total))[0];
}`;
warehouse is not a database client. It is a generated global that routes through the runtime’s
Tool broker to an application-owned Tool handler. The handler decides which resources the program may read or change.
This smaller example uses fixed invoice rows so the complete Tool and handler are visible.
Generated code calls warehouse.invoices({ region: "emea" }) and computes its answer from those
rows. The linked warehouse example replaces the fixed data with a brokered SQL query.
Effect AI Tool annotation key declaring a Tool's execution class, applied
with Tool.annotate(ToolExecutionClass, "...").
Unannotated Tools default to "uncertain": security and durability
decisions are fail-closed, so the framework never infers a safer class
from a Tool's shape.
Creates a user-defined tool with the specified name and configuration.
Details
This is the primary constructor for creating custom tools that AI models
can call. The tool definition includes parameter validation, success/failure
schemas, and optional service dependencies.
If a tool accepts no parameters but still needs an explicit empty object
schema, use
EmptyParams
.
Example (Creating a tool without parameters)
import{ Schema }from"effect"
import{ Tool }from"effect/ai"
// Simple tool with no parameters
constGetCurrentTime=Tool.make("GetCurrentTime",{
description:"Returns the current timestamp",
success:Schema.Number
})
GetCurrentTime.name// => "GetCurrentTime"
@stability ― unstable
@category ― constructors
@since ― 4.0.0
make("list_invoices",{
description?:string|undefined
An optional description explaining what the tool does.
description:"Read invoice totals for a region: emea or americas.",
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Effect AI Tool annotation key declaring a Tool's execution class, applied
with Tool.annotate(ToolExecutionClass, "...").
Unannotated Tools default to "uncertain": security and durability
decisions are fail-closed, so the framework never infers a safer class
from a Tool's shape.
This is the primary constructor for creating toolkits. It accepts multiple
tools and organizes them into a toolkit that can be provided to AI language
models.
Returns the elements of an array that meet the condition specified in a callback function.
@param ― predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
@param ― thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Explicit allowlist: namespace name → method name → native Effect AI
Tool. Reads and mutations are allowed; calls requiring additional approval fail closed.
Validate an agent ID and return a shallowly frozen, model-agnostic definition.
make("invoice-analyst",{
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Use run_javascript to calculate invoice answers. Return an answer as JSON.",Toolkit<{ readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.input: Schema.String
input:
importSchema
Schema.
constString:Schema.String
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof"string".
@category ― models
@since ― 4.0.0
@category ― schemas
@since ― 4.0.0
String,
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Use run_javascript to calculate invoice answers. Return an answer as JSON.",Toolkit<{ readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.output: Schema.Struct<{
readonlyanswer:Schema.String;
}>
output:
importSchema
Schema.
functionStruct<{
readonlyanswer:Schema.String;
}>(fields:{
readonlyanswer:Schema.String;
}):Schema.Struct<{
readonlyanswer:Schema.String;
}>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Schema for string values. Validates that the input is typeof"string".
@category ― models
@since ― 4.0.0
@category ― schemas
@since ― 4.0.0
String}),
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Use run_javascript to calculate invoice answers. Return an answer as JSON.",Toolkit<{ readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.instructions: "Use run_javascript to calculate invoice answers. Return an answer as JSON."
instructions:"Use run_javascript to calculate invoice answers. Return an answer as JSON.",
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Use run_javascript to calculate invoice answers. Return an answer as JSON.",Toolkit<{ readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.toolkit: Toolkit.Toolkit<{
This is the primary constructor for creating toolkits. It accepts multiple
tools and organizes them into a toolkit that can be provided to AI language
models.
The ordinary Effect AI Tool to include in the model-facing Toolkit.
tool),
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Use run_javascript to calculate invoice answers. Return an answer as JSON.",Toolkit<{ readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.policy?:Partial<Readonly<Omit<{
readonlyrunStatus:"appended"|"off";
readonlymaxTurns:number;
readonlymaxToolCalls:number;
readonlymaxDuration:Duration;
readonlytoolConcurrency:number;
readonlyrepeatedFailureLimit:number;
readonlyonExhaustion:"final-answer"|"fail";
readonlycompletionReserveTokens:number;
readonlytoolResultBounds:ToolResultBounds;
readonlycompaction:CompactionPolicy;
readonlytokenBudget?:number|undefined;
readonlycostBudgetMicrousd?:number|undefined;
readonlycontextTokenLimit?:number|undefined;
readonlyrestartOnJoinedInput?:boolean|undefined;
readonlymodelRetries?:number|undefined;
},"runStatus"| ... 5more... |"compaction">&{
...;
}>>|undefined
policy:{
maxTurns?:number|undefined
maxTurns:3,
maxToolCalls?:number|undefined
maxToolCalls:6,
maxDuration?:Input|undefined
Finite, positive wall-clock duration accepted in any Effect Duration input form.
maxDuration:"45 seconds",
// This sandbox example runs one generated program at a time.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to use
Use when you want to write effectful code that looks and behaves like
synchronous code, while still handling asynchronous tasks, errors, and complex
control flow such as loops and conditions.
Generator functions work similarly to async/await but keep errors,
requirements, and interruption in the Effect type. You can yield* values
from effects and return the final result at the end.
Provide the selected tool handlers at construction, where Code Mode captures them.
Their errors and remaining dependencies stay visible. The definition still owns the
allowlist and limits; the runtime supplies the live Tool broker for each scoped pass.
Feeds the output services of the dependency layer into the requirements of
this layer, returning a layer that only provides the services from this layer.
When to use
Use when you need to hide an implementation dependency layer from callers.
Details
In serviceLayer.pipe(Layer.provide(dependencyLayer)), the dependency layer is
built first and is used to satisfy the requirements of serviceLayer.
Creates a layer for the OpenAI client with the given options.
When to use
Use when you already have explicit Options values, such as an API key or
custom API URL, and want to provide OpenAiClient as a Layer.
@see ― make for constructing the client service effectfully
@see ― layerConfig for loading client settings from Config
@stability ― unstable
@category ― layers
@since ― 4.0.0
layer({
apiKey?:Redacted.Redacted<string>|undefined
The OpenAI API key.
apiKey:
importRedacted
Redacted.
constmake:<string>(value:string,options?:{
readonlylabel?:string|undefined;
})=>Redacted.Redacted<string>
Creates a Redacted wrapper for a sensitive value.
When to use
Use to wrap a sensitive value so normal string, JSON, and inspection output
is redacted.
Details
The wrapper redacts string, JSON, and inspection output to reduce accidental
disclosure. The original value remains retrievable with Redacted.value
until the wrapper is wiped or becomes unreachable.
Feeds the output services of the dependency layer into the requirements of
this layer, returning a layer that only provides the services from this layer.
When to use
Use when you need to hide an implementation dependency layer from callers.
Details
In serviceLayer.pipe(Layer.provide(dependencyLayer)), the dependency layer is
built first and is used to satisfy the requirements of serviceLayer.
Effect.runSync(program)// => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
logs// => ["[LOG] Looking up user 123"]
@see ― provideMerge for retaining the dependency services
@category ― providing services
@since ― 2.0.0
provide(
importFetchHttpClient
FetchHttpClient.
constlayer:Layer.Layer<HttpClient,never,never>
Layer that provides an HttpClient implementation backed by the configured
Fetch function.
When to use
Use when an Effect program should execute HttpClient requests through the
platform fetch implementation, especially in browser, edge, or Node.js
runtimes with globalThis.fetch.
Details
The layer uses the current Fetch reference and optional RequestInit
service for each request. Request-specific method, headers, body, and abort
signal are supplied by the client and override matching RequestInit fields.
Gotchas
Fetch behavior comes from the runtime's implementation, so CORS, cookies,
redirects, abort handling, and streaming support can vary by platform. Stream
request bodies are sent as Web streams with duplex: "half", and any
content-length header is removed before calling fetch.
@see ― Fetch for supplying the fetch implementation used by this layer
@see ― RequestInit for default RequestInit options applied before request-specific fields
Combines all the provided layers concurrently, creating a new layer with
merged input, error, and output types.
When to use
Use when you need to combine multiple independent layers.
Details
All layers are built concurrently, and their outputs are merged into a single layer.
If multiple merged layers depend on the same layer value, that dependency is
shared by default. Reuse a named layer value when you want services to share
the same resource, such as one database pool.
Run agents and attached subagents with in-memory conversation history.
Provide once around the parent program and all child handler Layers so siblings
share history and one reservation ledger. Reuse a Thread ID to continue a conversation.
Conversations can span any number of Runs within the store's capacity limits.
Use scoped for disposable request workflows within this shared store.
Each independent Layer build owns fresh state; state is released when its Scope closes.
Process loss loses history and active execution; this Layer provides no crash recovery.
Models, tool handlers, and provider clients remain application-supplied. Default
IDs need no Layer; enclosing ID and context-preparation overrides are preserved.
For storage-backed history, provide PersistentHistory.layer and a shared
SubagentReservationsMemoryLive instead. Durable hosts own their own assembly.
Provides dependencies to an effect using layers or a context. Use options.local
to build the layer every time; by default, layers are shared between provide
calls.
Only the question is input to the agent. AnalystLive yields WorkerEnvironment to obtain the
loader and provider key, leaving that service visible in the composed program’s requirements.
An effect-cf Worker supplies it. The application owns the HTTP response and authentication.
CodeMode.make fixes the namespaces and methods visible to generated code. Include codeMode.tool
in the agent’s Toolkit. CloudflareCodeMode.layer supplies the selected Tool handlers and executor
at construction, capturing the services used by inner calls. Handler construction errors and
remaining service requirements stay visible. The runtime supplies its own Tool broker.
For a custom executor, provide it and the selected handlers directly to codeMode.handlers.
Code Mode accepts read and mutation Tools without additional approval requirements. The broker
retains parameter and result schemas, visibility, inherited grants, host action-time authorization,
and run budgets. RunToolAuthorization receives each inner call with its programmatic parent
identity before reservation and execution. Approving the outer Tool does not authorize its inner calls. Already
authorized calls require no additional approval round trip; Tools declaring needsApproval remain
unsupported and fail closed. Enforce resource and tenant access inside handlers. For read-only
workloads, use a read-only database identity where available. The warehouse example’s Durable Object uses an
application SQL allowlist because its SQLite authorizer blocks PRAGMA query_only. That scanner is
a demo boundary.
For a large allowlist, set includeDeclarations: false to keep namespace inventories and full
declarations out of the initial tool description. Add ToolDiscovery.make beside the execution
tool. Discovery returns only matching, currently eligible methods and their encoded schemas.
Effect AI Tool annotation key declaring a Tool's execution class, applied
with Tool.annotate(ToolExecutionClass, "...").
Unannotated Tools default to "uncertain": security and durability
decisions are fail-closed, so the framework never infers a safer class
from a Tool's shape.
Creates a user-defined tool with the specified name and configuration.
Details
This is the primary constructor for creating custom tools that AI models
can call. The tool definition includes parameter validation, success/failure
schemas, and optional service dependencies.
If a tool accepts no parameters but still needs an explicit empty object
schema, use
EmptyParams
.
Example (Creating a tool without parameters)
import{ Schema }from"effect"
import{ Tool }from"effect/ai"
// Simple tool with no parameters
constGetCurrentTime=Tool.make("GetCurrentTime",{
description:"Returns the current timestamp",
success:Schema.Number
})
GetCurrentTime.name// => "GetCurrentTime"
@stability ― unstable
@category ― constructors
@since ― 4.0.0
make("list_invoices",{
description?:string|undefined
An optional description explaining what the tool does.
description:"Read invoice amounts for a customer.",
parameters?:Schema.Struct<{
readonlycustomer:Schema.String;
}>|undefined
Schema defining the parameters this tool accepts.
parameters:
importSchema
Schema.
functionStruct<{
readonlycustomer:Schema.String;
}>(fields:{
readonlycustomer:Schema.String;
}):Schema.Struct<{
readonlycustomer:Schema.String;
}>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Effect AI Tool annotation key declaring a Tool's execution class, applied
with Tool.annotate(ToolExecutionClass, "...").
Unannotated Tools default to "uncertain": security and durability
decisions are fail-closed, so the framework never infers a safer class
from a Tool's shape.
Explicit allowlist: namespace name → method name → native Effect AI
Tool. Reads and mutations are allowed; calls requiring additional approval fail closed.
Build one native discover_tools Tool and its singleton Toolkit/handler Layer. Include the
Tool beside the application's existing native Tools. The engine owns catalogue authority
and applies successful native selections after a complete Tool batch; the handler mutates
no exposure state. Default search matches all case-insensitive whitespace-separated terms
against names, descriptions, methods and namespace hints, ordered by catalogue id.
Validate an agent ID and return a shallowly frozen, model-agnostic definition.
make("invoice-discovery",{
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Discover invoice methods, compute the answer, then return JSON.",Toolkit<{ readonlydiscover_tools:Tool<"discover_tools", { ...; },CurrentToolCatalog>;readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.input: Schema.String
input:
importSchema
Schema.
constString:Schema.String
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof"string".
@category ― models
@since ― 4.0.0
@category ― schemas
@since ― 4.0.0
String,
DefinitionOptions<String,Struct<{ readonlyanswer:String; }>,"Discover invoice methods, compute the answer, then return JSON.",Toolkit<{ readonlydiscover_tools:Tool<"discover_tools", { ...; },CurrentToolCatalog>;readonlyrun_javascript:CodeModeTool<...>; }>,undefined,undefined,undefined>.output: Schema.Struct<{
readonlyanswer:Schema.String;
}>
output:
importSchema
Schema.
functionStruct<{
readonlyanswer:Schema.String;
}>(fields:{
readonlyanswer:Schema.String;
}):Schema.Struct<{
readonlyanswer:Schema.String;
}>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
This is the primary constructor for creating toolkits. It accepts multiple
tools and organizes them into a toolkit that can be provided to AI language
models.
Render complete encoded-schema declarations for 1–64 unique, exact namespace.method names.
The UTF-8 byte limit defaults to 16384 and must be an integer from 1 through 262144.
Oversized documentation fails rather than truncating a declaration. This host operation
does not authorize a model to see the selected methods; filter selections by current
visibility and inherited grants before returning its output to a model.
describe(["billing.invoices"],{
maxBytes?:number|undefined
maxBytes:8_192});
Provide discovery.handlers alongside the existing Code Mode executor/handler Layer. A discovery
call with { query: "invoice", namespace: "billing" } describes billing.invoices and selects
the owning run_javascript tool for the next turn. Generated code can then call
await billing.invoices({ customer: "Acme" }). Common native tools can remain pinned alongside
these two tools.
Each match has a distinct ID such as code-mode:run_javascript:billing.invoices, its native tool
name, namespace and method. This remains unambiguous when one Tool has several aliases or is also
registered natively. Selecting a Code Mode match exposes its outer execution tool; it does not
expand the construction-time allowlist. Inner broker calls do not change native exposure.
describe is a host API over that fixed allowlist, not a visibility-filtered model tool. It accepts
one to 64 unique exact method paths and defaults to 16 KiB of complete UTF-8 declarations, with a
256 KiB maximum. Invalid paths and excessive output fail with CodeModeDescriptionError.
Declarations and discovery results use the native encoded parameter/success schemas; provider
schema transformations do not change the sandbox wire contract. The full declarations string
remains available to the host even when omitted from the model description.
Use discover_tools for model-facing documentation subject to host visibility and inherited
grants. The runtime filters the sandbox’s actual namespaces and methods as well, so generated code
cannot enumerate hidden methods. If grants or host policy hide an allowlisted method while
includeDeclarations is still true, the runtime refuses the configuration before its full
description can leak. Use generic shared descriptions and includeDeclarations: false for that
case. Default eager Code Mode behavior remains available when the full allowlist is eligible.
Approval, budget and handler authorization constraints continue to apply.
Each generated namespace method returns a Promise. The program must be one
async function expression, runs once with no arguments, and returns JSON. console.log output
returns with the result. Expected inner Tool failures reject the Promise with a JSON failure
envelope, which generated code can catch and handle. Invalid inner arguments are rejected by the
broker before their handler starts. Invalid arguments to the outer Code Mode tool, such as an empty
code string, return a native ToolParameterValidationError result so the model can correct them
without starting the executor.
The Tool broker rejects calls outside the construction-time allowlist. Use Promise.all for
independent calls and await for actual dependencies:
Set limits.maxHostCallConcurrency from 1 through 64 (default 4). Both the executor and broker
bound active calls; waiting calls stay in Effect structured concurrency. Independent results return
when ready, without waiting for earlier calls. toolConcurrency limits outer Tool Calls, so several
simultaneous Code Mode passes can each use their inner concurrency allowance. Set it to 1 when the
inner bound should also be the run’s bound.
The executor enforces source, wall-clock, log, result, host-call, and per-host-call byte limits. Code Mode applies maxEgressBytes after optional redaction to the result, logs, and
thrown value visible to the model. The agent policy’s maxToolCalls also includes brokered inner
calls. See Budgets & bounded autonomy.
The default executor limits include 30 seconds and 64 host calls. Supply a CodeExecutionLimits
value through limits when constructing Code Mode to change them; maxWallTime takes an Effect
Duration. An agent’s smaller remaining budget still applies. redactEgress can transform the
result and logs before the aggregate model-visible byte limit.
Its required services remain in the Code Mode handler Layer’s requirements and are captured when
that Layer is built. Temporary redactor resources close with each invocation. The redactor must
be total: defects and interruption retain their Effect semantics.
Writes are not transactional. A rejected Promise.all ends the program and interrupts outstanding
calls; completed writes remain completed. Await every call the result depends on, and use
Promise.allSettled when independent failures should not stop the remaining work.
A CodeModeFailure includes invocation-ordered calls with succeeded, failed, uncertain, or
not-started status. A confirmed failure does not imply rollback. A started call without a confirmed
outcome is uncertain and must be reconciled with the application before retrying. Calls that cannot
fit the output budget are counted in omittedCalls; do not assume an omitted call never ran.
Evidence takes priority over logs and thrown values when the budget is tight.
Set onPassExit to receive the full ephemeral report after executor fibers and resources close,
including timeout, defect, and interruption. The host callback’s Effect service requirements remain
visible in the handler Layer. Reports contain tool names and statuses, without copying arguments or
results. Existing programmatic Tool spans retain per-call timing and execution identity. No inner
Canonical Records or program checkpoints are created; a process loss also loses these local reports.
The outer Tool is always uncertain and Tool.Readonly is false. Under a durable host, an unresolved
program enters the ordinary unknown-outcome protocol; it is never automatically replayed, even if
its selected Tools happen to be readonly or idempotent. Recovery of a complete JavaScript program
requires separate checkpoint/resume semantics.
@yielded/agent-platform-cloudflare supplies dynamicWorkerCodeExecutorLayer. It loads each pass
into a fresh Cloudflare Dynamic Worker with globalOutbound: null. Generated code has no ambient
network, bindings, secrets, filesystem, or environment. Its only host authority is the scoped RPC
capability for allowlisted Tool calls.
Declare a Worker Loader binding in wrangler.jsonc. Cloudflare documents worker_loaders as the
binding that gives a Worker access to env.LOADER.
{
"name":"warehouse-analyst",
"main":"src/worker.ts",
"compatibility_date":"2025-05-01",
"worker_loaders":[{"binding":"LOADER"}],
}
CloudflareCodeMode.layer uses that resolved binding. The lower-level
dynamicWorkerCodeExecutorLayer({ loader }) remains available for direct CodeExecutor access.
See Cloudflare’s Dynamic Workers guide
for Worker Loader setup and loading modes. This adapter uses load() for a fresh pass.
Code Mode is ephemeral. The executor retains no pass state, and a later pass can run in another
isolate. It does not make an Agent durable, persist generated programs, reconnect a lost pass, or
replay an unresolved call. Use a Durable Object or another application store for data that must
outlive a request. A warehouse application can use a Durable Object for its invoice data.
Use the canonical Cloudflare application
for the repository’s deployment setup. A Code Mode integration additionally needs a Worker Loader
binding and a bounded Tool allowlist. The broker prevents calls to unlisted Tools, but the
application’s handlers still decide which tenant, table, account, or secret may be accessed.
Sandbox execution covers trusted local commands. Its local adapter is unisolated and
does not implement the CodeExecutor required here. Browser tools cover page capture,
crawl, and interactive passes. Tools with uncertain external effects still require application
resource authorization when exposed through Code Mode.