@arvo-tools/agentic 1.0.1 → 1.1.1

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 (64) hide show
  1. package/dist/Agent/AgentDefaults.d.ts +10 -2
  2. package/dist/Agent/AgentDefaults.d.ts.map +1 -1
  3. package/dist/Agent/AgentDefaults.js +27 -11
  4. package/dist/Agent/AgentDefaults.js.map +1 -1
  5. package/dist/Agent/agentLoop.d.ts +25 -11
  6. package/dist/Agent/agentLoop.d.ts.map +1 -1
  7. package/dist/Agent/agentLoop.js +84 -23
  8. package/dist/Agent/agentLoop.js.map +1 -1
  9. package/dist/Agent/index.d.ts +5 -1
  10. package/dist/Agent/index.d.ts.map +1 -1
  11. package/dist/Agent/index.js +36 -7
  12. package/dist/Agent/index.js.map +1 -1
  13. package/dist/Agent/schema.d.ts +76 -76
  14. package/dist/Agent/schema.js +4 -4
  15. package/dist/Agent/schema.js.map +1 -1
  16. package/dist/Agent/stream/schema.d.ts +456 -0
  17. package/dist/Agent/stream/schema.d.ts.map +1 -0
  18. package/dist/Agent/stream/schema.js +88 -0
  19. package/dist/Agent/stream/schema.js.map +1 -0
  20. package/dist/Agent/stream/types.d.ts +13 -0
  21. package/dist/Agent/stream/types.d.ts.map +1 -0
  22. package/dist/Agent/stream/types.js +3 -0
  23. package/dist/Agent/stream/types.js.map +1 -0
  24. package/dist/Agent/stream/utils.d.ts +23 -0
  25. package/dist/Agent/stream/utils.d.ts.map +1 -0
  26. package/dist/Agent/stream/utils.js +37 -0
  27. package/dist/Agent/stream/utils.js.map +1 -0
  28. package/dist/Agent/types.d.ts +5 -0
  29. package/dist/Agent/types.d.ts.map +1 -1
  30. package/dist/Integrations/anthropic/index.d.ts +24 -0
  31. package/dist/Integrations/anthropic/index.d.ts.map +1 -0
  32. package/dist/Integrations/anthropic/index.js +278 -0
  33. package/dist/Integrations/anthropic/index.js.map +1 -0
  34. package/dist/Integrations/anthropic/types.d.ts +17 -0
  35. package/dist/Integrations/anthropic/types.d.ts.map +1 -0
  36. package/dist/Integrations/anthropic/types.js +3 -0
  37. package/dist/Integrations/anthropic/types.js.map +1 -0
  38. package/dist/Integrations/anthropic/utils.d.ts +14 -0
  39. package/dist/Integrations/anthropic/utils.d.ts.map +1 -0
  40. package/dist/Integrations/anthropic/utils.js +158 -0
  41. package/dist/Integrations/anthropic/utils.js.map +1 -0
  42. package/dist/Integrations/openai/index.d.ts +15 -19
  43. package/dist/Integrations/openai/index.d.ts.map +1 -1
  44. package/dist/Integrations/openai/index.js +74 -179
  45. package/dist/Integrations/openai/index.js.map +1 -1
  46. package/dist/Integrations/openai/types.d.ts +33 -0
  47. package/dist/Integrations/openai/types.d.ts.map +1 -0
  48. package/dist/Integrations/openai/types.js +3 -0
  49. package/dist/Integrations/openai/types.js.map +1 -0
  50. package/dist/Integrations/openai/utils.d.ts +13 -0
  51. package/dist/Integrations/openai/utils.d.ts.map +1 -0
  52. package/dist/Integrations/openai/utils.js +133 -0
  53. package/dist/Integrations/openai/utils.js.map +1 -0
  54. package/dist/Integrations/prompts.d.ts +1 -0
  55. package/dist/Integrations/prompts.d.ts.map +1 -1
  56. package/dist/Integrations/prompts.js +5 -1
  57. package/dist/Integrations/prompts.js.map +1 -1
  58. package/dist/Integrations/types.d.ts +41 -1
  59. package/dist/Integrations/types.d.ts.map +1 -1
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +5 -1
  63. package/dist/index.js.map +1 -1
  64. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,K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;YACnE,gHAAgH;YAChH,GAAG,CAAC,EAAE,mBAAmB,CAAC;YAC1B,qFAAqF;YACrF,OAAO,EAAE,mBAAmB,CAAC,aAAa,EAAE,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;YACzE,oFAAoF;YACpF,MAAM,EAAE,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;SAC9C;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { AgentLLMIntegration } from '../types';
