SDK reference · Resources
client.harnesses
client.harnesses.{ list, get, create, update, saveVersion, version, activate, setDefault, archive }A harness holds a job's instructions, model, tools, approvals, step limit and skills. An application can have several, such as inbox and research, and one is its default.
Settings are saved as versions that never change. A job pins the active version of the harness it names with harness, or of the default; settings the job request sets still win.
list
list(): Promise<Page>Harnesses in use, the default first, with each active version's number.
Returns Promise<Page>
get
get(id: string): Promise<Resource>A harness with its active settings and latest 100 versions.
Parameters
idstring- The harness's ID, or the name of one in use.
Returns Promise<Resource>
create
create(input: HarnessInput): Promise<Resource>Saves the settings as version 1 and activates it. The application's first harness becomes its default.
Parameters
input.namestring- Lowercase letters, digits and hyphens.
input.specHarnessSpecoptional- Settings; anything left out takes today's job defaults.
Returns Promise<Resource>
await client.harnesses.create({
name: "inbox",
spec: {
instructions: "Sign every email as Sam.",
execution_mode: "tools",
tools: { connectors: ["gmail", "calendar"] },
},
});
await client.jobs.create({ user_id, task: "Reply to Dana", harness: "inbox" });update
update(id: string, input: { name?: string; description?: string; version: number }): Promise<Resource>Renames a harness or changes its description. version must be the one you read, or the call fails with harness_changed.
Parameters
idstring- The harness's ID.
Returns Promise<Resource>
saveVersion
saveVersion(id: string, input: HarnessVersionInput): Promise<{ version: Resource; harness: Resource }>Saves settings as the next version. With activate, new jobs run with it; with expected_active_version_id, fails with harness_moved if another version was activated since.
Parameters
idstring- The harness's ID.
input.specHarnessSpec- The whole settings.
input.activatebooleanoptional- Make it the active version.
Returns Promise<{ version: Resource; harness: Resource }>
version
version(versionId: string): Promise<Resource>One version's settings.
Parameters
versionIdstring- The version's ID.
Returns Promise<Resource>
activate
activate(id: string, versionId: string, expectedActiveVersionId?: string | null): Promise<Resource>Makes a version the one new jobs run with; also how a harness is rolled back.
Parameters
idstring- The harness's ID.
versionIdstring- A version of this harness.
Returns Promise<Resource>
setDefault
setDefault(id: string): Promise<Resource>Makes the harness the one jobs run with when they name none.
Parameters
idstring- The harness's ID.
Returns Promise<Resource>
archive
archive(id: string): Promise<Resource>Archives a harness that is not the default; jobs can no longer name it.
Parameters
idstring- The harness's ID.
Returns Promise<Resource>