Python SDK reference

The Oda Python SDK drives DataMind Oda from your own Python program: it starts an Oda runtime as a subprocess and speaks newline-delimited JSON-RPC with it over standard input and output. This page is the reference companion to The Oda Python SDK: it covers what a run returns, the runtime's lifecycle, the wire surface, the errors you can meet, and the systems that have a runtime build.

What a run result carries

A run returns a result with five parts:

PartWhat it holds
session_idThe session the run worked in.
final_responseThe text of the last assistant message in the run, with its text blocks joined; an empty string when the run has no assistant message.
finish_reasonHow the last turn ended: completed, max-tokens or error, or none when the run has no turn end.
eventsThe events of your own session, in the order they arrived.
notificationsThe notifications of your session and of every helper agent below it, in the order they arrived on the wire.

Starting, reusing and closing the runtime

The wire surface

When a launch cannot start

Each failure below stops the launch, and the message names what is wrong.

When a call fails

Supported systems

Questions, answered

What is in a run result?

Five parts: the session id, the final response, the finish reason, your session's events and the notifications for your session and its helper agents. The table above lists each one.

When does the client consider a run finished?

When the session goes idle, the moment the whole session has settled. The run covers the interval from your prompt's receipt to that point.

Does one client reuse its runtime?

Yes. The runtime starts lazily on the first run that needs it and stays up for reuse until you close the client; a context manager closes it for you when the block ends. Starting again while it is up changes nothing.

On which systems can the SDK run?

Linux x64 and arm64, macOS x64 and arm64 on macOS 14 or later, and Windows x64. Windows on Arm has no wheel, and a system with no published runtime is refused rather than served by another system's build.

The launch cannot locate the runtime. What should I install?

The runtime package for your system and processor. The failure names the package to install, and the SDK package brings the matching runtime wheel with it, so a normal install covers both.

What happens when the runtime install is incomplete?

Before the process starts, the runtime package checks its own files and names the first missing part: the runtime executable, the search helper, the process-spawn helper on macOS, or the Office sidecar and its engine. Reinstall the runtime package so the full payload lands.

Why does a failed call carry the runtime's diagnostics?

So you can see why the runtime stopped answering. A transport error carries the runtime's exit code when the process has exited, and the tail of its error output, the newest 400 lines. Nothing is retried for you, so the diagnostics are the place to look.

What does a turn-end protocol error mean?

The runtime sent a turn end whose reason is not a string kind, which the protocol does not allow, so the run cannot report a finish reason. The run fails with turn/end event requires a string data.reason.kind. Run the task again; if it repeats, keep the error text for a problem report.

Do unread notifications get dropped?

No. A notification that matches no subscription stays queued in the client instead of being dropped, so a later reader can pick it up.

What happens to output lines that are not JSON?

They are ignored. A stray line on the runtime's output does not break the client, so an unexpected line cannot fail your calls.

How does the client close the runtime?

In stages: a shutdown request with a bounded wait, then the runtime's input closes, then a termination signal if the process is still up, and a forced end as a last resort. Closing before the runtime ever started does nothing, and closing again is safe.

Can I combine a configuration object with keyword options?

No. The client takes one form or the other; passing both is refused.