3
+ import type { AnthropicLlmIntegrationConfig } from './types';
4
+ /**
5
+ * Creates an Arvo-compatible LLM Adapter for Anthropic Claude models.
6
+ *
7
+ * This factory configures an integration that bridges the generic `Arvo` agent runner with the specific
8
+ * Anthropic API requirements. It includes built-in features for:
9
+ *
10
+ * - **Structured Outputs:** Automatically converts Zod schemas to JSON schema format and instructs
11
+ * Claude to respond with valid JSON matching the schema.
12
+ * - **Token Optimization:** Automatically replaces large media payloads (images/files) with placeholder
13
+ * text in the conversational history after they have been processed once to reduce context window usage.
14
+ * - **Observability:** Instruments calls with OpenInference-compliant OpenTelemetry attributes,
15
+ * including detailed input/output recording and token usage.
16
+ * - **Safety:** Automatically injects a "tool limit reached" system instruction when the agent
17
+ * exhausts its configured tool budget.
18
+ *
19
+ * @param client - An initialized `Anthropic` SDK client instance.
20
+ * @param config - Configuration for model parameters (e.g., temperature, max tokens), cost calculations, and telemetry metadata.
21
+ * @returns An `AgentLLMIntegration` function ready for use with `createArvoAgent`.
22
+ */
23
+ export declare const anthropicLLMIntegration: (client: Anthropic, config?: AnthropicLlmIntegrationConfig) => AgentLLMIntegration;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Integrations/anthropic/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAiB/C,OAAO,KAAK,EAAE,mBAAmB,EAA6B,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAG7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,GACjC,QAAQ,SAAS,EAAE,SAAS,6BAA6B,KAAG,mBAoLzD,CAAC"}
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __values = (this && this.__values) || function(o) {
50
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
51
+ if (m) return m.call(o);
52
+ if (o && typeof o.length === "number") return {
53
+ next: function () {
54
+ if (o && i >= o.length) o = void 0;
55
+ return { value: o && o[i++], done: !o };
56
+ }
57
+ };
58
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.anthropicLLMIntegration = void 0;
62
+ var openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
63
+ var api_1 = require("@opentelemetry/api");
64
+ var arvo_core_1 = require("arvo-core");
65
+ var zod_to_json_schema_1 = require("zod-to-json-schema");
66
+ var utils_1 = require("../../Agent/utils");
67
+ var prompts_1 = require("../prompts");
68
+ var utils_2 = require("./utils");
69
+ /**
70
+ * Creates an Arvo-compatible LLM Adapter for Anthropic Claude models.
71
+ *
72
+ * This factory configures an integration that bridges the generic `Arvo` agent runner with the specific
73
+ * Anthropic API requirements. It includes built-in features for:
74
+ *
75
+ * - **Structured Outputs:** Automatically converts Zod schemas to JSON schema format and instructs
76
+ * Claude to respond with valid JSON matching the schema.
77
+ * - **Token Optimization:** Automatically replaces large media payloads (images/files) with placeholder
78
+ * text in the conversational history after they have been processed once to reduce context window usage.
79
+ * - **Observability:** Instruments calls with OpenInference-compliant OpenTelemetry attributes,
80
+ * including detailed input/output recording and token usage.
81
+ * - **Safety:** Automatically injects a "tool limit reached" system instruction when the agent
82
+ * exhausts its configured tool budget.
83
+ *
84
+ * @param client - An initialized `Anthropic` SDK client instance.
85
+ * @param config - Configuration for model parameters (e.g., temperature, max tokens), cost calculations, and telemetry metadata.
86
+ * @returns An `AgentLLMIntegration` function ready for use with `createArvoAgent`.
87
+ */
88
+ var anthropicLLMIntegration = function (client, config) {
89
+ return function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
90
+ var _e;
91
+ var _messages = _c.messages, _system = _c.system, tools = _c.tools, outputFormat = _c.outputFormat, lifecycle = _c.lifecycle, toolInteractions = _c.toolInteractions;
92
+ var otelInfo = _d.otelInfo;
93
+ return __generator(this, function (_f) {
94
+ switch (_f.label) {
95
+ case 0: return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
96
+ name: "LLM.invoke<".concat(lifecycle === 'init' ? 'init' : lifecycle === 'tool_result' ? 'resume' : 'output_validation_feedback', ">"),
97
+ disableSpanManagement: true,
98
+ context: {
99
+ inheritFrom: 'TRACE_HEADERS',
100
+ traceHeaders: otelInfo.headers,
101
+ },
102
+ spanOptions: {
103
+ attributes: (_e = {},
104
+ _e[openinference_semantic_conventions_1.SemanticConventions.OPENINFERENCE_SPAN_KIND] = openinference_semantic_conventions_1.OpenInferenceSpanKind.LLM,
105
+ _e),
106
+ },
107
+ fn: function (span) { return __awaiter(void 0, void 0, void 0, function () {
108
+ var messageCreateParams, _a, messages, system, limitMessage, jsonSchema, schemaInstruction, toolDef, tools_1, tools_1_1, tool, formattedMessages, response, llmUsage, executionUnits, toolUseBlocks, toolRequests, toolUseBlocks_1, toolUseBlocks_1_1, toolCall, textBlocks, content, e_1;
109
+ var e_2, _b, e_3, _c;
110
+ var _d, _e, _f, _g, _h, _j, _k;
111
+ return __generator(this, function (_l) {
112
+ switch (_l.label) {
113
+ case 0:
114
+ messageCreateParams = (_d = config === null || config === void 0 ? void 0 : config.invocationParam) !== null && _d !== void 0 ? _d : {
115
+ model: 'claude-sonnet-4-20250514',
116
+ max_tokens: 4096,
117
+ temperature: 0,
118
+ };
119
+ return [4 /*yield*/, ((_e = config === null || config === void 0 ? void 0 : config.contextTransformer) === null || _e === void 0 ? void 0 : _e.call(config, {
120
+ messages: _messages,
121
+ system: _system,
122
+ }))];
123
+ case 1:
124
+ _a = (_f = (_l.sent())) !== null && _f !== void 0 ? _f : {
125
+ messages: _messages.map(function (item) {
126
+ if (item.content.type === 'media' && item.seenCount > 0) {
127
+ return {
128
+ role: item.role,
129
+ content: {
130
+ type: 'text',
131
+ content: "Media file (type: ".concat(item.content.contentType.type, "@").concat(item.content.contentType.format, ") already parsed and looked at. No need for you to look at it again"),
132
+ },
133
+ seenCount: item.seenCount,
134
+ };
135
+ }
136
+ return item;
137
+ }),
138
+ system: _system,
139
+ }, messages = _a.messages, system = _a.system;
140
+ if (toolInteractions.exhausted) {
141
+ limitMessage = (_h = (_g = config === null || config === void 0 ? void 0 : config.toolLimitPrompt) === null || _g === void 0 ? void 0 : _g.call(config, toolInteractions)) !== null && _h !== void 0 ? _h : prompts_1.DEFAULT_TOOL_LIMIT_PROMPT;
142
+ messages.push({
143
+ role: 'user',
144
+ content: {
145
+ type: 'text',
146
+ content: limitMessage,
147
+ },
148
+ seenCount: 0,
149
+ });
150
+ system = "".concat(system, "\n\n").concat(limitMessage);
151
+ }
152
+ // For JSON output format, append schema instructions to the system prompt
153
+ if (outputFormat.type === 'json') {
154
+ jsonSchema = (0, zod_to_json_schema_1.zodToJsonSchema)(outputFormat.format);
155
+ schemaInstruction = (0, prompts_1.jsonPrompt)(JSON.stringify(jsonSchema));
156
+ system = system ? "".concat(system).concat(schemaInstruction) : schemaInstruction;
157
+ }
158
+ (0, utils_1.setOpenInferenceInputAttr)({
159
+ llm: {
160
+ provider: 'anthropic',
161
+ system: 'anthropic',
162
+ model: messageCreateParams === null || messageCreateParams === void 0 ? void 0 : messageCreateParams.model,
163
+ invocationParam: messageCreateParams,
164
+ },
165
+ messages: messages,
166
+ system: system,
167
+ tools: tools,
168
+ }, span);
169
+ _l.label = 2;
170
+ case 2:
171
+ _l.trys.push([2, 4, 5, 6]);
172
+ toolDef = [];
173
+ try {
174
+ for (tools_1 = __values(tools), tools_1_1 = tools_1.next(); !tools_1_1.done; tools_1_1 = tools_1.next()) {
175
+ tool = tools_1_1.value;
176
+ toolDef.push({
177
+ name: tool.name,
178
+ description: tool.description,
179
+ input_schema: tool.inputSchema,
180
+ });
181
+ }
182
+ }
183
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
184
+ finally {
185
+ try {
186
+ if (tools_1_1 && !tools_1_1.done && (_b = tools_1.return)) _b.call(tools_1);
187
+ }
188
+ finally { if (e_2) throw e_2.error; }
189
+ }
190
+ formattedMessages = (0, utils_2.formatMessagesForAnthropic)(messages);
191
+ return [4 /*yield*/, client.messages.create(__assign(__assign({}, messageCreateParams), { system: system !== null && system !== void 0 ? system : undefined, tools: toolDef.length ? toolDef : undefined, messages: formattedMessages }))];
192
+ case 3:
193
+ response = _l.sent();
194
+ llmUsage = {
195
+ tokens: {
196
+ prompt: response.usage.input_tokens,
197
+ completion: response.usage.output_tokens,
198
+ },
199
+ };
200
+ executionUnits = (_k = (_j = config === null || config === void 0 ? void 0 : config.executionunits) === null || _j === void 0 ? void 0 : _j.call(config, llmUsage.tokens.prompt, llmUsage.tokens.completion)) !== null && _k !== void 0 ? _k : llmUsage.tokens.prompt + llmUsage.tokens.completion;
201
+ (0, utils_1.setOpenInferenceUsageOutputAttr)(llmUsage, span);
202
+ toolUseBlocks = response.content.filter(function (block) { return block.type === 'tool_use'; });
203
+ if (toolUseBlocks.length > 0) {
204
+ toolRequests = [];
205
+ try {
206
+ for (toolUseBlocks_1 = __values(toolUseBlocks), toolUseBlocks_1_1 = toolUseBlocks_1.next(); !toolUseBlocks_1_1.done; toolUseBlocks_1_1 = toolUseBlocks_1.next()) {
207
+ toolCall = toolUseBlocks_1_1.value;
208
+ try {
209
+ toolRequests.push({
210
+ toolUseId: toolCall.id,
211
+ name: toolCall.name,
212
+ input: toolCall.input,
213
+ });
214
+ }
215
+ catch (err) {
216
+ (0, arvo_core_1.exceptionToSpan)(err, span);
217
+ }
218
+ }
219
+ }
220
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
221
+ finally {
222
+ try {
223
+ if (toolUseBlocks_1_1 && !toolUseBlocks_1_1.done && (_c = toolUseBlocks_1.return)) _c.call(toolUseBlocks_1);
224
+ }
225
+ finally { if (e_3) throw e_3.error; }
226
+ }
227
+ if (toolRequests.length) {
228
+ (0, utils_1.setOpenInferenceToolCallOutputAttr)({ toolCalls: toolRequests }, span);
229
+ return [2 /*return*/, {
230
+ type: 'tool_call',
231
+ toolRequests: toolRequests,
232
+ usage: llmUsage,
233
+ executionUnits: executionUnits,
234
+ }];
235
+ }
236
+ }
237
+ textBlocks = response.content.filter(function (block) { return block.type === 'text'; });
238
+ content = textBlocks.map(function (block) { return block.text; }).join('');
239
+ // Handle stop reasons
240
+ if (response.stop_reason === 'max_tokens') {
241
+ content = "".concat(content, " [Max response token limit (<= ").concat(messageCreateParams.max_tokens, ") reached]");
242
+ throw new Error("Agent reached max token limit. The partial response is \"".concat(content, "\""));
243
+ }
244
+ (0, utils_1.setOpenInferenceResponseOutputAttr)({ response: content }, span);
245
+ if (outputFormat.type === 'json') {
246
+ return [2 /*return*/, {
247
+ type: 'json',
248
+ content: content || '{}',
249
+ parsedContent: (0, utils_1.tryParseJson)(content || '{}'),
250
+ usage: llmUsage,
251
+ executionUnits: executionUnits,
252
+ }];
253
+ }
254
+ return [2 /*return*/, {
255
+ type: 'text',
256
+ content: content,
257
+ usage: llmUsage,
258
+ executionUnits: executionUnits,
259
+ }];
260
+ case 4:
261
+ e_1 = _l.sent();
262
+ span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e_1 === null || e_1 === void 0 ? void 0 : e_1.message });
263
+ throw e_1;
264
+ case 5:
265
+ span.end();
266
+ return [7 /*endfinally*/];
267
+ case 6: return [2 /*return*/];
268
+ }
269
+ });
270
+ }); },
271
+ })];
272
+ case 1: return [2 /*return*/, _f.sent()];
273
+ }
274
+ });
275
+ }); };
276
+ };
277
+ exports.anthropicLLMIntegration = anthropicLLMIntegration;
278
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Integrations/anthropic/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kGAGqD;AACrD,0CAAoD;AACpD,uCAA+D;AAC/D,yDAAqD;AAErD,2CAM2B;AAC3B,sCAAmE;AAGnE,iCAAqD;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACI,IAAM,uBAAuB,GAClC,UAAC,MAAiB,EAAE,MAAsC;IAC1D,OAAA,yEACE,EAA0F,EAC1F,EAAY;;YADA,SAAS,cAAA,EAAU,OAAO,YAAA,EAAE,KAAK,WAAA,EAAE,YAAY,kBAAA,EAAE,SAAS,eAAA,EAAE,gBAAgB,sBAAA;YACtF,QAAQ,cAAA;;;wBAEV,qBAAM,6BAAiB,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC;wBACpD,IAAI,EAAE,qBAAc,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAAK,aAAa,CAAC,CAAC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,IAAI,EAAE,MAAM;oDACZ,OAAO,EAAE,OAAO,IAAI,IAAI;oDACxB,aAAa,EAAE,IAAA,oBAAY,EAAC,OAAO,IAAI,IAAI,CAAC;oDAC5C,KAAK,EAAE,QAAQ;oDACf,cAAc,gBAAA;iDACf,EAAC;wCACJ,CAAC;wCAED,sBAAO;gDACL,IAAI,EAAE,MAAM;gDACZ,OAAO,SAAA;gDACP,KAAK,EAAE,QAAQ;gDACf,cAAc,gBAAA;6CACf,EAAC;;;wCAEF,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,oBAAc,CAAC,KAAK,EAAE,OAAO,EAAG,GAAW,aAAX,GAAC,uBAAD,GAAC,CAAY,OAAO,EAAE,CAAC,CAAC;wCAC/E,MAAM,GAAC,CAAC;;wCAER,IAAI,CAAC,GAAG,EAAE,CAAC;;;;;6BAEd;qBACF,CAAC,EAAA;wBA/KF,sBAAA,SA+KE,EAAA;;;SAAA;AAnLJ,CAmLI,CAAC;AArLM,QAAA,uBAAuB,2BAqL7B"}
@@ -0,0 +1,17 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { CommonIntegrationConfig } from '../types';
3
+ export type AnthropicLlmIntegrationConfig = {
4
+ /**
5
+ * Configuration strictly for the model invocation parameters passed to the Anthropic SDK.
6
+ *
7
+ * Common parameters include:
8
+ * - `model`: The model ID (e.g., `claude-sonnet-4-20250514`, `claude-3-5-sonnet-20241022`).
9
+ * - `temperature`: Controls randomness (0-1).
10
+ * - `max_tokens`: Limits the generation length (required by Anthropic).
11
+ *
12
+ * @default
13
+ * { model: 'claude-sonnet-4-20250514', max_tokens: 4096, temperature: 0 }
14
+ */
15
+ invocationParam?: Pick<Anthropic.MessageCreateParamsNonStreaming, 'model' | 'temperature' | 'max_tokens'>;
16
+ } & CommonIntegrationConfig;
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Integrations/anthropic/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,IAAI,CACpB,SAAS,CAAC,+BAA+B,EACzC,OAAO,GAAG,aAAa,GAAG,YAAY,CACvC,CAAC;CACH,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/Integrations/anthropic/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { AgentLLMIntegrationParam } from '../types';
3
+ /**
4
+ * Internal Adapter: Maps Arvo's generic Agent Message format to Anthropic's specific API format.
5
+ *
6
+ * Handles:
7
+ * - Mapping Tool Results to their originating Tool Call IDs.
8
+ * - Multimodal Content (converting Arvo media objects to Anthropic Image source format).
9
+ * - Reconstructs the specific message ordering Anthropic expects (User -> Assistant(ToolUse) -> User(ToolResult)).
10
+ *
11
+ * Note: Anthropic does not use a system message in the messages array - it's passed separately.
12
+ */
13
+ export declare const formatMessagesForAnthropic: (messages: AgentLLMIntegrationParam["messages"]) => Anthropic.MessageParam[];
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/Integrations/anthropic/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,wBAAwB,CAAC,UAAU,CAAC,KAC7C,SAAS,CAAC,YAAY,EA0FxB,CAAC"}
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.formatMessagesForAnthropic = void 0;
15
+ /**
16
+ * Internal Adapter: Maps Arvo's generic Agent Message format to Anthropic's specific API format.
17
+ *
18
+ * Handles:
19
+ * - Mapping Tool Results to their originating Tool Call IDs.
20
+ * - Multimodal Content (converting Arvo media objects to Anthropic Image source format).
21
+ * - Reconstructs the specific message ordering Anthropic expects (User -> Assistant(ToolUse) -> User(ToolResult)).
22
+ *
23
+ * Note: Anthropic does not use a system message in the messages array - it's passed separately.
24
+ */
25
+ var formatMessagesForAnthropic = function (messages) {
26
+ var e_1, _a, e_2, _b;
27
+ var _c;
28
+ var formattedMessages = [];
29
+ var toolResponseMap = {};
30
+ try {
31
+ for (var messages_1 = __values(messages), messages_1_1 = messages_1.next(); !messages_1_1.done; messages_1_1 = messages_1.next()) {
32
+ var message = messages_1_1.value;
33
+ if (message.role === 'user' && message.content.type === 'tool_result') {
34
+ toolResponseMap[message.content.toolUseId] = message.content;
35
+ }
36
+ }
37
+ }
38
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
39
+ finally {
40
+ try {
41
+ if (messages_1_1 && !messages_1_1.done && (_a = messages_1.return)) _a.call(messages_1);
42
+ }
43
+ finally { if (e_1) throw e_1.error; }
44
+ }
45
+ try {
46
+ for (var messages_2 = __values(messages), messages_2_1 = messages_2.next(); !messages_2_1.done; messages_2_1 = messages_2.next()) {
47
+ var message = messages_2_1.value;
48
+ if (message.role === 'user') {
49
+ if (message.content.type === 'text') {
50
+ formattedMessages.push({
51
+ role: 'user',
52
+ content: message.content.content,
53
+ });
54
+ }
55
+ else if (message.content.type === 'media' &&
56
+ message.content.contentType.type === 'image' &&
57
+ message.content.contentType.format === 'base64') {
58
+ var _d = parseMediaContent(message.content.content), mediaType = _d.mediaType, base64Data = _d.base64Data;
59
+ formattedMessages.push({
60
+ role: 'user',
61
+ content: [
62
+ {
63
+ type: 'image',
64
+ source: {
65
+ type: 'base64',
66
+ media_type: mediaType,
67
+ data: base64Data,
68
+ },
69
+ },
70
+ ],
71
+ });
72
+ }
73
+ else if (message.content.type === 'media' &&
74
+ message.content.contentType.type === 'file' &&
75
+ message.content.contentType.format === 'base64' &&
76
+ message.content.contentType.mediatype === 'application/pdf') {
77
+ var base64Data = parseMediaContent(message.content.content).base64Data;
78
+ formattedMessages.push({
79
+ role: 'user',
80
+ content: [
81
+ {
82
+ type: 'document',
83
+ source: {
84
+ type: 'base64',
85
+ media_type: 'application/pdf',
86
+ data: base64Data,
87
+ },
88
+ },
89
+ ],
90
+ });
91
+ }
92
+ }
93
+ else if (message.role === 'assistant') {
94
+ if (message.content.type === 'text') {
95
+ formattedMessages.push({
96
+ role: 'assistant',
97
+ content: message.content.content,
98
+ });
99
+ }
100
+ else if (message.content.type === 'tool_use') {
101
+ formattedMessages.push({
102
+ role: 'assistant',
103
+ content: [
104
+ {
105
+ type: 'tool_use',
106
+ id: message.content.toolUseId,
107
+ name: message.content.name,
108
+ input: message.content.input,
109
+ },
110
+ ],
111
+ });
112
+ var toolResult = toolResponseMap[message.content.toolUseId];
113
+ formattedMessages.push({
114
+ role: 'user',
115
+ content: [
116
+ {
117
+ type: 'tool_result',
118
+ tool_use_id: message.content.toolUseId,
119
+ content: (_c = toolResult === null || toolResult === void 0 ? void 0 : toolResult.content) !== null && _c !== void 0 ? _c : JSON.stringify({ error: 'No tool response' }),
120
+ },
121
+ ],
122
+ });
123
+ }
124
+ }
125
+ }
126
+ }
127
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
128
+ finally {
129
+ try {
130
+ if (messages_2_1 && !messages_2_1.done && (_b = messages_2.return)) _b.call(messages_2);
131
+ }
132
+ finally { if (e_2) throw e_2.error; }
133
+ }
134
+ return formattedMessages;
135
+ };
136
+ exports.formatMessagesForAnthropic = formatMessagesForAnthropic;
137
+ /**
138
+ * Parses media content from either a data URL or raw base64 string.
139
+ *
140
+ * @param content - The media content string (data URL or raw base64)
141
+ * @returns Object containing the media type and base64 data
142
+ */
143
+ var parseMediaContent = function (content) {
144
+ // Check if it's a data URL
145
+ var dataUrlMatch = content.match(/^data:([^;]+);base64,(.+)$/);
146
+ if (dataUrlMatch) {
147
+ return {
148
+ mediaType: dataUrlMatch[1],
149
+ base64Data: dataUrlMatch[2],
150
+ };
151
+ }
152
+ // Assume it's raw base64 with a default media type
153
+ return {
154
+ mediaType: 'image/png',
155
+ base64Data: content,
156
+ };
157
+ };
158
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/Integrations/anthropic/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA;;;;;;;;;GASG;AACI,IAAM,0BAA0B,GAAG,UACxC,QAA8C;;;IAE9C,IAAM,iBAAiB,GAA6B,EAAE,CAAC;IACvD,IAAM,eAAe,GAA2C,EAAE,CAAC;;QACnE,KAAsB,IAAA,aAAA,SAAA,QAAQ,CAAA,kCAAA,wDAAE,CAAC;YAA5B,IAAM,OAAO,qBAAA;YAChB,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBACtE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/D,CAAC;QACH,CAAC;;;;;;;;;;QAED,KAAsB,IAAA,aAAA,SAAA,QAAQ,CA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AAkB,EAAE,CAAC;6BAC9E;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;;;;;;;;;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AA5FW,QAAA,0BAA0B,8BA4FrC;AAEF;;;;;GAKG;AACH,IAAM,iBAAiB,GAAG,UAAC,OAAe;IACxC,2BAA2B;IAC3B,IAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACjE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO;YACL,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;YAC1B,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;SAC5B,CAAC;IACJ,CAAC;IAED,mDAAmD;IACnD,OAAO;QACL,SAAS,EAAE,WAAW;QACtB,UAAU,EAAE,OAAO;KACpB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,25 +1,21 @@
1
1
  import type OpenAI from 'openai';
