@or-sdk/agents 1.12.0-beta.2534.0 → 1.12.0-beta.2550.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.
- package/README.md +83 -0
- package/dist/cjs/Agents.js +28 -0
- package/dist/cjs/Agents.js.map +1 -1
- package/dist/cjs/types.js +12 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/Agents.js +12 -0
- package/dist/esm/Agents.js.map +1 -1
- package/dist/esm/types.js +11 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/types/Agents.d.ts +3 -1
- package/dist/types/Agents.d.ts.map +1 -1
- package/dist/types/types.d.ts +30 -17
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +9 -2
- package/src/Agents.ts +36 -1
- package/src/types.ts +122 -62
package/README.md
CHANGED
|
@@ -134,4 +134,87 @@ await agents.deleteAgent('agent-id');
|
|
|
134
134
|
|
|
135
135
|
**Note:** Deleting an agent is a permanent operation, and the removed data cannot be recovered. Be cautious when using this method and ensure you have backups of your data if necessary.
|
|
136
136
|
|
|
137
|
+
### `setAgentAction`
|
|
138
|
+
Set an action for an agent.
|
|
139
|
+
|
|
140
|
+
#### Params
|
|
141
|
+
- `agentId`: `string` - The ID of the agent for which to set the action.
|
|
142
|
+
- `params`: `AgentAction` - An object containing the properties of the action to set.
|
|
143
|
+
|
|
144
|
+
#### Example
|
|
145
|
+
```typescript
|
|
146
|
+
const actionParams = {
|
|
147
|
+
kind: ActionKind.Mutation,
|
|
148
|
+
name: 'updateStatus',
|
|
149
|
+
description: 'Updates the status of an item',
|
|
150
|
+
typeDefs: `
|
|
151
|
+
input UpdateStatusInput {
|
|
152
|
+
id: ID!
|
|
153
|
+
status: String!
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
type UpdateStatusResult {
|
|
157
|
+
id: ID!
|
|
158
|
+
status: String!
|
|
159
|
+
}`,
|
|
160
|
+
examples: [
|
|
161
|
+
{
|
|
162
|
+
description: 'Update the status of item 123 to "processed"',
|
|
163
|
+
activities: [
|
|
164
|
+
{
|
|
165
|
+
kind: ActivityKind.Action,
|
|
166
|
+
input: 'updateStatus(input: { id: "123", status: "processed" })',
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
};
|
|
172
|
+
const setActionResponse = await agents.setAgentAction('agent-id', actionParams);
|
|
173
|
+
|
|
174
|
+
// Example response
|
|
175
|
+
{
|
|
176
|
+
kind: ActionKind.Mutation,
|
|
177
|
+
name: 'updateStatus',
|
|
178
|
+
description: 'Updates the status of an item',
|
|
179
|
+
typeDefs: `
|
|
180
|
+
input UpdateStatusInput {
|
|
181
|
+
id: ID!
|
|
182
|
+
status: String!
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type UpdateStatusResult {
|
|
186
|
+
id: ID!
|
|
187
|
+
status: String!
|
|
188
|
+
}`,
|
|
189
|
+
examples: [
|
|
190
|
+
{
|
|
191
|
+
description: 'Update the status of item 123 to "processed"',
|
|
192
|
+
activities: [
|
|
193
|
+
{
|
|
194
|
+
kind: ActivityKind.Action,
|
|
195
|
+
input: 'updateStatus(input: { id: "123", status: "processed" })',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Note:** Setting an agent action allows you to define custom behaviors and operations that the agent can perform. Ensure that the `typeDefs` and `examples` are correctly defined to match the intended functionality of the action.
|
|
204
|
+
|
|
205
|
+
### `deleteAgentAction`
|
|
206
|
+
Delete a specific action of an agent.
|
|
207
|
+
|
|
208
|
+
#### Params
|
|
209
|
+
- `agentId`: `string` - The ID of the agent whose action is to be deleted.
|
|
210
|
+
- `actionName`: `string` - The name of the action to delete.
|
|
211
|
+
|
|
212
|
+
#### Example
|
|
213
|
+
```typescript
|
|
214
|
+
typescript
|
|
215
|
+
const actionName = 'updateStatus';
|
|
216
|
+
await agents.deleteAgentAction('agent-id', actionName);
|
|
217
|
+
// No direct response, the action is deleted
|
|
218
|
+
```
|
|
219
|
+
|
|
137
220
|
This documentation update provides a basic overview of the `@or-sdk/agents` package, including installation, usage, and examples for the main methods available in the Agents class. Additional methods and their usage can be added following the same structure.
|
package/dist/cjs/Agents.js
CHANGED
|
@@ -169,6 +169,34 @@ var Agents = (function (_super) {
|
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
|
+
Agents.prototype.setAgentAction = function (agentId, params, options) {
|
|
173
|
+
if (options === void 0) { options = {}; }
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
var response;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0: return [4, this.makeRequest(__assign({ method: 'PUT', route: "agents/".concat(agentId, "/actions/").concat(params.name), data: params }, options))];
|
|
179
|
+
case 1:
|
|
180
|
+
response = _a.sent();
|
|
181
|
+
return [2, response];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
Agents.prototype.deleteAgentAction = function (agentId, actionName, options) {
|
|
187
|
+
if (options === void 0) { options = {}; }
|
|
188
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
189
|
+
var response;
|
|
190
|
+
return __generator(this, function (_a) {
|
|
191
|
+
switch (_a.label) {
|
|
192
|
+
case 0: return [4, this.makeRequest(__assign({ method: 'DELETE', route: "agents/".concat(agentId, "/actions/").concat(actionName) }, options))];
|
|
193
|
+
case 1:
|
|
194
|
+
response = _a.sent();
|
|
195
|
+
return [2, response];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
172
200
|
return Agents;
|
|
173
201
|
}(base_1.Base));
|
|
174
202
|
exports.Agents = Agents;
|
package/dist/cjs/Agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agents.js","sourceRoot":"","sources":["../../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AW,YACrC,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,iBAAU,OAAO,CAAE,IACvB,OAAO,EACV,EAAA;;wBAJI,QAAQ,GAAG,SAIf;wBAEF,WAAO,QAAQ,EAAC;;;;KACjB;IASK,+BAAc,GAApB,UAAqB,OAAe,EAAE,MAAmB,EAAE,OAAyB;QAAzB,wBAAA,EAAA,YAAyB;;;;;4BACjE,WAAM,IAAI,CAAC,WAAW,YACrC,MAAM,EAAE,KAAK,EACb,KAAK,EAAE,iBAAU,OAAO,sBAAY,MAAM,CAAC,IAAI,CAAE,EACjD,IAAI,EAAE,MAAM,IACT,OAAO,EACV,EAAA;;wBALI,QAAQ,GAAG,SAKf;wBAEF,WAAO,QAAQ,EAAC;;;;KACjB;IASK,kCAAiB,GAAvB,UAAwB,OAAe,EAAE,UAAkB,EAAE,OAAyB;QAAzB,wBAAA,EAAA,YAAyB;;;;;4BACnE,WAAM,IAAI,CAAC,WAAW,YACrC,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,iBAAU,OAAO,sBAAY,UAAU,CAAE,IAC7C,OAAO,EACV,EAAA;;wBAJI,QAAQ,GAAG,SAIf;wBAEF,WAAO,QAAQ,EAAC;;;;KACjB;IACH,aAAC;AAAD,CAAC,AAvJD,CAA4B,WAAI,GAuJ/B;AAvJY,wBAAM"}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionKind = exports.ActivityKind = void 0;
|
|
4
|
+
var ActivityKind;
|
|
5
|
+
(function (ActivityKind) {
|
|
6
|
+
ActivityKind["Observation"] = "Observation";
|
|
7
|
+
ActivityKind["Thought"] = "Thought";
|
|
8
|
+
ActivityKind["Action"] = "Action";
|
|
9
|
+
})(ActivityKind = exports.ActivityKind || (exports.ActivityKind = {}));
|
|
10
|
+
var ActionKind;
|
|
11
|
+
(function (ActionKind) {
|
|
12
|
+
ActionKind["Query"] = "Query";
|
|
13
|
+
ActionKind["Mutation"] = "Mutation";
|
|
14
|
+
})(ActionKind = exports.ActionKind || (exports.ActionKind = {}));
|
|
3
15
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAMA,IAAY,YAOX;AAPD,WAAY,YAAY;IAEtB,2CAA2B,CAAA;IAE3B,mCAAmB,CAAA;IAEnB,iCAAiB,CAAA;AACnB,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB;AAKD,IAAY,UAMX;AAND,WAAY,UAAU;IAEpB,6BAAe,CAAA;IAGf,mCAAqB,CAAA;AACvB,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB"}
|
package/dist/esm/Agents.js
CHANGED
|
@@ -67,5 +67,17 @@ export class Agents extends Base {
|
|
|
67
67
|
return response;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
setAgentAction(agentId, params, options = {}) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const response = yield this.makeRequest(Object.assign({ method: 'PUT', route: `agents/${agentId}/actions/${params.name}`, data: params }, options));
|
|
73
|
+
return response;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
deleteAgentAction(agentId, actionName, options = {}) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const response = yield this.makeRequest(Object.assign({ method: 'DELETE', route: `agents/${agentId}/actions/${actionName}` }, options));
|
|
79
|
+
return response;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
70
82
|
}
|
|
71
83
|
//# sourceMappingURL=Agents.js.map
|
package/dist/esm/Agents.js.map
CHANGED
|
@@ -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AAQ,GAAG,MAAM,IAAI,CAAC,WAAW,iBACrC,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,OAAO,YAAY,UAAU,EAAE,IAC7C,OAAO,EACV,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF"}
|
package/dist/esm/types.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var ActivityKind;
|
|
2
|
+
(function (ActivityKind) {
|
|
3
|
+
ActivityKind["Observation"] = "Observation";
|
|
4
|
+
ActivityKind["Thought"] = "Thought";
|
|
5
|
+
ActivityKind["Action"] = "Action";
|
|
6
|
+
})(ActivityKind || (ActivityKind = {}));
|
|
7
|
+
export var ActionKind;
|
|
8
|
+
(function (ActionKind) {
|
|
9
|
+
ActionKind["Query"] = "Query";
|
|
10
|
+
ActionKind["Mutation"] = "Mutation";
|
|
11
|
+
})(ActionKind || (ActionKind = {}));
|
|
2
12
|
//# sourceMappingURL=types.js.map
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IAEtB,2CAA2B,CAAA;IAE3B,mCAAmB,CAAA;IAEnB,iCAAiB,CAAA;AACnB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAKD,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IAEpB,6BAAe,CAAA;IAGf,mCAAqB,CAAA;AACvB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB"}
|
package/dist/types/Agents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base, List } from '@or-sdk/base';
|
|
2
|
-
import { Agent, CreateAgent, UpdateAgent, FindAgentsOptions, CallOptions, AgentsConfig } from './types';
|
|
2
|
+
import { Agent, CreateAgent, UpdateAgent, FindAgentsOptions, CallOptions, AgentsConfig, AgentAction } from './types';
|
|
3
3
|
export declare class Agents extends Base {
|
|
4
4
|
private readonly _feature;
|
|
5
5
|
constructor(params: AgentsConfig);
|
|
@@ -10,5 +10,7 @@ export declare class Agents extends Base {
|
|
|
10
10
|
getAgent(agentId: string, options?: CallOptions): Promise<Agent>;
|
|
11
11
|
updateAgent(agentId: string, params: UpdateAgent, options?: CallOptions): Promise<Agent>;
|
|
12
12
|
deleteAgent(agentId: string, options?: CallOptions): Promise<Agent>;
|
|
13
|
+
setAgentAction(agentId: string, params: AgentAction, options?: CallOptions): Promise<AgentAction>;
|
|
14
|
+
deleteAgentAction(agentId: string, actionName: string, options?: CallOptions): Promise<AgentAction>;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=Agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agents.d.ts","sourceRoot":"","sources":["../../src/Agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,IAAI,EAAY,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Agents.d.ts","sourceRoot":"","sources":["../../src/Agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,IAAI,EAAY,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAKrH,qBAAa,MAAO,SAAQ,IAAI;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;gBAE7B,MAAM,EAAE,YAAY;YAgBlB,WAAW;IAUzB,UAAU,CAAC,GAAG,EAAE,OAAO;IAUjB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAiB3E,UAAU,CAAC,MAAM,GAAE,iBAAsB,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAiB3F,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAiBpE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAiB5F,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAiBvE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IAkBrG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;CAS9G"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { OrderDirection, Token } from '@or-sdk/base';
|
|
2
2
|
import type { SearchMode } from '@or-sdk/lookup';
|
|
3
|
+
export declare enum ActivityKind {
|
|
4
|
+
Observation = "Observation",
|
|
5
|
+
Thought = "Thought",
|
|
6
|
+
Action = "Action"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ActionKind {
|
|
9
|
+
Query = "Query",
|
|
10
|
+
Mutation = "Mutation"
|
|
11
|
+
}
|
|
3
12
|
export type CallOptions = {
|
|
4
13
|
signal?: AbortSignal;
|
|
5
14
|
};
|
|
@@ -17,33 +26,37 @@ export type AgentModelOptions = {
|
|
|
17
26
|
presencePenalty?: number;
|
|
18
27
|
modelName?: string;
|
|
19
28
|
};
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
typeDefs?: string;
|
|
24
|
-
objective?: string;
|
|
25
|
-
image?: string;
|
|
26
|
-
model?: AgentModelOptions;
|
|
29
|
+
export type AgentActivity = {
|
|
30
|
+
kind: ActivityKind;
|
|
31
|
+
input: string;
|
|
27
32
|
};
|
|
28
|
-
export type
|
|
29
|
-
description
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export type ActionExample = {
|
|
34
|
+
description: string;
|
|
35
|
+
activities: AgentActivity[];
|
|
36
|
+
};
|
|
37
|
+
export type AgentAction = {
|
|
38
|
+
kind: ActionKind;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
typeDefs: string;
|
|
42
|
+
examples?: ActionExample[];
|
|
34
43
|
};
|
|
35
44
|
export type Agent = {
|
|
36
45
|
id: string;
|
|
37
46
|
accountId: string;
|
|
38
47
|
name: string;
|
|
39
48
|
description?: string;
|
|
40
|
-
image
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
image: string;
|
|
50
|
+
actions: AgentAction[];
|
|
51
|
+
typeDefs: string;
|
|
52
|
+
objective: string;
|
|
53
|
+
model: AgentModelOptions;
|
|
44
54
|
createdAt: string | Date;
|
|
45
55
|
updatedAt: string | Date;
|
|
56
|
+
primer: AgentActivity[];
|
|
46
57
|
};
|
|
58
|
+
export type UpdateAgent = Partial<Omit<Agent, 'id' | 'createdAt' | 'updatedAt' | 'name' | 'accountId' | 'typeDefs'>>;
|
|
59
|
+
export type CreateAgent = Omit<Agent, 'id' | 'createdAt' | 'updatedAt' | 'accountId' | 'typeDefs'>;
|
|
47
60
|
export type FindAgentsOptions = {
|
|
48
61
|
from?: number;
|
|
49
62
|
size?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","s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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@or-sdk/agents",
|
|
3
|
-
"version": "1.12.0-beta.
|
|
3
|
+
"version": "1.12.0-beta.2550.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -20,12 +20,19 @@
|
|
|
20
20
|
"test:watch": "vitest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@graphql-tools/merge": "^9.0.3",
|
|
24
|
+
"@graphql-tools/schema": "^10.0.3",
|
|
23
25
|
"@or-sdk/base": "^0.34.1",
|
|
24
|
-
"
|
|
26
|
+
"dedent": "^1.5.1",
|
|
27
|
+
"graphql": "^16.8.1",
|
|
28
|
+
"graphql-tag": "^2.12.6",
|
|
29
|
+
"lodash": "^4.17.21",
|
|
30
|
+
"lodash.camelcase": "^4.3.0"
|
|
25
31
|
},
|
|
26
32
|
"devDependencies": {
|
|
27
33
|
"@or-sdk/lookup": "^1.0.0",
|
|
28
34
|
"@types/lodash": "^4.14.176",
|
|
35
|
+
"@types/lodash.camelcase": "^4.3.9",
|
|
29
36
|
"@vitest/coverage-c8": "^0.31.1",
|
|
30
37
|
"concurrently": "^6.4.0",
|
|
31
38
|
"msw": "^1.2.1",
|
package/src/Agents.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Base, CalApiParams, List, makeList } from '@or-sdk/base';
|
|
2
2
|
import { SERVICE_KEY } from './constants';
|
|
3
|
-
import { Agent, CreateAgent, UpdateAgent, FindAgentsOptions, CallOptions, AgentsConfig } from './types';
|
|
3
|
+
import { Agent, CreateAgent, UpdateAgent, FindAgentsOptions, CallOptions, AgentsConfig, AgentAction } from './types';
|
|
4
4
|
import { createErrorParser, processors } from './error-parser';
|
|
5
5
|
|
|
6
6
|
const errorParser = createErrorParser(processors.AXIOS);
|
|
@@ -121,5 +121,40 @@ export class Agents extends Base {
|
|
|
121
121
|
|
|
122
122
|
return response;
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Set an agent action.
|
|
127
|
+
* @param agentId - The ID of the agent to delete.
|
|
128
|
+
* @param params - Set action params.
|
|
129
|
+
* @param options - The API call options.
|
|
130
|
+
* @returns The deleted agent.
|
|
131
|
+
*/
|
|
132
|
+
async setAgentAction(agentId: string, params: AgentAction, options: CallOptions = {}): Promise<AgentAction> {
|
|
133
|
+
const response = await this.makeRequest<AgentAction>({
|
|
134
|
+
method: 'PUT',
|
|
135
|
+
route: `agents/${agentId}/actions/${params.name}`,
|
|
136
|
+
data: params,
|
|
137
|
+
...options,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return response;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Delete an agent action.
|
|
145
|
+
* @param agentId - The ID of the agent to delete.
|
|
146
|
+
* @param actionName - Set action params.
|
|
147
|
+
* @param options - The API call options.
|
|
148
|
+
* @returns The deleted agent.
|
|
149
|
+
*/
|
|
150
|
+
async deleteAgentAction(agentId: string, actionName: string, options: CallOptions = {}): Promise<AgentAction> {
|
|
151
|
+
const response = await this.makeRequest<AgentAction>({
|
|
152
|
+
method: 'DELETE',
|
|
153
|
+
route: `agents/${agentId}/actions/${actionName}`,
|
|
154
|
+
...options,
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return response;
|
|
158
|
+
}
|
|
124
159
|
}
|
|
125
160
|
|
package/src/types.ts
CHANGED
|
@@ -1,205 +1,265 @@
|
|
|
1
1
|
import { OrderDirection, Token } from '@or-sdk/base';
|
|
2
2
|
import type { SearchMode } from '@or-sdk/lookup';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Enum representing the kinds of activities that an agent can perform.
|
|
6
|
+
*/
|
|
7
|
+
export enum ActivityKind {
|
|
8
|
+
/** An observation made by the agent. */
|
|
9
|
+
Observation = 'Observation',
|
|
10
|
+
/** A thought process of the agent. */
|
|
11
|
+
Thought = 'Thought',
|
|
12
|
+
/** An action taken by the agent. */
|
|
13
|
+
Action = 'Action',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enum representing the kinds of action that an agent can take.
|
|
18
|
+
*/
|
|
19
|
+
export enum ActionKind {
|
|
20
|
+
/** Query is an action to read or fetch data. */
|
|
21
|
+
Query = 'Query',
|
|
22
|
+
|
|
23
|
+
/** Mutation is an action to create, update, or delete data. */
|
|
24
|
+
Mutation = 'Mutation',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Defines call options for asynchronous operations, including the ability to cancel them.
|
|
29
|
+
*/
|
|
4
30
|
export type CallOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* An optional AbortSignal to cancel the request.
|
|
33
|
+
*/
|
|
5
34
|
signal?: AbortSignal;
|
|
6
35
|
};
|
|
7
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Configuration options required for initializing agents, including authentication and service URLs.
|
|
39
|
+
*/
|
|
8
40
|
export type AgentsConfig = {
|
|
9
41
|
/**
|
|
10
|
-
* token
|
|
42
|
+
* Authentication token for service access.
|
|
11
43
|
*/
|
|
12
44
|
token: Token;
|
|
13
45
|
|
|
14
46
|
/**
|
|
15
|
-
*
|
|
47
|
+
* Optional URL for the OneReach service discovery API.
|
|
16
48
|
*/
|
|
17
49
|
discoveryUrl?: string;
|
|
18
50
|
|
|
19
51
|
/**
|
|
20
|
-
*
|
|
52
|
+
* Optional account ID for making cross-account requests. This is typically required for super admin users.
|
|
21
53
|
*/
|
|
22
54
|
accountId?: string;
|
|
23
55
|
|
|
24
56
|
/**
|
|
25
|
-
*
|
|
57
|
+
* Optional URL of the OneReach lookup API.
|
|
26
58
|
*/
|
|
27
59
|
serviceUrl?: string;
|
|
28
60
|
|
|
29
61
|
/**
|
|
30
|
-
*
|
|
62
|
+
* Optional feature name for the agent. Defaults to 'master' if not provided.
|
|
31
63
|
*/
|
|
32
64
|
feature?: string;
|
|
33
65
|
};
|
|
34
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Options for configuring the behavior and output of the agent's underlying language model.
|
|
69
|
+
*/
|
|
35
70
|
export type AgentModelOptions = {
|
|
36
71
|
/**
|
|
37
|
-
*
|
|
72
|
+
* Controls the randomness of the output. Higher values may lead to more creative responses.
|
|
38
73
|
*/
|
|
39
74
|
temperature?: number;
|
|
40
75
|
|
|
41
76
|
/**
|
|
42
|
-
*
|
|
77
|
+
* The maximum length of the output generated by the language model.
|
|
43
78
|
*/
|
|
44
79
|
maxTokens?: number;
|
|
45
80
|
|
|
46
81
|
/**
|
|
47
|
-
*
|
|
82
|
+
* Adjusts the likelihood of the model repeating the same line of thinking.
|
|
48
83
|
*/
|
|
49
84
|
frequencyPenalty?: number;
|
|
50
85
|
|
|
51
86
|
/**
|
|
52
|
-
*
|
|
87
|
+
* Discourages the model from using tokens already present in the text.
|
|
53
88
|
*/
|
|
54
89
|
presencePenalty?: number;
|
|
55
90
|
|
|
56
91
|
/**
|
|
57
|
-
*
|
|
92
|
+
* Specifies the name of the large language model to use.
|
|
58
93
|
*/
|
|
59
94
|
modelName?: string;
|
|
60
95
|
};
|
|
61
96
|
|
|
62
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Represents an activity performed by the agent, such as an observation, thought, or action.
|
|
99
|
+
*/
|
|
100
|
+
export type AgentActivity = {
|
|
63
101
|
/**
|
|
64
|
-
*
|
|
65
|
-
* Can start only with a capital letter.
|
|
102
|
+
* The type of activity performed.
|
|
66
103
|
*/
|
|
67
|
-
|
|
104
|
+
kind: ActivityKind;
|
|
68
105
|
|
|
69
106
|
/**
|
|
70
|
-
*
|
|
107
|
+
* The input data or content related to the activity.
|
|
71
108
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A GraphQL type definitions document.
|
|
76
|
-
*/
|
|
77
|
-
typeDefs?: string;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* The objective or goal the agent is trying to achieve.
|
|
81
|
-
*/
|
|
82
|
-
objective?: string;
|
|
109
|
+
input: string;
|
|
110
|
+
};
|
|
83
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Describes an example of how an agent action could be used, including a description and relevant activities.
|
|
114
|
+
*/
|
|
115
|
+
export type ActionExample = {
|
|
84
116
|
/**
|
|
85
|
-
* A
|
|
117
|
+
* A brief description of what the example demonstrates.
|
|
86
118
|
*/
|
|
87
|
-
|
|
119
|
+
description: string;
|
|
88
120
|
|
|
89
121
|
/**
|
|
90
|
-
*
|
|
122
|
+
* A series of activities associated with the example.
|
|
91
123
|
*/
|
|
92
|
-
|
|
124
|
+
activities: AgentActivity[];
|
|
93
125
|
};
|
|
94
126
|
|
|
95
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Defines an action that an agent can perform, including querying and mutation operations.
|
|
129
|
+
*/
|
|
130
|
+
export type AgentAction = {
|
|
96
131
|
/**
|
|
97
|
-
*
|
|
132
|
+
* The category of action, such as a query or mutation.
|
|
98
133
|
*/
|
|
99
|
-
|
|
134
|
+
kind: ActionKind;
|
|
100
135
|
|
|
101
136
|
/**
|
|
102
|
-
*
|
|
137
|
+
* The name of the action.
|
|
103
138
|
*/
|
|
104
|
-
|
|
139
|
+
name: string;
|
|
105
140
|
|
|
106
141
|
/**
|
|
107
|
-
* A
|
|
142
|
+
* A detailed description of the action.
|
|
108
143
|
*/
|
|
109
|
-
|
|
144
|
+
description: string;
|
|
110
145
|
|
|
111
146
|
/**
|
|
112
|
-
* The
|
|
147
|
+
* The type definitions associated with the action, described in a schema language.
|
|
113
148
|
*/
|
|
114
|
-
|
|
149
|
+
typeDefs: string;
|
|
115
150
|
|
|
116
151
|
/**
|
|
117
|
-
*
|
|
152
|
+
* Optional examples that illustrate how the action can be used.
|
|
118
153
|
*/
|
|
119
|
-
|
|
154
|
+
examples?: ActionExample[];
|
|
120
155
|
};
|
|
121
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Represents a digital agent capable of performing actions and processing information based on a given model.
|
|
159
|
+
*/
|
|
122
160
|
export type Agent = {
|
|
123
161
|
/**
|
|
124
|
-
*
|
|
162
|
+
* Unique identifier for the agent.
|
|
125
163
|
*/
|
|
126
164
|
id: string;
|
|
127
165
|
|
|
128
166
|
/**
|
|
129
|
-
*
|
|
167
|
+
* The account ID associated with the agent.
|
|
130
168
|
*/
|
|
131
169
|
accountId: string;
|
|
132
170
|
|
|
133
171
|
/**
|
|
134
|
-
*
|
|
135
|
-
* Can start only with a capital letter.
|
|
172
|
+
* The name of the agent, which must start with a capital letter.
|
|
136
173
|
*/
|
|
137
174
|
name: string;
|
|
138
175
|
|
|
139
176
|
/**
|
|
140
|
-
*
|
|
177
|
+
* Optional description of the agent's purpose and capabilities.
|
|
141
178
|
*/
|
|
142
179
|
description?: string;
|
|
143
180
|
|
|
144
181
|
/**
|
|
145
|
-
*
|
|
182
|
+
* URL to an image representing the agent.
|
|
183
|
+
*/
|
|
184
|
+
image: string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A list of actions the agent is capable of performing.
|
|
146
188
|
*/
|
|
147
|
-
|
|
189
|
+
actions: AgentAction[];
|
|
148
190
|
|
|
149
191
|
/**
|
|
150
|
-
*
|
|
192
|
+
* The readonly definitions associated with the all the actions, described in a schema language.
|
|
151
193
|
*/
|
|
152
|
-
typeDefs
|
|
194
|
+
typeDefs: string;
|
|
153
195
|
|
|
154
196
|
/**
|
|
155
|
-
*
|
|
197
|
+
* A description of the objective or goal the agent is designed to achieve.
|
|
156
198
|
*/
|
|
157
|
-
objective
|
|
199
|
+
objective: string;
|
|
158
200
|
|
|
159
201
|
/**
|
|
160
|
-
*
|
|
202
|
+
* Configuration options for the agent's model, affecting performance and output.
|
|
161
203
|
*/
|
|
162
|
-
model
|
|
204
|
+
model: AgentModelOptions;
|
|
163
205
|
|
|
164
206
|
/**
|
|
165
|
-
*
|
|
207
|
+
* The date and time when the agent was created.
|
|
166
208
|
*/
|
|
167
209
|
createdAt: string | Date;
|
|
168
210
|
|
|
169
211
|
/**
|
|
170
|
-
*
|
|
212
|
+
* The date and time when the agent was last updated.
|
|
171
213
|
*/
|
|
172
214
|
updatedAt: string | Date;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* A primer of historical interactions or activities for the agent, which can influence its behavior.
|
|
218
|
+
*/
|
|
219
|
+
primer: AgentActivity[];
|
|
173
220
|
};
|
|
174
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Defines the properties that can be modified when updating an existing agent.
|
|
224
|
+
*/
|
|
225
|
+
export type UpdateAgent = Partial<Omit<Agent, 'id' | 'createdAt' | 'updatedAt' | 'name' | 'accountId' | 'typeDefs'>>;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Defines the properties required to create a new agent, excluding those automatically assigned upon creation.
|
|
229
|
+
*/
|
|
230
|
+
export type CreateAgent = Omit<Agent, 'id' | 'createdAt' | 'updatedAt' | 'accountId' | 'typeDefs'>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Options for querying the list of agents, including search parameters and pagination controls.
|
|
234
|
+
*/
|
|
175
235
|
export type FindAgentsOptions = {
|
|
176
236
|
/**
|
|
177
|
-
*
|
|
237
|
+
* Pagination offset for retrieving a subset of agents.
|
|
178
238
|
*/
|
|
179
239
|
from?: number;
|
|
180
240
|
|
|
181
241
|
/**
|
|
182
|
-
*
|
|
242
|
+
* Maximum number of agents to retrieve per page.
|
|
183
243
|
*/
|
|
184
244
|
size?: number;
|
|
185
245
|
|
|
186
246
|
/**
|
|
187
|
-
*
|
|
247
|
+
* Text query for searching agents by name, description, or other attributes.
|
|
188
248
|
*/
|
|
189
249
|
query?: string;
|
|
190
250
|
|
|
191
251
|
/**
|
|
192
|
-
*
|
|
252
|
+
* Mode of the search, affecting the specificity and type of matching.
|
|
193
253
|
*/
|
|
194
254
|
mode?: SearchMode;
|
|
195
255
|
|
|
196
256
|
/**
|
|
197
|
-
*
|
|
257
|
+
* The property name by which to order the results.
|
|
198
258
|
*/
|
|
199
259
|
orderProperty?: string;
|
|
200
260
|
|
|
201
261
|
/**
|
|
202
|
-
*
|
|
262
|
+
* The direction in which to order the results, either ascending or descending.
|
|
203
263
|
*/
|
|
204
264
|
orderDirection?: OrderDirection;
|
|
205
265
|
};
|