openai
Version:
The official TypeScript library for the OpenAI API
149 lines • 5.74 kB
text/typescript
import { APIResource } from "../../../../core/resource.mjs";
import * as AutomationsAPI from "./automations.mjs";
import { APIPromise } from "../../../../core/api-promise.mjs";
import { CursorPage, type CursorPageParams, PagePromise } from "../../../../core/pagination.mjs";
import { RequestOptions } from "../../../../internal/request-options.mjs";
export declare class Invocations extends APIResource {
/**
* Queues a manual delivery without changing the saved schedule.
*
* @example
* ```ts
* const automationInvocation =
* await client.beta.agents.automations.invocations.create(
* 'automation_id',
* );
* ```
*/
create(automationID: string, options?: RequestOptions): APIPromise<AutomationInvocation>;
/**
* Retrieves a delivery record for a project-owned automation.
*
* @example
* ```ts
* const automationInvocation =
* await client.beta.agents.automations.invocations.retrieve(
* 'invocation_id',
* { automation_id: 'automation_id' },
* );
* ```
*/
retrieve(invocationID: string, params: InvocationRetrieveParams, options?: RequestOptions): APIPromise<AutomationInvocation>;
/**
* Lists delivery records for a project-owned automation.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const automationInvocation of client.beta.agents.automations.invocations.list(
* 'automation_id',
* )) {
* // ...
* }
* ```
*/
list(automationID: string, query?: (InvocationListParams & ({
[K in 'method' | 'path' | 'query' | 'body' | 'headers' | 'maxRetries' | 'stream' | 'timeout' | 'httpAgent' | 'fetchOptions' | 'signal' | 'idempotencyKey' | 'defaultBaseURL' | '__metadata' | '__binaryRequest' | '__binaryResponse' | '__streamClass' | '__streamMode' | '__security' | '__synthesizeEventData']?: never;
} | null | undefined)) | null | undefined, options?: RequestOptions): PagePromise<AutomationInvocationsPage, AutomationInvocation>;
list(automationID: string, options?: {
[K in 'headers' | 'maxRetries' | 'timeout' | 'signal' | 'idempotencyKey' | 'query']?: RequestOptions[K];
} & {
[K in 'method' | 'path' | 'body' | 'stream' | 'httpAgent' | 'fetchOptions' | 'defaultBaseURL' | '__metadata' | '__binaryRequest' | '__binaryResponse' | '__streamClass' | '__streamMode' | '__security' | '__synthesizeEventData']?: never;
}): PagePromise<AutomationInvocationsPage, AutomationInvocation>;
}
export type AutomationInvocationsPage = CursorPage<AutomationInvocation>;
/**
* One attempted delivery by an automation.
*/
export interface AutomationInvocation {
/**
* The invocation ID.
*/
id: string;
/**
* The automation that owns the invocation.
*/
automation_id: string;
/**
* The creation time as a Unix timestamp in seconds.
*/
created_at: number;
/**
* The permanent delivery failure, or null when no failure occurred.
*/
error: AutomationInvocation.Error | null;
/**
* Always `agent.automation.invocation`.
*/
object: 'agent.automation.invocation';
/**
* The intended occurrence as a Unix timestamp in seconds, or null for manual runs.
*/
scheduled_at: number | null;
/**
* The target or newly created session ID, or null before one is available.
*/
session_id: string | null;
/**
* Why an occurrence was skipped, or null when it was not skipped.
*/
skip_reason: 'pending_delivery' | null;
/**
* Whether the invocation was manual or scheduled.
*/
source: AutomationInvocationSource;
/**
* Delivery status; completed does not mean the agent's work has finished.
*/
status: 'queued' | 'completed' | 'failed' | 'skipped';
}
export declare namespace AutomationInvocation {
/**
* The permanent delivery failure, or null when no failure occurred.
*/
interface Error {
/**
* A machine-readable error code.
*/
code: string;
/**
* A public explanation of the delivery failure.
*/
message: string;
}
}
export type AutomationInvocationSource = AutomationInvocationSource.AutomationInvocationSourceResourceManual | AutomationInvocationSource.AutomationInvocationSourceResourceAutomation;
export declare namespace AutomationInvocationSource {
interface AutomationInvocationSourceResourceManual {
/**
* The type of the object. Always `manual`.
*/
type: 'manual';
}
interface AutomationInvocationSourceResourceAutomation {
/**
* The automation snapshot for this occurrence, excluding confidential values.
*/
automation: AutomationsAPI.Automation;
/**
* The type of the object. Always `automation`.
*/
type: 'automation';
}
}
export interface InvocationRetrieveParams {
automation_id: string;
}
export interface InvocationListParams extends CursorPageParams {
/**
* The order in which resources are returned. Defaults to `desc`.
*
* - `asc` - Returns resources in ascending order.
* - `desc` - Returns resources in descending order.
*/
order?: 'asc' | 'desc';
}
export declare namespace Invocations {
export { type AutomationInvocation as AutomationInvocation, type AutomationInvocationSource as AutomationInvocationSource, type AutomationInvocationsPage as AutomationInvocationsPage, type InvocationRetrieveParams as InvocationRetrieveParams, type InvocationListParams as InvocationListParams, };
}
//# sourceMappingURL=invocations.d.mts.map