2
- import type { ChatModel } from 'openai/resources/shared.mjs';
3
- import type { AgentLLMIntegration, AgentLLMIntegrationParam } from '../types';
2
+ import type { AzureOpenAI } from 'openai';
3
+ import type { AgentLLMIntegration } from '../types';
4
+ import type { OpenAILlmIntegrationConfig } from './types';
4
5
  /**
5
- * Creates an Arvo-compatible LLM Adapter for OpenAI models (GPT-4, GPT-3.5, etc.).
6
+ * Creates an Arvo-compatible LLM Adapter for OpenAI and compatible models (e.g., Azure OpenAI).
6
7
  *
7
- * This integration handles the complexity of:
8
- * 1. **Structured Outputs:** Automatically converts Zod schemas to OpenAI `json_schema` format when required.
9
- * 2. **Context Optimization:** Automatically strips large media payloads (images/files) from the history during resume/tool-result cycles to save tokens.
10
- * 3. **Observability:** Instruments every call with OpenInference-compliant OpenTelemetry attributes.
11
- * 4. **Safety:** Injects a tool limit prompt when the Agent exhausts its tool budget (customizable via `toolLimitPrompt`).
8
+ * This factory configures an integration that bridges the generic `Arvo` agent runner with the specific
9
+ * OpenAI API requirements. It includes built-in features for:
12
10
  *
13
- * @param client - An initialized `OpenAI` SDK client instance.
14
- * @param config - Configuration for model behavior (Model ID, Temperature, Max Tokens) and cost calculation logic.
15
- * @param config.toolLimitPrompt - Custom system instruction to inject when `maxToolInteractions` logic is triggered. useful for guiding the model to summarize or fail gracefully.
16
- * @returns An `AgentLLMIntegration` function ready to be passed to `createArvoAgent`.
11
+ * - **Structured Outputs:** Automatically converts Zod schemas provided in `outputFormat` to OpenAI's `json_schema` format.
12
+ * - **Token Optimization:** Automatically replaces large media payloads (images/files) with placeholder text in the conversational history after they have been processed once to reduce context window usage.
13
+ * - **Observability:** Instruments calls with OpenInference-compliant OpenTelemetry attributes, including detailed input/output recording and token usage.
14
+ * - **Safety:** Automatically injects a "tool limit reached" system instruction when the agent exhausts its configured tool budget.
15
+ *
16
+ * @param client - An initialized `OpenAI` or `AzureOpenAI` SDK client instance.
17
+ * @param config - Configuration for model parameters (e.g., temperature, max tokens), cost calculations, and telemetry metadata.
18
+ * @returns An `AgentLLMIntegration` function ready for use with `createArvoAgent`.
17
19
  */
