@agent-api/sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +115 -0
  4. package/dist/client.d.ts +25 -0
  5. package/dist/client.js +52 -0
  6. package/dist/errors.d.ts +61 -0
  7. package/dist/errors.js +130 -0
  8. package/dist/index.d.ts +7 -0
  9. package/dist/index.js +5 -0
  10. package/dist/internal/env.d.ts +1 -0
  11. package/dist/internal/env.js +4 -0
  12. package/dist/internal/http.d.ts +18 -0
  13. package/dist/internal/http.js +93 -0
  14. package/dist/internal/output-text.d.ts +2 -0
  15. package/dist/internal/output-text.js +12 -0
  16. package/dist/internal/query.d.ts +1 -0
  17. package/dist/internal/query.js +10 -0
  18. package/dist/local-functions.d.ts +9 -0
  19. package/dist/local-functions.js +32 -0
  20. package/dist/pagination.d.ts +21 -0
  21. package/dist/pagination.js +38 -0
  22. package/dist/resources/models.d.ts +8 -0
  23. package/dist/resources/models.js +9 -0
  24. package/dist/resources/presets.d.ts +8 -0
  25. package/dist/resources/presets.js +9 -0
  26. package/dist/resources/responses.d.ts +19 -0
  27. package/dist/resources/responses.js +49 -0
  28. package/dist/resources/tools.d.ts +8 -0
  29. package/dist/resources/tools.js +9 -0
  30. package/dist/streaming.d.ts +1 -0
  31. package/dist/streaming.js +39 -0
  32. package/dist/types/catalog.d.ts +40 -0
  33. package/dist/types/catalog.js +1 -0
  34. package/dist/types/common.d.ts +52 -0
  35. package/dist/types/common.js +1 -0
  36. package/dist/types/index.d.ts +6 -0
  37. package/dist/types/index.js +6 -0
  38. package/dist/types/input.d.ts +52 -0
  39. package/dist/types/input.js +1 -0
  40. package/dist/types/responses.d.ts +151 -0
  41. package/dist/types/responses.js +1 -0
  42. package/dist/types/streaming.d.ts +41 -0
  43. package/dist/types/streaming.js +1 -0
  44. package/dist/types/tools.d.ts +44 -0
  45. package/dist/types/tools.js +1 -0
  46. package/dist/version.d.ts +2 -0
  47. package/dist/version.js +2 -0
  48. package/package.json +56 -0
