Skip to main content

What is supported

Any Python 3.11 or 3.12 code. A function is what Onecortex calls when the object is not a framework it recognises, so it is also how you deploy an agent on a framework not listed here, such as AutoGen or Pydantic AI: wrap its run call.

A complete agent

agent.yml
requirements.txt
agent.py
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 Python function example

echo: The quickstart’s agent: one tool call of its own, then a reply, with no dependencies.

The prompt and the reply

The function receives the prompt. What it may be: Declare a second positional parameter to receive the session ID: def agent(prompt, session_id). Declare a parameter named request to receive the whole request: {"prompt", "sessionId", "params", "surface", "messages"}.

Events it reports

See Streaming and events.

The caller’s fields

In request["params"], for a function that declares request:

Report tool calls and steps

Yield event dicts alongside your text, and they reach every caller as real events:
Each dict needs the fields of its event type. v is filled in for you, and Onecortex adds the closing done. A dict that is not a valid event ends the run with Your agent yielded an event Onecortex cannot read: and the field that is wrong.

Known limits

  • A dict with a type key is always read as an event. Yield a string, or JSON text, to send data that has a type field.

Troubleshooting

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