Skip to main content

What is supported

Any TypeScript or JavaScript on Node.js 22 or 20. A function is the documented path for TypeScript agents, and the way to deploy any library Onecortex does not recognise.

A complete agent

agent.yml
package.json
agent.ts
Call any model you like from inside the function, with its key added as a secret on the agent’s Config tab. See Configuration and secrets.

A complete A TypeScript function example

order-status: A plain function with a lookup tool of its own, reported as real tool events.

The prompt and the reply

The function receives the prompt, and a context as its second argument: { sessionId, request }, where request holds prompt, params, surface and messages. What it may return:

Events it reports

See Streaming and events.

The caller’s fields

In context.request.params:

Report tool calls

Yield event objects alongside your text:
Each object needs the fields of its event type. v is filled in for you, and Onecortex adds the closing done.

Known limits

  • An object with a type key is always read as an event. Yield a string to send data that has one.

Troubleshooting

More on Troubleshooting and Errors.
Last modified on September 28, 2026