|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +import { APIResource } from '../resource'; |
| 4 | +import { isRequestOptions } from '../core'; |
| 5 | +import * as Core from '../core'; |
| 6 | +import * as Shared from './shared'; |
| 7 | +import { AgentsCursorIDPage, type AgentsCursorIDPageParams } from '../pagination'; |
| 8 | + |
| 9 | +export class Agents extends APIResource { |
| 10 | + /** |
| 11 | + * Create a new Agent with a name and optional public visibility. The Agent will be |
| 12 | + * assigned a unique ID. |
| 13 | + */ |
| 14 | + create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise<AgentView> { |
| 15 | + return this._client.post('/v1/agents', { body, ...options }); |
| 16 | + } |
| 17 | + |
| 18 | + /** |
| 19 | + * Retrieve a specific Agent by its unique identifier. |
| 20 | + */ |
| 21 | + retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<AgentView> { |
| 22 | + return this._client.get(`/v1/agents/${id}`, options); |
| 23 | + } |
| 24 | + |
| 25 | + /** |
| 26 | + * List all Agents for the authenticated account with pagination support. |
| 27 | + */ |
| 28 | + list( |
| 29 | + query?: AgentListParams, |
| 30 | + options?: Core.RequestOptions, |
| 31 | + ): Core.PagePromise<AgentViewsAgentsCursorIDPage, AgentView>; |
| 32 | + list(options?: Core.RequestOptions): Core.PagePromise<AgentViewsAgentsCursorIDPage, AgentView>; |
| 33 | + list( |
| 34 | + query: AgentListParams | Core.RequestOptions = {}, |
| 35 | + options?: Core.RequestOptions, |
| 36 | + ): Core.PagePromise<AgentViewsAgentsCursorIDPage, AgentView> { |
| 37 | + if (isRequestOptions(query)) { |
| 38 | + return this.list({}, query); |
| 39 | + } |
| 40 | + return this._client.getAPIList('/v1/agents', AgentViewsAgentsCursorIDPage, { query, ...options }); |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +export class AgentViewsAgentsCursorIDPage extends AgentsCursorIDPage<AgentView> {} |
| 45 | + |
| 46 | +/** |
| 47 | + * Parameters for creating a new Agent. |
| 48 | + */ |
| 49 | +export interface AgentCreateParameters { |
| 50 | + /** |
| 51 | + * The name of the Agent. |
| 52 | + */ |
| 53 | + name: string; |
| 54 | + |
| 55 | + /** |
| 56 | + * The source configuration for the Agent. |
| 57 | + */ |
| 58 | + source?: Shared.AgentSource | null; |
| 59 | +} |
| 60 | + |
| 61 | +/** |
| 62 | + * A paginated list of Agents. |
| 63 | + */ |
| 64 | +export interface AgentListView { |
| 65 | + /** |
| 66 | + * The list of Agents. |
| 67 | + */ |
| 68 | + agents: Array<AgentView>; |
| 69 | + |
| 70 | + /** |
| 71 | + * Whether there are more Agents to fetch. |
| 72 | + */ |
| 73 | + has_more: boolean; |
| 74 | + |
| 75 | + /** |
| 76 | + * The count of remaining Agents. |
| 77 | + */ |
| 78 | + remaining_count: number; |
| 79 | + |
| 80 | + /** |
| 81 | + * The total count of Agents. |
| 82 | + */ |
| 83 | + total_count: number; |
| 84 | +} |
| 85 | + |
| 86 | +/** |
| 87 | + * An Agent represents a registered AI agent entity. |
| 88 | + */ |
| 89 | +export interface AgentView { |
| 90 | + /** |
| 91 | + * The unique identifier of the Agent. |
| 92 | + */ |
| 93 | + id: string; |
| 94 | + |
| 95 | + /** |
| 96 | + * The creation time of the Agent (Unix timestamp milliseconds). |
| 97 | + */ |
| 98 | + create_time_ms: number; |
| 99 | + |
| 100 | + /** |
| 101 | + * Whether the Agent is publicly accessible. |
| 102 | + */ |
| 103 | + is_public: boolean; |
| 104 | + |
| 105 | + /** |
| 106 | + * The name of the Agent. |
| 107 | + */ |
| 108 | + name: string; |
| 109 | + |
| 110 | + /** |
| 111 | + * The source configuration for the Agent. |
| 112 | + */ |
| 113 | + source?: Shared.AgentSource | null; |
| 114 | +} |
| 115 | + |
| 116 | +export interface AgentCreateParams { |
| 117 | + /** |
| 118 | + * The name of the Agent. |
| 119 | + */ |
| 120 | + name: string; |
| 121 | + |
| 122 | + /** |
| 123 | + * The source configuration for the Agent. |
| 124 | + */ |
| 125 | + source?: Shared.AgentSource | null; |
| 126 | +} |
| 127 | + |
| 128 | +export interface AgentListParams extends AgentsCursorIDPageParams { |
| 129 | + /** |
| 130 | + * Filter agents by public visibility. |
| 131 | + */ |
| 132 | + is_public?: boolean; |
| 133 | + |
| 134 | + /** |
| 135 | + * Filter agents by name (partial match supported). |
| 136 | + */ |
| 137 | + name?: string; |
| 138 | + |
| 139 | + /** |
| 140 | + * Search by agent ID or name. |
| 141 | + */ |
| 142 | + search?: string; |
| 143 | +} |
| 144 | + |
| 145 | +Agents.AgentViewsAgentsCursorIDPage = AgentViewsAgentsCursorIDPage; |
| 146 | + |
| 147 | +export declare namespace Agents { |
| 148 | + export { |
| 149 | + type AgentCreateParameters as AgentCreateParameters, |
| 150 | + type AgentListView as AgentListView, |
| 151 | + type AgentView as AgentView, |
| 152 | + AgentViewsAgentsCursorIDPage as AgentViewsAgentsCursorIDPage, |
| 153 | + type AgentCreateParams as AgentCreateParams, |
| 154 | + type AgentListParams as AgentListParams, |
| 155 | + }; |
| 156 | +} |
0 commit comments