Skip to main content

What is supported

The AI SDK (ai) 6 and later. Onecortex recognises an agent object, such as a ToolLoopAgent, and streams it. A bare streamText call is not an agent: wrap it in a function, as on A TypeScript function.

A complete agent

agent.yml
package.json
agent.ts
Add OPENAI_API_KEY as a secret on the agent’s Config tab, then deploy. Any model works: this one is an example. See Configuration and secrets.

A complete Vercel AI SDK example

meeting-scheduler: A ToolLoopAgent that checks a calendar, then holds a slot: two tool calls in one run. It runs with no model key.

The prompt and the reply

The prompt is the agent’s input. The reply is its streamed text.

Events it reports

See Streaming and events.

The caller’s fields

The AI SDK has no per call slot for extra data, so the caller’s fields do not reach an agent object. To use them, export a function that reads them and builds the call:

Known limits

  • The caller’s fields do not reach an agent object; use a function wrapper.

Troubleshooting

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