The Oda SDK client

The Oda SDK client is the TypeScript package that starts an Oda runtime for you and drives its turns from your own program. Use it when a script or an internal tool of yours should call DataMind Oda on its own.

The family and its reading order start at Oda SDK overview; the raw messages the client and the runtime exchange are in The Oda SDK wire protocol, and the serving side is in Running an Oda runtime server.

Launch options

Options and defaults

Timeouts are in milliseconds.

OptionDefaultWhat it does
initializeTimeoutMs10000How long the client waits for the start-up handshake.
requestTimeoutMsnoneWith no value, a request waits indefinitely, because a turn can run long.
shutdownTimeoutMs1000How long the shutdown request may take before the close moves on.
disposeEofGraceMs6000How long the runtime may take to finish after its input closes.
disposeGraceMs3000How long it may take to exit after the client sends a stop signal.
Note

Because env replaces the environment rather than adding to it, list every variable the runtime needs when you use it.

Send a prompt

Read errors and diagnostics

Close the client

Questions, answered

What are the default timeouts?

The start-up handshake gets 10 seconds; a request waits indefinitely unless you set requestTimeoutMs; the shutdown request gets 1 second; and the closing stages get 6 seconds after the input closes and 3 seconds after the stop signal.

Can I bound how long the client waits for a turn?

Yes, set requestTimeoutMs. Leaving it out is the default, because a turn can run long. A timeout ends the wait on your side; it does not stop the runtime.

Why must the working folder be an absolute path?

The client resolves the folder before the start-up handshake. An absolute path keeps that resolution final, so the folder cannot be resolved twice.

Which runtime does the client start, and can I point it elsewhere?

By default the client finds the runtime executable itself. Point it at a specific executable when your setup keeps the runtime elsewhere. A runtime of the same version as the client is required either way.

Does run() start a new runtime each time?

No. The runtime starts on the first call and is kept for later runs. Each run works in a session of its own, so session ids differ.

How do I know the runtime accepted my prompt?

The client waits for a receipt that carries your prompt's message id before it starts collecting events. That id means the prompt was accepted; it does not point to the answer, the end of the turn or the result.

Is finalResponse the reply to my prompt?

Not exactly. It is the last committed assistant text of the session, and it is not assigned to a specific prompt. If the session has not produced an assistant message yet, it is empty.

What happens if the start-up handshake fails?

The client cleans up that attempt and prepares a fresh one, so your next call can try again. If the cleanup fails too, the client reports both failures as one combined error.

Why does an error include an exit code or a stderr tail?

So you can see why the runtime stalled or died. The tail holds the newest 400 lines of the runtime's error output, and the exit code shows how the process ended.

What happens to notifications after close() or a crash?

A reader that is open when the runtime dies can still drain what was already delivered, and then it fails. After close(), notifications that were not delivered yet are dropped.

How do I close the client without leaving a stray process?

Call close(). It asks the runtime to shut down and escalates in bounded steps until the process has exited, and calling it again is safe. Only a process that will not exit after the force step makes it fail, with a message that names the wait.