POST
/
clusters
/
{clusterId}
/
runs

A Run can be started with an initial prompt (human message).

Options

id

The ID of the Run. If not provided, one will be generated automatically. If provided, and the run already exists, the existing run will be returned.

initialPrompt

An initial prompt for the run (human message) .

name

A human readable name for the run, this will be shown in the Runs pane of the Playground. If none is provided, one will be generated automatically based on the initialPrompt.

agentId

If the configuration should be inherited from an Agent.

agentId: 'XXXXXXXX' // ID of the Agent

input

A structured input object which is merged with the initialPrompt. If the run specifies an Agent with an inputSchema, this will be validated against that schema.

input: {} // Optional: Structured Input

resultSchema

By default, a Run’s result object shape is at the discretion of the model. A specific output structure can be enforced by providing a resultSchema value in JSON Schema form.

The Run will be forced to return a result in the provided format or null if this is not possible.

"resultSchema": {
  "type": "object",
  "properties": {
    "orderId": {
      "type": "string"
    },
    "required": [
      "orderId"
    ]
  }
}

onStatusChange

As an alternative to retrieving a Run result via the API or calling the SDK’s poll() function, you can provide an Inferable function as a handler which will be called each time the status of the run changes.

Using an onStatusChange handler to receive Run results provides the same durability guarantees as any other Inferable function, this is especially helpful in the case of Runs which may take some time to complete or pause for approval.

When registering an onStatusChange handler via the SDK, the function must accept an object in the correct format. Each SDK provides a helper type for registering the onStatusChange handler

{
  "onStatusChange": {
    "function": {
      "function": "result",
      "tools": "default"
    }
  },
}

attachedFunctions

By default, a Run will have access to all functions within the cluster (including the Standard Library, you can explicitly attach a set of desired functions by setting the attachedFunctions property.

"attachedFunctions": [
  {
    "service": "default",
    "function": "myFunctionName"
  },
  {
    "service": "inferable",
    "function": "accessKnowledgeArtifacts"
  }
]

tags

Key-Value tags which can be attached to the run. Runs are queryable by these values using the API. Tags are useful for maintaining a relation between Inferable Runs and entities within your systems, for example, attaching an orderId to Runs.

"tags": {
  "orderId": "abc-123"
}

context

Context object which is passed to all calls in the Run. This can be used to vary the behavior of functions in a Run, for example based on a timezone value.

These values are not made available to the model. To do so, add them in the initialPrompt, systemPrompt or input.

The values provided are available within a function’s second argument which also contains any authContext returned from default.handleCustomAuth.

inferable.tools.register({
  name: "checkTime",
  func: async (_input, context) => {
    //{
    //  runContext: {
    //    timeZone: "Australia/Adelaide"
    //  },
    //   authContext: null
    //}
    cosnole.log(context);
  },
});

const run = await inferable.run({
  initialPrompt: "What is the current time?",
  context: {
    timeZone: "Australia/Adelaide",
  },
});

reasoningTraces

When enabled, the Run will produce a reasoning trace for each function call.

Defaults to true.

callSummarization

When enabled, the Run will attempt to auto-summarize functionr results that are too large (>10k characters) to include in the agent context.

Defaults to false.

interactive

When disabled, the run will not allow additional messages to be added.

Defaults to true.

Headers

authorization
string
required

Path Parameters

clusterId
string
required

Body

application/json
Body
id
string

The run ID. If not provided, a new run will be created. If provided, the run will be created with the given. If the run already exists, it will be returned.

runId
string

Deprecated. Use id instead.

initialPrompt
string

An initial 'human' message to trigger the run

systemPrompt
string

A system prompt for the run.

name
string

The name of the run, if not provided it will be generated

model
enum<string>

The model identifier for the run

Available options:
claude-3-5-sonnet,
claude-3-haiku
resultSchema
object

A JSON schema definition which the result object should conform to. By default the result will be a JSON object which does not conform to any schema

tools
string[]

An array of tool names to make available to the run

attachedFunctions
object[]

DEPRECATED, use tools instead

onStatusChange
object

Mechanism for receiving notifications when the run status changes

tags
object

Run tags which can be used to filter runs

input
object

Structured input arguments to merge with the initial prompt.

context
object

Additional context to propogate to all Jobs in the Run

reasoningTraces
boolean
default:
true

Enable reasoning traces

callSummarization
boolean
default:
false

Enable summarization of oversized call results

type
enum<string>
default:
multi-step
Available options:
single-step,
multi-step
interactive
boolean
default:
true

Allow the run to be continued with follow-up messages / message edits

enableResultGrounding
boolean
default:
false

Enable result grounding

Response

201
application/json
201
id
string
required

The id of the newly created run

status
enum<string>
required

The status of the run

Available options:
pending,
running,
paused,
done,
failed
result
object | null
required

The result of the run