// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; /** * Agents defined by the company */ export class Messages extends APIResource { /** * Append a user prompt to an existing agent session. * * @example HTTP * Representative request and response shapes. * ``` * POST /agents/sessions/{session_id}/messages/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "agent_id": "agent_id", * "prompt": "prompt" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "agent_id": "string", * "prompt": "string", * "status": "string", * "langsmith_thread_id": "string", * "output": {}, * "error_message": "string", * "submission_id": "string", * "session_resume_receipt": { * "status": "string" * } * } * ``` */ create( sessionID: string, body: MessageCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/agents/sessions/${sessionID}/messages/`, { body, ...options }); } } export interface MessageCreateResponse { /** * Identifier field */ id: string; /** * The ID of the agent to run */ agent_id: string; /** * Record creation date */ created_at: string; /** * The prompt to send to the agent */ prompt: string; /** * Record update date */ updated_at: string; /** * The session error message */ error_message?: string; /** * The stable LangSmith thread identifier for this session */ langsmith_thread_id?: string; /** * The output of the session */ output?: unknown; /** * Receipt that ACP restored the requested session resume state */ session_resume_receipt?: MessageCreateResponse.SessionResumeReceipt; /** * The status of the session. Possible values: `awaiting_approval`: someone else * requested this session on your behalf, and it is waiting for your approval * before it starts; `active`: the agent is running; `idle`: the session is open * and waiting for more work; `waiting_on_user`: the agent is waiting for user * input; `suspended`: the session is paused; `completed`: the session finished * successfully; `ended`: the session was explicitly ended; `failed`: execution * failed or the approval request expired or became invalid before execution; * `cancelled`: execution was cancelled or the approval request was rejected or * cancelled. The Platform API does not support requesting delegated execution or * managing approvals. */ status?: string; /** * Receipt for correlating agent.submission.settled events after create or * append-message writes */ submission_id?: string; } export namespace MessageCreateResponse { /** * Receipt that ACP restored the requested session resume state */ export interface SessionResumeReceipt { /** * The session resume state restore status */ status?: string; } } export interface MessageCreateParams { /** * The ID of the agent. */ agent_id: string; /** * The next user prompt. */ prompt: string; } export declare namespace Messages { export { type MessageCreateResponse as MessageCreateResponse, type MessageCreateParams as MessageCreateParams, }; }