18
- export declare const openaiLLMIntegration: (client: OpenAI, config?: {
19
- model?: ChatModel;
20
- temperature?: number;
21
- maxTokens?: number;
22
- executionunits?: (prompt: number, completion: number) => number;
23
- toolLimitPrompt?: (toolInteractions: AgentLLMIntegrationParam["toolInteractions"]) => string;
24
- }) => AgentLLMIntegration;
20
+ export declare const openaiLLMIntegration: <TClient extends OpenAI | AzureOpenAI>(client: TClient, config?: OpenAILlmIntegrationConfig<TClient>) => AgentLLMIntegration;
25
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Integrations/openai/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAY7D,OAAO,KAAK,EACV,mBAAmB,EAEnB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAiGlB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAE7B,QAAQ,MAAM,EACd,SAAS;IACP,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAChE,eAAe,CAAC,EAAE,CAAC,gBAAgB,EAAE,wBAAwB,CAAC,kBAAkB,CAAC,KAAK,MAAM,CAAC;CAC9F,KACA,mBAiLC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Integrations/openai/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAa1C,OAAO,KAAK,EAAE,mBAAmB,EAA6B,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAG1D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC9B,OAAO,SAAS,MAAM,GAAG,WAAW,EACnC,QAAQ,OAAO,EACf,SAAS,0BAA0B,CAAC,OAAO,CAAC,KAC3C,mBAsLC,CAAC"}