@@ -0,0 +1,38 @@
1
+ export class Page {
2
+ fetchPage;
3
+ params;
4
+ data;
5
+ hasMore;
6
+ nextPageToken;
7
+ constructor(fetchPage, params, data, hasMore, nextPageToken) {
8
+ this.fetchPage = fetchPage;
9
+ this.params = params;
10
+ this.data = data;
11
+ this.hasMore = hasMore;
12
+ this.nextPageToken = nextPageToken;
13
+ }
14
+ [Symbol.asyncIterator]() {
15
+ return this.iterateAll()[Symbol.asyncIterator]();
16
+ }
17
+ async getNextPage() {
18
+ if (!this.hasMore || !this.nextPageToken) {
19
+ return null;
20
+ }
21
+ const nextParams = { ...this.params, page_token: this.nextPageToken };
22
+ const result = await this.fetchPage(nextParams);
23
+ return new Page(this.fetchPage, nextParams, result.data, result.has_more, result.next_page_token);
24
+ }
25
+ async *iterateAll() {
26
+ let page = this;
27
+ while (page) {
28
+ for (const item of page.data) {
29
+ yield item;
30
+ }
31
+ page = await page.getNextPage();
32
+ }
33
+ }
34
+ }
35
+ export async function collectPage(fetchPage, params) {
36
+ const result = await fetchPage(params);
37
+ return new Page(fetchPage, params, result.data, result.has_more, result.next_page_token);
38
+ }
@@ -0,0 +1,8 @@
1
+ import type { HTTPClient } from "../internal/http.js";
2
+ import type { RequestOptions } from "../types/common.js";
3
+ import type { ListModelsResponse } from "../types/catalog.js";
4
+ export declare class ModelsResource {
5
+ private readonly http;
6
+ constructor(http: HTTPClient);
7
+ list(options?: RequestOptions): Promise<ListModelsResponse>;
8
+ }
@@ -0,0 +1,9 @@
1
+ export class ModelsResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ list(options) {
7
+ return this.http.request("GET", "/v1/models", undefined, options);
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ import type { HTTPClient } from "../internal/http.js";
2
+ import type { RequestOptions } from "../types/common.js";
3
+ import type { ListPresetsResponse } from "../types/catalog.js";
4
+ export declare class PresetsResource {
5
+ private readonly http;
6
+ constructor(http: HTTPClient);
7
+ list(options?: RequestOptions): Promise<ListPresetsResponse>;
8
+ }
@@ -0,0 +1,9 @@
1
+ export class PresetsResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ list(options) {
7
+ return this.http.request("GET", "/v1/presets", undefined, options);
8
+ }
9
+ }
@@ -0,0 +1,19 @@
1
+ import type { HTTPClient } from "../internal/http.js";
2
+ import { Page } from "../pagination.js";
3
+ import type { RequestOptions } from "../types/common.js";
4
+ import type { AgentResponse, CancelResponse, ListChildrenResponse, ListEventsParams, ListEventsResponse, ListResponsesParams, ListResponsesResponse, ResponseCreateParamsNonStreaming, ResponseCreateParamsStreaming, ResponseListItem } from "../types/responses.js";
5
+ import type { ResponseStreamEvent } from "../types/streaming.js";
6
+ export declare class ResponsesResource {
7
+ private readonly http;
8
+ private readonly path;
9
+ constructor(http: HTTPClient, path?: string);
10
+ create(params: ResponseCreateParamsNonStreaming, options?: RequestOptions): Promise<AgentResponse>;
11
+ create(params: ResponseCreateParamsStreaming, options?: RequestOptions): Promise<AsyncIterable<ResponseStreamEvent>>;
12
+ list(params?: ListResponsesParams, options?: RequestOptions): Promise<ListResponsesResponse>;
13
+ listPage(params?: ListResponsesParams, options?: RequestOptions): Promise<Page<ResponseListItem, ListResponsesParams>>;
14
+ listIterator(params?: ListResponsesParams, options?: RequestOptions): AsyncIterable<ResponseListItem>;
15
+ retrieve(responseID: string, options?: RequestOptions): Promise<AgentResponse>;
16
+ cancel(responseID: string, options?: RequestOptions): Promise<CancelResponse>;
17
+ listChildren(responseID: string, options?: RequestOptions): Promise<ListChildrenResponse>;
18
+ listEvents(responseID: string, params?: ListEventsParams, options?: RequestOptions): Promise<ListEventsResponse>;
19
+ }
@@ -0,0 +1,49 @@
1
+ import { addOutputText } from "../internal/output-text.js";
2
+ import { buildQuery } from "../internal/query.js";
3
+ import { collectPage } from "../pagination.js";
4
+ export class ResponsesResource {
5
+ http;
6
+ path;
7
+ constructor(http, path = "/v1/responses") {
8
+ this.http = http;
9
+ this.path = path;
10
+ }
11
+ create(params, options) {
12
+ if (params.stream) {
13
+ return this.http.stream(this.path, params, options);
14
+ }
15
+ return this.http.request("POST", this.path, params, options).then(addOutputText);
16
+ }
17
+ list(params = {}, options) {
18
+ return this.http.request("GET", `${this.path}${buildQuery({ limit: params.limit, page_token: params.page_token })}`, undefined, options);
19
+ }
20
+ async listPage(params = {}, options) {
21
+ return collectPage((pageParams) => this.list(pageParams, options), params);
22
+ }
23
+ listIterator(params = {}, options) {
24
+ const self = this;
25
+ return {
26
+ async *[Symbol.asyncIterator]() {
27
+ const page = await self.listPage(params, options);
28
+ yield* page.iterateAll();
29
+ },
30
+ };
31
+ }
32
+ retrieve(responseID, options) {
33
+ return this.http
34
+ .request("GET", `${this.path}/${encodeURIComponent(responseID)}`, undefined, options)
35
+ .then(addOutputText);
36
+ }
37
+ cancel(responseID, options) {
38
+ return this.http.request("POST", `${this.path}/${encodeURIComponent(responseID)}/cancel`, undefined, options);
39
+ }
40
+ listChildren(responseID, options) {
41
+ return this.http.request("GET", `${this.path}/${encodeURIComponent(responseID)}/children`, undefined, options);
42
+ }
43
+ listEvents(responseID, params = {}, options) {
44
+ return this.http.request("GET", `${this.path}/${encodeURIComponent(responseID)}/events${buildQuery({
45
+ after_sequence: params.after_sequence,
46
+ view: params.view,
47
+ })}`, undefined, options);
48
+ }
49
+ }
@@ -0,0 +1,8 @@
1
+ import type { HTTPClient } from "../internal/http.js";
2
+ import type { RequestOptions } from "../types/common.js";
3
+ import type { ListToolsResponse } from "../types/tools.js";
4
+ export declare class ToolsResource {
5
+ private readonly http;
6
+ constructor(http: HTTPClient);
7
+ list(options?: RequestOptions): Promise<ListToolsResponse>;
8
+ }
@@ -0,0 +1,9 @@
1
+ export class ToolsResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ list(options) {
7
+ return this.http.request("GET", "/v1/tools", undefined, options);
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ export declare function parseSSE<T>(response: Response): AsyncIterable<T>;
@@ -0,0 +1,39 @@
1
+ import { APIConnectionError } from "./errors.js";
2
+ export async function* parseSSE(response) {
3
+ if (!response.body) {
4
+ throw new APIConnectionError("Streaming response did not include a body");
5
+ }
6
+ const reader = response.body.getReader();
7
+ const decoder = new TextDecoder();
8
+ let buffer = "";
9
+ for (;;) {
10
+ const { value, done } = await reader.read();
11
+ if (done) {
12
+ break;
13
+ }
14
+ buffer += decoder.decode(value, { stream: true });
15
+ const parts = buffer.split(/\r?\n\r?\n/);
16
+ buffer = parts.pop() ?? "";
17
+ for (const part of parts) {
18
+ const event = parseSSEBlock(part);
19
+ if (event !== undefined) {
20
+ yield event;
21
+ }
22
+ }
23
+ }
24
+ const finalEvent = parseSSEBlock(buffer);
25
+ if (finalEvent !== undefined) {
26
+ yield finalEvent;
27
+ }
28
+ }
29
+ function parseSSEBlock(block) {
30
+ const data = block
31
+ .split(/\r?\n/)
32
+ .filter((line) => line.startsWith("data:"))
33
+ .map((line) => line.slice(5).trimStart())
34
+ .join("\n");
35
+ if (!data || data === "[DONE]") {
36
+ return undefined;
37
+ }
38
+ return JSON.parse(data);
39
+ }
@@ -0,0 +1,40 @@
1
+ import type { AgentCapabilityPreference } from "./common.js";
2
+ export interface ModelCapabilities {
3
+ provider?: string;
4
+ supports_streaming?: boolean;
5
+ supports_tools?: boolean;
6
+ supports_json_schema?: boolean;
7
+ supports_reasoning?: boolean;
8
+ context_window?: number;
9
+ pricing?: Record<string, unknown>;
10
+ metadata?: Record<string, unknown>;
11
+ }
12
+ export interface Model {
13
+ id: string;
14
+ object: "model";
15
+ owned_by: string;
16
+ capabilities?: ModelCapabilities;
17
+ }
18
+ export interface ListModelsResponse {
19
+ object: "list";
20
+ data: Model[];
21
+ }
22
+ export interface PresetPolicy {
23
+ plan_mode_preference?: AgentCapabilityPreference;
24
+ sub_agent_preference?: AgentCapabilityPreference;
25
+ allowed_tools?: string[];
26
+ max_steps?: number;
27
+ }
28
+ export interface Preset {
29
+ preset: string;
30
+ prompt_version?: string;
31
+ preset_metadata?: Record<string, unknown>;
32
+ policy?: PresetPolicy;
33
+ max_output_tokens?: number;
34
+ default_model?: string;
35
+ model_chain?: string[];
36
+ }
37
+ export interface ListPresetsResponse {
38
+ object: "list";
39
+ data: Preset[];
40
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ export type JSONPrimitive = string | number | boolean | null;
2
+ export type JSONValue = JSONPrimitive | JSONValue[] | {
3
+ [key: string]: JSONValue;
4
+ };
5
+ export type AgentCapabilityPreference = "off" | "auto" | "preferred" | "required";
6
+ export interface ClientOptions {
7
+ apiKey?: string;
8
+ baseURL?: string;
9
+ /** Default request timeout in milliseconds (non-streaming). */
10
+ timeout?: number;
11
+ /** Timeout for streaming agent runs in milliseconds. */
12
+ streamTimeout?: number;
13
+ /** Maximum number of automatic retries for retryable failures. Default 2. */
14
+ maxRetries?: number;
15
+ fetch?: typeof fetch;
16
+ defaultHeaders?: Record<string, string>;
17
+ }
18
+ export interface RequestOptions {
19
+ headers?: Record<string, string>;
20
+ timeout?: number;
21
+ /** Override automatic retries for this request. */
22
+ maxRetries?: number;
23
+ }
24
+ export interface RetryConfig {
25
+ maxRetries: number;
26
+ }
27
+ export interface ErrorInfo {
28
+ message: string;
29
+ type?: string;
30
+ code?: string;
31
+ }
32
+ export interface Usage {
33
+ input_tokens?: number;
34
+ output_tokens?: number;
35
+ total_tokens?: number;
36
+ input_tokens_details?: Record<string, number>;
37
+ output_tokens_details?: Record<string, number>;
38
+ tool_calls_details?: Record<string, {
39
+ invocation?: number;
40
+ }>;
41
+ cost?: {
42
+ currency?: string;
43
+ input_cost?: number;
44
+ output_cost?: number;
45
+ tool_calls_cost?: number;
46
+ cache_read_cost?: number;
47
+ cache_creation_cost?: number;
48
+ total_cost?: number;
49
+ };
50
+ }
51
+ export type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "requires_action";
52
+ export type OutputItemStatus = "completed" | "failed" | "in_progress";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from "./common.js";
2
+ export * from "./input.js";
3
+ export * from "./tools.js";
4
+ export * from "./responses.js";
5
+ export * from "./streaming.js";
6
+ export * from "./catalog.js";
@@ -0,0 +1,6 @@
1
+ export * from "./common.js";
2
+ export * from "./input.js";
3
+ export * from "./tools.js";
4
+ export * from "./responses.js";
5
+ export * from "./streaming.js";
6
+ export * from "./catalog.js";
@@ -0,0 +1,52 @@
1
+ export interface Annotation {
2
+ type?: string;
3
+ title?: string;
4
+ url?: string;
5
+ start_index?: number;
6
+ end_index?: number;
7
+ }
8
+ export interface ContentPart {
9
+ type: "input_text" | "output_text" | "input_image";
10
+ text?: string;
11
+ image_url?: string;
12
+ annotations?: Annotation[];
13
+ logprobs?: unknown[];
14
+ }
15
+ export interface InputMessage {
16
+ type: "message";
17
+ role: "system" | "developer" | "user" | "assistant";
18
+ content: string | ContentPart[];
19
+ }
20
+ export interface FunctionCallInput {
21
+ type: "function_call";
22
+ call_id: string;
23
+ name: string;
24
+ arguments: string;
25
+ thought_signature?: string;
26
+ }
27
+ export interface FunctionCallOutputInput {
28
+ type: "function_call_output";
29
+ call_id: string;
30
+ output: string;
31
+ name?: string;
32
+ thought_signature?: string;
33
+ }
34
+ export type InputItem = InputMessage | FunctionCallInput | FunctionCallOutputInput;
35
+ export type Input = string | InputItem[];
36
+ export interface ReasoningConfig {
37
+ effort?: "low" | "medium" | "high";
38
+ }
39
+ export interface ResponseFormat {
40
+ type: "json_schema";
41
+ json_schema?: {
42
+ name: string;
43
+ description?: string;
44
+ schema: Record<string, unknown>;
45
+ strict?: boolean;
46
+ };
47
+ }
48
+ export interface MemoryOptions {
49
+ enabled?: boolean;
50
+ read?: boolean;
51
+ write?: boolean;
52
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,151 @@
1
+ import type { AgentCapabilityPreference, ErrorInfo, OutputItemStatus, ResponseStatus, Usage } from "./common.js";
2
+ import type { ContentPart, Input, MemoryOptions, ReasoningConfig, ResponseFormat } from "./input.js";
3
+ import type { Tool } from "./tools.js";
4
+ export interface ResponseCreateParamsBase {
5
+ input: Input;
6
+ instructions?: string;
7
+ language_preference?: string;
8
+ model?: string;
9
+ models?: string[];
10
+ preset?: "fast-search" | "pro-search" | "deep-research" | "advanced-deep-research" | string;
11
+ max_output_tokens?: number;
12
+ max_steps?: number;
13
+ reasoning?: ReasoningConfig;
14
+ response_format?: ResponseFormat;
15
+ tools?: Tool[];
16
+ tool_choice?: "auto" | "none" | "required" | Record<string, unknown>;
17
+ parallel_tool_calls?: boolean;
18
+ metadata?: Record<string, unknown>;
19
+ store?: boolean;
20
+ previous_response_id?: string;
21
+ prompt_cache_key?: string;
22
+ memory?: MemoryOptions;
23
+ plan_mode_preference?: AgentCapabilityPreference;
24
+ sub_agent_preference?: AgentCapabilityPreference;
25
+ stream?: boolean;
26
+ }
27
+ export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase {
28
+ stream?: false;
29
+ }
30
+ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase {
31
+ stream: true;
32
+ }
33
+ export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming;
34
+ export interface ToolInvocationResult {
35
+ id?: string;
36
+ tool_call_id?: string;
37
+ tool_name?: string;
38
+ status?: string;
39
+ error?: ErrorInfo | null;
40
+ metadata?: Record<string, unknown>;
41
+ response_summary?: string;
42
+ response_summary_mime_type?: string;
43
+ }
44
+ export interface MessageOutputItem {
45
+ type: "message";
46
+ id: string;
47
+ status: OutputItemStatus;
48
+ role: "assistant";
49
+ content: ContentPart[];
50
+ }
51
+ export interface SearchResult {
52
+ id: number;
53
+ title: string;
54
+ url: string;
55
+ snippet: string;
56
+ source?: string;
57
+ date?: string;
58
+ last_updated?: string;
59
+ }
60
+ export interface SearchResultsOutputItem {
61
+ type: "search_results";
62
+ queries?: string[];
63
+ results: SearchResult[];
64
+ }
65
+ export interface URLContent {
66
+ url: string;
67
+ title: string;
68
+ snippet: string;
69
+ }
70
+ export interface FetchURLResultsOutputItem {
71
+ type: "fetch_url_results";
72
+ contents: URLContent[];
73
+ }
74
+ export interface FunctionCallOutputItem {
75
+ type: "function_call";
76
+ id: string;
77
+ status: OutputItemStatus;
78
+ name: string;
79
+ call_id: string;
80
+ arguments: string;
81
+ thought_signature?: string;
82
+ }
83
+ export type OutputItem = MessageOutputItem | SearchResultsOutputItem | FetchURLResultsOutputItem | FunctionCallOutputItem;
84
+ export interface AgentResponse {
85
+ id: string;
86
+ object: "response";
87
+ created_at: number;
88
+ completed_at?: number | null;
89
+ status: ResponseStatus;
90
+ model: string;
91
+ output: OutputItem[];
92
+ output_text?: string;
93
+ usage?: Usage;
94
+ error?: ErrorInfo | null;
95
+ metadata?: Record<string, unknown>;
96
+ instructions?: string | null;
97
+ tools?: Tool[];
98
+ tool_choice?: unknown;
99
+ parallel_tool_calls?: boolean;
100
+ previous_response_id?: string | null;
101
+ parent_response_id?: string | null;
102
+ root_response_id?: string | null;
103
+ prompt_cache_key?: string | null;
104
+ store?: boolean;
105
+ background?: boolean;
106
+ tool_results?: ToolInvocationResult[];
107
+ plan?: unknown;
108
+ }
109
+ export interface ResponseListItem {
110
+ id: string;
111
+ status: ResponseStatus;
112
+ created_at: number;
113
+ completed_at?: number | null;
114
+ model?: string;
115
+ preset?: string;
116
+ input_preview?: string;
117
+ root_response_id?: string;
118
+ background?: boolean;
119
+ }
120
+ export interface ListResponsesParams {
121
+ limit?: number;
122
+ page_token?: string;
123
+ }
124
+ export interface ListResponsesResponse {
125
+ object: "list";
126
+ data: ResponseListItem[];
127
+ has_more: boolean;
128
+ next_page_token?: string;
129
+ }
130
+ export interface ResponseChildItem {
131
+ id: string;
132
+ status: ResponseStatus;
133
+ created_at: number;
134
+ completed_at?: number | null;
135
+ root_response_id?: string;
136
+ model?: string;
137
+ }
138
+ export interface ListChildrenResponse {
139
+ object: "list";
140
+ data: ResponseChildItem[];
141
+ }
142
+ export interface ListEventsParams {
143
+ after_sequence?: number;
144
+ view?: "timeline" | "full";
145
+ }
146
+ export interface ListEventsResponse {
147
+ data: import("./streaming.js").ResponseStreamEvent[];
148
+ }
149
+ export interface CancelResponse {
150
+ interrupted: boolean;
151
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import type { ErrorInfo, Usage } from "./common.js";
2
+ import type { AgentResponse, OutputItem, SearchResult, ToolInvocationResult, URLContent } from "./responses.js";
3
+ export interface ResponseStepEvent {
4
+ step_id?: string;
5
+ sequence_number?: number;
6
+ step_type?: string;
7
+ step_status?: string;
8
+ }
9
+ export interface ResponseModelCallEvent {
10
+ step_id?: string;
11
+ step_index?: number;
12
+ step_type?: string;
13
+ attempt?: number;
14
+ status?: string;
15
+ provider?: string;
16
+ model?: string;
17
+ model_chain?: string[];
18
+ attempt_count?: number;
19
+ }
20
+ export type ResponseStreamEventType = "response.created" | "response.in_progress" | "response.completed" | "response.failed" | "response.plan.updated" | "response.output_item.added" | "response.output_item.done" | "response.output_text.delta" | "response.output_text.done" | "response.reasoning.started" | "response.reasoning.search_queries" | "response.reasoning.search_results" | "response.reasoning.fetch_url_queries" | "response.reasoning.fetch_url_results" | "response.reasoning.stopped" | "response.tool.invocation.completed" | "response.step.completed" | "response.step.failed" | "response.step.skipped" | "response.model.requested" | "response.model.completed" | "response.model.failed";
21
+ export interface ResponseStreamEvent {
22
+ type: ResponseStreamEventType;
23
+ sequence_number: number;
24
+ response?: AgentResponse;
25
+ item?: OutputItem;
26
+ output_index?: number;
27
+ item_id?: string;
28
+ content_index?: number;
29
+ delta?: string;
30
+ text?: string;
31
+ queries?: string[];
32
+ urls?: string[];
33
+ results?: SearchResult[];
34
+ contents?: URLContent[];
35
+ thought?: string;
36
+ error?: ErrorInfo | null;
37
+ usage?: Usage;
38
+ step?: ResponseStepEvent;
39
+ model_call?: ResponseModelCallEvent;
40
+ tool_result?: ToolInvocationResult | null;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ export interface WebSearchTool {
2
+ name: "web_search";
3
+ type?: "search";
4
+ max_tokens?: number;
5
+ max_tokens_per_page?: number;
6
+ }
7
+ export interface SmartWebSearchTool {
8
+ name: "smart_web_search";
9
+ type?: "search";
10
+ max_tokens?: number;
11
+ max_tokens_per_page?: number;
12
+ }
13
+ export interface FetchURLTool {
14
+ name: "fetch_url";
15
+ type?: "url_reader";
16
+ }
17
+ export interface FunctionTool {
18
+ type: "function";
19
+ name: string;
20
+ description?: string;
21
+ parameters?: Record<string, unknown>;
22
+ strict?: boolean;
23
+ }
24
+ export interface SkillTool {
25
+ type: "skill";
26
+ name: string;
27
+ version?: string;
28
+ arguments?: Record<string, unknown>;
29
+ }
30
+ export type Tool = WebSearchTool | SmartWebSearchTool | FetchURLTool | FunctionTool | SkillTool;
31
+ export interface PublicTool {
32
+ object: "tool";
33
+ name: string;
34
+ type?: string;
35
+ description?: string;
36
+ parameters?: Record<string, unknown>;
37
+ max_tokens?: number;
38
+ max_tokens_per_page?: number;
39
+ version?: string;
40
+ }
41
+ export interface ListToolsResponse {
42
+ object: "list";
43
+ data: PublicTool[];
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.0.0";
2
+ export declare const USER_AGENT = "@agent-api/sdk/1.0.0";
@@ -0,0 +1,2 @@
1
+ export const VERSION = "1.0.0";
2
+ export const USER_AGENT = `@agent-api/sdk/${VERSION}`;