Code tools
Use a code tool when you need JavaScript or TypeScript logic that an existing Operator does not provide. It has a typed input/output contract, can be called by an authorized agent, and can be added to a workflow. Execution takes place in an isolated Code Runner rather than inside the workflow Worker.
Availability depends on your deployment. If Create code tool is absent, ask your administrator whether Code Runner is enabled. You need Operator management permission to author and publish, and resource/method access to call a published tool. Credentials belong to the current account and Space.
Create and publish
- In Console → Tools, choose Create code tool.
- Enter a name and a unique identifier. Choose JavaScript or TypeScript.
- Write an exported
runfunction and define object-root input/output JSON Schemas. - Save, then Build. Building saves pending edits and compiles the current source.
- Enter Test inputs, then Run test. Inspect the actual result and logs. Tests can perform real external actions.
- After a successful test, choose Publish.
export async function run(inputs, ctx) {
const paid = inputs.orders.filter(order => order.status === 'paid');
return { paidCount: paid.length, revenue: paid.reduce((sum, order) => sum + order.amount, 0) };
}
For this example, inputs should declare an orders array of objects; outputs should declare numeric paidCount and revenue. Schema validation applies to actual inputs and returned results. A submitted request or a generated explanation is not a successful execution.
Editing source, language, Schemas, HTTP destinations or credential references invalidates the previous build and test. Build and test the new definition before publishing. Concurrent edits return a conflict; reload only after preserving any work you want to keep. Closing an editor with unsaved changes asks for confirmation.
Open a code tool to see its overview. Under Methods, edit the source and input/output schemas and build the draft. Use Configuration for network access, credentials and versions. In Debug, enter test inputs, run the draft and inspect the result. Switching tabs preserves your inputs.
Network and credentials
Containers have no direct network access. Open Network & credentials to add destinations already approved by the administrator. This page cannot grant a new public or private origin on its own. Ask your administrator to approve a missing integration.
Use Manage credentials → Add credential to store a name, destination origin, header, optional prefix and secret value. For bearer authentication, the header is Authorization and the prefix is Bearer , including its trailing space. Values are encrypted server-side and are not displayed after saving. The editor only adds a credential reference matching an allowed destination.
export async function run(inputs, ctx) {
const response = await ctx.http.request({
url: 'https://approved.example/orders',
method: 'GET',
credentialRef: 'YOUR_CREDENTIAL_REFERENCE',
});
if (!response.ok) throw Error(`Order source returned ${response.status}`);
return { orders: response.data.orders };
}
Select the reference in Network & credentials as well as using it in code. Never paste the secret into source, prompts, test inputs or Schemas. Revocation blocks further authorized use; it does not undo requests already committed by the remote system.
HTTP responses contain {status, ok, data}. Redirects are denied. Requests, bodies and execution time are bounded; there are at most 20 serial HTTP calls per run. A failed write may already have committed. Inspect the destination before retrying an ambiguous result.
Versions and workflows
Published versions are immutable. In Versions you can inspect their identifiers and dates, load a prior definition into the editor for a new build/test/publication, or explicitly choose a published version as the default for new direct calls. Selecting a default does not edit existing workflows or tasks.
When adding a code tool to a workflow, the node pins a published version. Code version in the node configuration lets you explicitly choose another version. Review changed ports and connections before saving and testing. Opening a saved workflow preserves its pinned revision and uses that revision's Schemas; it does not silently follow the latest publication.
Workflow is still a template. To schedule work, create or reuse a Task, validate it, perform a real trial and then enable its schedule. Publishing a code tool alone does not deploy a recurring task. Disabling a tool can affect workflows that use it.
Failed, interrupted or canceled runs
A run has a persistent ID. Use the editor's run result or the MCP genispace_operator_code_run_get tool to inspect its status. The current admission deadline is 100 seconds from submission, including queueing and startup; the default sandbox execution limit is 60 seconds. These are execution limits, not model output-token or billing limits.
If the API or Runner disconnects, an external action may already have completed. An error containing RESULT_UNKNOWN means check the saved run and the destination before retrying. Recovery marks expired active runs as failed; it does not replay them. Canceling a run does not undo previously committed writes.
If an administrator disables Code Runner, code tools disappear from discovery and new calls are refused. Your existing run records remain available to their authorized caller. Published versions are retained. Workflows using code tools will need the service restored; older non-code Operators retain their existing behavior.
Daily business briefing
Ask Geni Desktop: “Send me a business briefing every morning at 9.” The agent should first look for a suitable Task, then a reusable workflow. If a capability is missing, it can create a code tool or HTTP connector through authorized MCP tools, build/test/publish the code, connect the workflow and deploy the Task.
The Space needs a real data source or approved API, credentials, a delivery channel and a timezone. Verify business metrics, Task execution status and the actual delivery receipt before enabling. Missing access or integrations should be reported as a concrete gap, not invented success.
Current boundaries
The first release supports JavaScript/TypeScript, JSON input/output and controlled HTTP. Node built-ins are available; arbitrary npm/pip installation, Python, generic nested platform-tool calls and code-initiated model calls are not exposed. Runtime limits are set by the administrator.
Existing HTTP Operators and the older JavaScript Executor keep their own configuration. Code tools do not automatically convert existing nodes. Deployment administrators must complete their isolation and operational checks before enabling this feature for tenants.
Testing an order summary
For an order summary, define an orders array with an amount and payment status for each order. Test a paid order of 220 and an unpaid order of 80. Verify that the result contains two orders, 220 paid and 80 outstanding. Test an empty array and a missing amount before publishing. Changing the contract requires a new build and successful test.
Under Usage permissions, use space permissions or allow specific members or roles to run selected actions. A block rule takes priority. Removing a rule restores the result of the remaining rules and space permissions.