@arvo-tools/agentic 1.2.17 → 2.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.
- package/dist/Agent/AgentDefaults.d.ts +4 -1
- package/dist/Agent/AgentDefaults.d.ts.map +1 -1
- package/dist/Agent/AgentDefaults.js +110 -73
- package/dist/Agent/AgentDefaults.js.map +1 -1
- package/dist/Agent/agentLoop.d.ts +19 -17
- package/dist/Agent/agentLoop.d.ts.map +1 -1
- package/dist/Agent/agentLoop.js +239 -120
- package/dist/Agent/agentLoop.js.map +1 -1
- package/dist/Agent/index.d.ts +91 -39
- package/dist/Agent/index.d.ts.map +1 -1
- package/dist/Agent/index.js +218 -146
- package/dist/Agent/index.js.map +1 -1
- package/dist/Agent/schema.d.ts +326 -22
- package/dist/Agent/schema.d.ts.map +1 -1
- package/dist/Agent/schema.js +23 -1
- package/dist/Agent/schema.js.map +1 -1
- package/dist/Agent/stream/schema.d.ts +39 -39
- package/dist/Agent/types.d.ts +170 -79
- package/dist/Agent/types.d.ts.map +1 -1
- package/dist/Agent/utils.d.ts +6 -0
- package/dist/Agent/utils.d.ts.map +1 -1
- package/dist/Agent/utils.js +10 -1
- package/dist/Agent/utils.js.map +1 -1
- package/dist/AgentTool/index.d.ts +2 -3
- package/dist/AgentTool/index.d.ts.map +1 -1
- package/dist/AgentTool/index.js +11 -7
- package/dist/AgentTool/index.js.map +1 -1
- package/dist/AgentTool/types.d.ts +27 -9
- package/dist/AgentTool/types.d.ts.map +1 -1
- package/dist/Integrations/MCPClient.d.ts +2 -2
- package/dist/Integrations/MCPClient.js +2 -2
- package/dist/Integrations/anthropic/index.d.ts.map +1 -1
- package/dist/Integrations/anthropic/index.js +3 -3
- package/dist/Integrations/anthropic/index.js.map +1 -1
- package/dist/Integrations/openai/index.d.ts.map +1 -1
- package/dist/Integrations/openai/index.js +3 -3
- package/dist/Integrations/openai/index.js.map +1 -1
- package/dist/Integrations/types.d.ts +89 -15
- package/dist/Integrations/types.d.ts.map +1 -1
- package/dist/Integrations/types.js +47 -0
- package/dist/Integrations/types.js.map +1 -1
- package/dist/SimplePermissionManager/contract.d.ts +4 -4
- package/dist/SimplePermissionManager/index.d.ts +12 -12
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/Agent/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AgentLLMIntegration, AgentLLMIntegrationOutput, AgentLLMIntegratio
|
|
|
7
7
|
import type { IMCPClient } from '../interfaces.mcp';
|
|
8
8
|
import type { IPermissionManager } from '../interfaces.permission.manager';
|
|
9
9
|
import type { NonEmptyArray, PromiseAble } from '../types';
|
|
10
|
-
import type { AgentMediaContentSchema, AgentMessageContentSchema, AgentMessageSchema, AgentTextContentSchema, AgentToolCallContentSchema, AgentToolResultContentSchema } from './schema';
|
|
10
|
+
import type { AgentMediaContentSchema, AgentMessageContentSchema, AgentMessageSchema, AgentStateSchema, AgentTextContentSchema, AgentToolCallContentSchema, AgentToolResultContentSchema } from './schema';
|
|
11
11
|
import type { AgentStreamListener } from './stream/types';
|
|
12
12
|
/** Represents a pure text block in the conversation history. */
|
|
13
13
|
export type AgentTextContent = z.infer<typeof AgentTextContentSchema>;
|
|
@@ -25,8 +25,13 @@ export type AgentMessageContent = z.infer<typeof AgentMessageContentSchema>;
|
|
|
25
25
|
* by the integration layer.
|
|
26
26
|
*/
|
|
27
27
|
export type AgentMessage = z.infer<typeof AgentMessageSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* The resumable agent state type
|
|
30
|
+
*/
|
|
31
|
+
export type AgentState = z.infer<typeof AgentStateSchema>;
|
|
28
32
|
export type AnyArvoOrchestratorContract = ArvoOrchestratorContract<any, any>;
|
|
29
33
|
export type AnyArvoContract = ArvoContract<any, any, any>;
|
|
34
|
+
export type AgentToolOutputTransformer<T = any> = (data: T) => PromiseAble<AgentMessage | AgentMessage[]>;
|
|
30
35
|
/**
|
|
31
36
|
* Defines a Distributed Tool (Arvo Service) available to the Agent.
|
|
32
37
|
*
|
|
@@ -37,9 +42,9 @@ export type AnyArvoContract = ArvoContract<any, any, any>;
|
|
|
37
42
|
* 3. The remote Service processes the event and replies.
|
|
38
43
|
* 4. The Agent Resumes.
|
|
39
44
|
*/
|
|
40
|
-
export type AgentServiceContract = {
|
|
45
|
+
export type AgentServiceContract<TContract extends VersionedArvoContract<any, any> = VersionedArvoContract<any, any>> = {
|
|
41
46
|
/** The Versioned Contract of the service the agent can call. */
|
|
42
|
-
contract:
|
|
47
|
+
contract: TContract;
|
|
43
48
|
/**
|
|
44
49
|
* Specific event domains to route the request to.
|
|
45
50
|
* Useful for distinguishing between event deliver channels (e.g. `human.interaction`).
|
|
@@ -48,16 +53,13 @@ export type AgentServiceContract = {
|
|
|
48
53
|
/**
|
|
49
54
|
* The execution priority of the tool (Default: 0).
|
|
50
55
|
*
|
|
51
|
-
*
|
|
52
|
-
* in a single turn,
|
|
56
|
+
* Enforces **Priority-Based Batch execution**. If the LLM generates multiple tool calls
|
|
57
|
+
* in a single turn, the actions manager will sort them by priority and **only execute the highest priority batch**.
|
|
53
58
|
* All lower priority tool calls in that turn are **dropped**.
|
|
54
59
|
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* This is critical for enforcing "Human-in-the-loop-first" or "Auth-first" workflows.
|
|
57
|
-
*
|
|
58
60
|
* @example
|
|
59
61
|
* **Scenario:** LLM wants to call `calculate_refund` (Priority 0) and `human_approval` (Priority 100) simultaneously.
|
|
60
|
-
* 1.
|
|
62
|
+
* 1. Actions manager sees both calls.
|
|
61
63
|
* 2. `human_approval` has higher priority.
|
|
62
64
|
* 3. Arvo emits `human_approval` event and drops `calculate_refund`.
|
|
63
65
|
* 4. Agent suspends.
|
|
@@ -65,6 +67,11 @@ export type AgentServiceContract = {
|
|
|
65
67
|
* 6. LLM sees approval, and *now* re-issues the `calculate_refund` call.
|
|
66
68
|
*/
|
|
67
69
|
priority?: number;
|
|
70
|
+
transformer?: AgentToolOutputTransformer<{
|
|
71
|
+
toolUseId: string;
|
|
72
|
+
type: string;
|
|
73
|
+
data: Record<string, any>;
|
|
74
|
+
}>;
|
|
68
75
|
};
|
|
69
76
|
/**
|
|
70
77
|
* Internal metadata used by the Agent Orchestrator to control execution strategy and flow.
|
|
@@ -99,13 +106,6 @@ export type AgentToolServerConfig<T> = {
|
|
|
99
106
|
};
|
|
100
107
|
/**
|
|
101
108
|
* The unified definition of a Tool as presented to the LLM Context.
|
|
102
|
-
*
|
|
103
|
-
* This type abstracts away the difference between:
|
|
104
|
-
* - **Arvo Services** (Async/Distributed)
|
|
105
|
-
* - **Internal Tools** (Sync/Local)
|
|
106
|
-
* - **MCP Tools** (External/Standardized)
|
|
107
|
-
*
|
|
108
|
-
* The Agent logic uses `serverConfig.kind` to determine execution strategy.
|
|
109
109
|
*/
|
|
110
110
|
export type AgentToolDefinition<T extends VersionedArvoContract<AnyArvoContract, ArvoSemanticVersion> | AgentInternalTool | null = null> = {
|
|
111
111
|
/** The function name the LLM sees (e.g., `service_calculator_add` or `internal_check_time`). */
|
|
@@ -153,33 +153,8 @@ export type AgentLLMContext<TServiceContract extends Record<string, AgentService
|
|
|
153
153
|
/**
|
|
154
154
|
* The "Context Engineering" Hook.
|
|
155
155
|
*
|
|
156
|
-
* This function executes **once** when a new Agent workflow is initialized.
|
|
157
|
-
* Its primary responsibility is to the context engineering for the agent.
|
|
158
|
-
*
|
|
159
|
-
* @remarks
|
|
160
|
-
* **Function Lifecycle:**
|
|
161
|
-
* 1. **Ingest:** Arvo receives an event matching your Contract's `init` schema.
|
|
162
|
-
* 2. **Transform:** This function transforms that typed data (e.g. `{ userId: "123", query: "help" }`)
|
|
163
|
-
* into the Agent's foundational state (System Prompt + Initial Message Thread).
|
|
164
|
-
* 3. **Persist:** The result is stored in `memory`. Future steps in this workflow (e.g. returning from tools)
|
|
165
|
-
* will simply append to this history, they will not run this builder again.
|
|
166
|
-
*
|
|
167
156
|
* @param param - Context parameters.
|
|
168
|
-
*
|
|
169
|
-
* @returns The initial state object containing the `system` string and `messages` array.
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```ts
|
|
173
|
-
* context: async ({ input, tools }) => ({
|
|
174
|
-
* // Dynamic System Prompt based on available tools
|
|
175
|
-
* system: `You are a helpful assistant. You have access to: ${Object.keys(tools.services).join(', ')}`,
|
|
176
|
-
*
|
|
177
|
-
* // Map the Event Data into the first User Message
|
|
178
|
-
* messages: [
|
|
179
|
-
* { role: 'user', content: { type: 'text', content: input.data.userQuery } }
|
|
180
|
-
* ]
|
|
181
|
-
* })
|
|
182
|
-
* ```
|
|
157
|
+
* @returns The initial context object containing the context data for the agent.
|
|
183
158
|
*/
|
|
184
159
|
export type AgentContextBuilder<T extends AnyArvoOrchestratorContract = AnyArvoOrchestratorContract, V extends ArvoSemanticVersion = ArvoSemanticVersion, TServiceContract extends Record<string, AgentServiceContract> = Record<string, AgentServiceContract>, TTools extends Record<string, AgentInternalTool> = Record<string, AgentInternalTool>> = (param: {
|
|
185
160
|
lifecycle: AgentLLMIntegrationParam['lifecycle'];
|
|
@@ -191,7 +166,9 @@ export type AgentContextBuilder<T extends AnyArvoOrchestratorContract = AnyArvoO
|
|
|
191
166
|
tools: AgentLLMContext<TServiceContract, TTools>['tools'];
|
|
192
167
|
/** The Otel span to add logs to */
|
|
193
168
|
span: Span;
|
|
194
|
-
}) => PromiseAble<Partial<Pick<AgentLLMContext<TServiceContract>, 'messages' | 'system'
|
|
169
|
+
}) => PromiseAble<Partial<Pick<AgentLLMContext<TServiceContract>, 'messages' | 'system'> & {
|
|
170
|
+
enabledTools: Record<string, boolean>;
|
|
171
|
+
}> | void>;
|
|
195
172
|
/**
|
|
196
173
|
* The "Output Validation" Hook.
|
|
197
174
|
*
|
|
@@ -213,6 +190,126 @@ export type AgentOutputBuilder<T extends AnyArvoOrchestratorContract = AnyArvoOr
|
|
|
213
190
|
} | {
|
|
214
191
|
error: Error;
|
|
215
192
|
}>;
|
|
193
|
+
/**
|
|
194
|
+
* Hook executed before the inference request is sent to the LLM integration.
|
|
195
|
+
*
|
|
196
|
+
* @param param.system - The current system prompt being sent to the LLM.
|
|
197
|
+
* @param param.messages - The full message history being sent for inference.
|
|
198
|
+
* @param param.tools - The tool definitions available to the LLM for this inference.
|
|
199
|
+
* @param param.span - The current OTEL span
|
|
200
|
+
* @param param.agentCycles - The current agent cycle configuration
|
|
201
|
+
* @param param.tokenUsage - The current token usage of the agent
|
|
202
|
+
*
|
|
203
|
+
* @returns
|
|
204
|
+
* - `AgentMessage[]`: The transformed messages to use instead of the original.
|
|
205
|
+
* - `undefined`: Use the original messages without modification.
|
|
206
|
+
*/
|
|
207
|
+
export type PreInferenceHook = (param: {
|
|
208
|
+
system: string | null;
|
|
209
|
+
messages: AgentMessage[];
|
|
210
|
+
tools: AgentToolDefinition[];
|
|
211
|
+
span: Span;
|
|
212
|
+
agentCycles: {
|
|
213
|
+
current: number;
|
|
214
|
+
max: number;
|
|
215
|
+
exhausted: boolean;
|
|
216
|
+
};
|
|
217
|
+
tokenUsage: {
|
|
218
|
+
prompt: number;
|
|
219
|
+
completion: number;
|
|
220
|
+
};
|
|
221
|
+
}) => PromiseAble<AgentMessage[] | void>;
|
|
222
|
+
/**
|
|
223
|
+
* Hook executed immediately after the LLM integration returns its output.
|
|
224
|
+
*
|
|
225
|
+
* @param param.inference - The output returned from the LLM integration.
|
|
226
|
+
* @param param.span - The current OTEL span
|
|
227
|
+
* @param param.agentCycles - The current agent cycle configuration
|
|
228
|
+
* @param param.tokenUsage - The current token usage of the agent
|
|
229
|
+
*
|
|
230
|
+
* @returns
|
|
231
|
+
* - `{action: 'RETRY'}`: Discard the current response and re-invoke inference.
|
|
232
|
+
* The retry increments the tool interaction counter by 1. Be mindful of the
|
|
233
|
+
* `maxToolInteractions` limit to prevent infinite retry loops.
|
|
234
|
+
* - `{action: 'CIRCUIT_BREAK', error: Error}`: Act as a circuit breaker, causing
|
|
235
|
+
* the agent to emit a system error for upstream systems. If the error is a
|
|
236
|
+
* `ViolationError`, it is thrown as a violation error.
|
|
237
|
+
* - `undefined`: Continue with normal execution.
|
|
238
|
+
*/
|
|
239
|
+
export type PostInferenceHook = (param: {
|
|
240
|
+
inference: AgentLLMIntegrationOutput;
|
|
241
|
+
span: Span;
|
|
242
|
+
agentCycles: {
|
|
243
|
+
current: number;
|
|
244
|
+
max: number;
|
|
245
|
+
exhausted: boolean;
|
|
246
|
+
};
|
|
247
|
+
tokenUsage: {
|
|
248
|
+
prompt: number;
|
|
249
|
+
completion: number;
|
|
250
|
+
};
|
|
251
|
+
}) => PromiseAble<{
|
|
252
|
+
action: 'RETRY';
|
|
253
|
+
} | {
|
|
254
|
+
action: 'CIRCUIT_BREAK';
|
|
255
|
+
error: Error;
|
|
256
|
+
} | void>;
|
|
257
|
+
export type AgentInferenceConfiguration = {
|
|
258
|
+
/**
|
|
259
|
+
* The LLM integration function connecting the agent to its reasoning engine.
|
|
260
|
+
* Individual versions can override this to use different models per version.
|
|
261
|
+
*/
|
|
262
|
+
llm: AgentLLMIntegration;
|
|
263
|
+
/**
|
|
264
|
+
* The agent output type configuration.
|
|
265
|
+
*
|
|
266
|
+
* - `'text'`: Standard conversational response.
|
|
267
|
+
* - `'json'`: Structured Output / JSON Mode (validated against the contract's output schema).
|
|
268
|
+
*
|
|
269
|
+
* Individual versions can override this via their handler configuration,
|
|
270
|
+
* enabling progressive migration from text to structured outputs.
|
|
271
|
+
* @defaultValue 'text'
|
|
272
|
+
*/
|
|
273
|
+
responseType?: AgentLLMIntegrationParam['outputFormat']['type'];
|
|
274
|
+
/**
|
|
275
|
+
* Optional lifecycle hooks for intercepting and customizing the inference pipeline.
|
|
276
|
+
*
|
|
277
|
+
* These hooks allow fine-grained control over the LLM request/response cycle,
|
|
278
|
+
* enabling patterns like message transformation, retry logic, and circuit breaking.
|
|
279
|
+
*/
|
|
280
|
+
hooks?: Partial<{
|
|
281
|
+
/**
|
|
282
|
+
* Hook executed before the inference request is sent to the LLM integration.
|
|
283
|
+
*
|
|
284
|
+
* Use this hook to intercept and transform the conversation context before it reaches
|
|
285
|
+
* the model. Common use cases include:
|
|
286
|
+
* - Filtering or redacting sensitive information from messages
|
|
287
|
+
* - Injecting dynamic context or instructions based on runtime conditions
|
|
288
|
+
* - Implementing message compression or summarization strategies
|
|
289
|
+
* - Adding custom prefixes/suffixes to the conversation
|
|
290
|
+
*
|
|
291
|
+
* See {@link PreInferenceHook} for more information.
|
|
292
|
+
*
|
|
293
|
+
* @note The returned messages become part of the agent state and persist for subsequent turns.
|
|
294
|
+
* All errors thrown are quietly swallowed. They will only be logged to span events.
|
|
295
|
+
*/
|
|
296
|
+
preInference: PreInferenceHook;
|
|
297
|
+
/**
|
|
298
|
+
* Hook executed immediately after the LLM integration returns its output.
|
|
299
|
+
*
|
|
300
|
+
* Use this hook to inspect and react to the LLM response before it is processed.
|
|
301
|
+
* Common use cases include:
|
|
302
|
+
* - Implementing self-correction loops by retrying on invalid outputs
|
|
303
|
+
* - Circuit breaking on critical errors or policy violations
|
|
304
|
+
* - Validating response quality or safety before proceeding
|
|
305
|
+
*
|
|
306
|
+
* See {@link PostInferenceHook} for more information.
|
|
307
|
+
*
|
|
308
|
+
* @note All errors thrown are quietly swallowed. They will only be logged to span events.
|
|
309
|
+
*/
|
|
310
|
+
postInference: PostInferenceHook;
|
|
311
|
+
}>;
|
|
312
|
+
};
|
|
216
313
|
/**
|
|
217
314
|
* Configuration object for instantiating a new Arvo Agent.
|
|
218
315
|
*
|
|
@@ -258,12 +355,12 @@ export type CreateArvoAgentParam<TSelfContract extends AnyArvoOrchestratorContra
|
|
|
258
355
|
*/
|
|
259
356
|
memory?: IMachineMemory<Record<string, unknown>>;
|
|
260
357
|
/**
|
|
261
|
-
* The maximum number of
|
|
358
|
+
* The maximum number of agentic-execution cycles allowed for a single workflow instance.
|
|
262
359
|
* Prevents the Agent from getting stuck in infinite reasoning loops or burning excessive tokens.
|
|
263
360
|
*
|
|
264
361
|
* @defaultValue 5
|
|
265
362
|
*/
|
|
266
|
-
|
|
363
|
+
maxAgentCycles?: number;
|
|
267
364
|
/**
|
|
268
365
|
* An optional Model Context Protocol (MCP) client.
|
|
269
366
|
* Gives the agent standardized access to external data sources (Filesystems, GitHub, Databases)
|
|
@@ -271,32 +368,25 @@ export type CreateArvoAgentParam<TSelfContract extends AnyArvoOrchestratorContra
|
|
|
271
368
|
*/
|
|
272
369
|
mcp?: IMCPClient;
|
|
273
370
|
/**
|
|
274
|
-
* Internal tools executed
|
|
371
|
+
* Internal tools executed within the agent's process.
|
|
275
372
|
*
|
|
276
373
|
* Best suited for lightweight operations.
|
|
277
374
|
* Internal tools should complete in milliseconds. For operations requiring
|
|
278
|
-
*
|
|
279
|
-
* to avoid blocking the agent's execution.
|
|
375
|
+
* extended computation use Arvo services to avoid blocking the agent's execution.
|
|
280
376
|
*
|
|
281
|
-
* Each tool is created via
|
|
377
|
+
* Each tool is created via {@link createAgentTool} which adds automatic
|
|
282
378
|
* input validation and OpenTelemetry instrumentation.
|
|
283
379
|
*/
|
|
284
380
|
tools?: TTools;
|
|
285
381
|
/**
|
|
286
|
-
* The default
|
|
287
|
-
* - `'text'`: Standard conversational response.
|
|
288
|
-
* - `'json'`: Structured Output / JSON Mode (validated against the contract's output schema).
|
|
382
|
+
* The default inference configuration applied to all agent versions.
|
|
289
383
|
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
|
|
294
|
-
llmResponseType?: AgentLLMIntegrationParam['outputFormat']['type'];
|
|
295
|
-
/**
|
|
296
|
-
* Default LLM integration function connecting the agent to its reasoning engine.
|
|
297
|
-
* Individual versions can override this to use different models per version.
|
|
384
|
+
* Defines the LLM integration, response type, and lifecycle hooks used
|
|
385
|
+
* unless overridden by a specific version's `inferenceConfig`.
|
|
386
|
+
*
|
|
387
|
+
* See {@link AgentInferenceConfiguration} for available options.
|
|
298
388
|
*/
|
|
299
|
-
|
|
389
|
+
inferenceConfig: AgentInferenceConfiguration;
|
|
300
390
|
/**
|
|
301
391
|
* Optional event stream listener for real-time agent activity monitoring.
|
|
302
392
|
*
|
|
@@ -354,33 +444,31 @@ export type CreateArvoAgentParam<TSelfContract extends AnyArvoOrchestratorContra
|
|
|
354
444
|
*/
|
|
355
445
|
explicitPermissionRequired?: (tools: AgentLLMContext<TServiceContract, TTools>['tools']) => PromiseAble<string[]>;
|
|
356
446
|
/**
|
|
357
|
-
* Version-specific
|
|
358
|
-
*
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
*
|
|
363
|
-
* Overrides the agent-level `llm` default for this version only.
|
|
364
|
-
* Enables model evolution across versions.
|
|
365
|
-
* Each version can use completely different models or providers without
|
|
366
|
-
* affecting other versions or requiring code changes in consumers.
|
|
447
|
+
* Version-specific overrides for the inference configuration.
|
|
448
|
+
*
|
|
449
|
+
* Allows this version to use different settings than the agent-level defaults,
|
|
450
|
+
* such as a different LLM, response type, or lifecycle hooks.
|
|
451
|
+
*
|
|
452
|
+
* See {@link AgentInferenceConfiguration} for available options.
|
|
367
453
|
*/
|
|
368
|
-
|
|
454
|
+
inferenceConfig?: Partial<AgentInferenceConfiguration>;
|
|
369
455
|
/**
|
|
370
|
-
* Context
|
|
456
|
+
* The "Context Engineering" Hook.
|
|
371
457
|
*
|
|
372
|
-
*
|
|
458
|
+
* Executes once during agent initialization to transform the input event
|
|
459
|
+
* into the agent's foundational context:
|
|
373
460
|
* - System prompt defining the agent's role and capabilities
|
|
374
461
|
* - Initial message history seeding the conversation
|
|
462
|
+
* - Optional tool enablement map (tools are enabled by default)
|
|
375
463
|
*
|
|
376
464
|
* The returned context persists in memory and forms the base that all
|
|
377
|
-
* subsequent tool results and LLM responses append to.
|
|
378
|
-
*
|
|
379
|
-
*
|
|
465
|
+
* subsequent tool results and LLM responses append to.
|
|
466
|
+
*
|
|
467
|
+
* See {@link AgentContextBuilder} for more information.
|
|
380
468
|
*
|
|
381
469
|
* @example
|
|
382
470
|
* ```typescript
|
|
383
|
-
* context: async ({ input, tools
|
|
471
|
+
* context: async ({ input, tools }) => ({
|
|
384
472
|
* system: `You are a customer support agent. Available tools:
|
|
385
473
|
* - ${tools.services.billing.name}: Access billing data
|
|
386
474
|
* - ${tools.services.ticketing.name}: Create support tickets`,
|
|
@@ -390,7 +478,10 @@ export type CreateArvoAgentParam<TSelfContract extends AnyArvoOrchestratorContra
|
|
|
390
478
|
* content: { type: 'text', content: input.data.customerQuery },
|
|
391
479
|
* seenCount: 0
|
|
392
480
|
* }
|
|
393
|
-
* ]
|
|
481
|
+
* ],
|
|
482
|
+
* enabledTools: {
|
|
483
|
+
* [tools.services.billing.name]: input.data.isBillingOnly
|
|
484
|
+
* }
|
|
394
485
|
* })
|
|
395
486
|
* ```
|
|
396
487
|
*/
|
|
@@ -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,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
|
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,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAA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arded.
|
|
74
74
|
*/
|
|
75
75
|
export declare const prioritizeToolCalls: (toolCalls: Omit<AgentToolCallContent, "type">[], nameToToolMap: Record<string, AgentToolDefinition>) => Omit<AgentToolCallContent, "type">[];
|
|
76
|
+
/**
|
|
77
|
+
* Apply the enablement on the available tools. By default
|
|
78
|
+
* all the tools are enabled. Tools are removed only when they
|
|
79
|
+
* are explicitly marked as false
|
|
80
|
+
*/
|
|
81
|
+
export declare const applyToolEnablement: (tools: AgentToolDefinition[], toolEnablementMap: Record<string, boolean>) => AgentToolDefinition[];
|
|
76
82
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GACzC,gBAAgB,SAAS,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAE7D,UAAU,gBAAgB,KAiCQ,GAC/B,CAAC,IAAI,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,GAEtF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,KAAK,UAAU,GAAG,IAAI,EACtB,QAAQ;IAAE,QAAQ,EAAE,YAAY,CA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,EAAE,mBAAmB,CAAC,KACjD,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAWpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,mBAAmB,EAAE,EAC5B,mBAAmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzC,mBAAmB,EAErB,CAAC"}
|
package/dist/Agent/utils.js
CHANGED
|
@@ -85,7 +85,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
85
85
|
return ar;
|
|
86
86
|
};
|
|
87
87
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
-
exports.prioritizeToolCalls = exports.tryParseJson = exports.setOpenInferenceResponseOutputAttr = exports.setOpenInferenceUsageOutputAttr = exports.setOpenInferenceToolCallOutputAttr = exports.setOpenInferenceInputAttr = exports.clampStr = exports.generateAgentInternalToolDefinitions = exports.generateMcpToolDefinitions = exports.generateServiceToolDefinitions = void 0;
|
|
88
|
+
exports.applyToolEnablement = exports.prioritizeToolCalls = exports.tryParseJson = exports.setOpenInferenceResponseOutputAttr = exports.setOpenInferenceUsageOutputAttr = exports.setOpenInferenceToolCallOutputAttr = exports.setOpenInferenceInputAttr = exports.clampStr = exports.generateAgentInternalToolDefinitions = exports.generateMcpToolDefinitions = exports.generateServiceToolDefinitions = void 0;
|
|
89
89
|
var openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
|
|
90
90
|
var zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
91
91
|
/**
|
|
@@ -388,4 +388,13 @@ var prioritizeToolCalls = function (toolCalls, nameToToolMap) {
|
|
|
388
388
|
return (_f = grouped.get(highestPriority)) !== null && _f !== void 0 ? _f : [];
|
|
389
389
|
};
|
|
390
390
|
exports.prioritizeToolCalls = prioritizeToolCalls;
|
|
391
|
+
/**
|
|
392
|
+
* Apply the enablement on the available tools. By default
|
|
393
|
+
* all the tools are enabled. Tools are removed only when they
|
|
394
|
+
* are explicitly marked as false
|
|
395
|
+
*/
|
|
396
|
+
var applyToolEnablement = function (tools, toolEnablementMap) {
|
|
397
|
+
return tools.filter(function (tool) { var _a; return (_a = toolEnablementMap[tool.name]) !== null && _a !== void 0 ? _a : true; });
|
|
398
|
+
};
|
|
399
|
+
exports.applyToolEnablement = applyToolEnablement;
|
|
391
400
|
//# sourceMappingURL=utils.js.map
|
package/dist/Agent/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Agent/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAsH;AAGtH,yDAAqD;AAarD;;;;;GAKG;AACI,IAAM,8BAA8B,GAAG,UAG5C,QAA0B;;;IAE1B,IAAM,YAAY,GAGd,EAAE,CAAC;;QACP,KAA2B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE,CAAC;YAA3C,IAAA,KAAA,mBAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YACpB,IAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;YACjE,iHAAiH;YACjH,IAAM,KACJ,WAAW,IAAI,YAAY,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU;gBAClE,CAAC,CAAC,WAAW,CAAC,UAAU;gBACxB,CAAC,CAAC,EAAE,EAHA,eAAe,qBAAA,EAAK,iBAAiB,cAAvC,mBAAyC,CAGvC,CAAC;YACT,IAAM,eAAe,GAAG,CACtB,WAAW,IAAI,UAAU,IAAI,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAC7F,CAAC,MAAM,CAAC,UAAC,IAAY,IAAK,OAA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AAa,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,YAAY,CAAC,QAAQ,mCAAI,CAAC,CAAC;YACzE,IAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAC;YAC7C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;;;;;;;;;IACD,IAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,GAAG,CAAC,EAAL,CAAK,CAAC,CAAC;IACpE,IAAM,eAAe,GAAG,MAAA,UAAU,CAAC,CAAC,CAAC,mCAAI,CAAC,CAAC;IAC3C,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,mCAAI,EAAE,CAAC;AAC5C,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B;AAEF;;;;GAIG;AACI,IAAM,mBAAmB,GAAG,UACjC,KAA4B,EAC5B,iBAA0C;IAE1C,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,YAAK,OAAA,MAAA,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAA,EAAA,CAAC,CAAC;AACtE,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}
|
|
@@ -21,10 +21,9 @@ import type { AgentInternalTool } from './types';
|
|
|
21
21
|
* name: 'get_time',
|
|
22
22
|
* description: 'Returns current server time',
|
|
23
23
|
* input: z.object({}),
|
|
24
|
-
*
|
|
25
|
-
* fn: () => ({ time: new Date().toISOString() })
|
|
24
|
+
* fn: () => {...}
|
|
26
25
|
* });
|
|
27
26
|
* ```
|
|
28
27
|
*/
|
|
29
|
-
export declare const createAgentTool: <TInputSchema extends z.ZodTypeAny
|
|
28
|
+
export declare const createAgentTool: <TInputSchema extends z.ZodTypeAny>(param: AgentInternalTool<TInputSchema>) => AgentInternalTool<TInputSchema>;
|
|
30
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,qBAAqB,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,SAAS,CAAC,CAAC,UAAU,EAC/D,OAAO,iBAAiB,CAAC,YAAY,CAAC,KAyDhC,iBAAiB,CAAC,YAAY,CAAC,CAAC"}
|
package/dist/AgentTool/index.js
CHANGED
|
@@ -72,8 +72,7 @@ var arvo_core_1 = require("arvo-core");
|
|
|
72
72
|
* name: 'get_time',
|
|
73
73
|
* description: 'Returns current server time',
|
|
74
74
|
* input: z.object({}),
|
|
75
|
-
*
|
|
76
|
-
* fn: () => ({ time: new Date().toISOString() })
|
|
75
|
+
* fn: () => {...}
|
|
77
76
|
* });
|
|
78
77
|
* ```
|
|
79
78
|
*/
|
|
@@ -96,10 +95,11 @@ var createAgentTool = function (param) {
|
|
|
96
95
|
},
|
|
97
96
|
fn: function (span) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
97
|
var inputValidation, result, err_1;
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
var _a;
|
|
99
|
+
return __generator(this, function (_b) {
|
|
100
|
+
switch (_b.label) {
|
|
101
101
|
case 0:
|
|
102
|
-
|
|
102
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
103
103
|
span.setAttribute(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_NAME, param.name);
|
|
104
104
|
span.setAttribute(openinference_semantic_conventions_1.SemanticConventions.TOOL_CALL_FUNCTION_ARGUMENTS_JSON, JSON.stringify(input));
|
|
105
105
|
span.setAttribute(openinference_semantic_conventions_1.SemanticConventions.INPUT_VALUE, JSON.stringify(input));
|
|
@@ -111,13 +111,17 @@ var createAgentTool = function (param) {
|
|
|
111
111
|
span: span,
|
|
112
112
|
headers: (0, arvo_core_1.getOtelHeaderFromSpan)(span),
|
|
113
113
|
},
|
|
114
|
+
toolUseId: config.toolUseId,
|
|
114
115
|
})];
|
|
115
116
|
case 1:
|
|
116
|
-
result = _a.sent();
|
|
117
|
+
result = (_a = (_b.sent())) !== null && _a !== void 0 ? _a : null;
|
|
118
|
+
if (result === null) {
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
}
|
|
117
121
|
span.setAttribute(openinference_semantic_conventions_1.SemanticConventions.OUTPUT_VALUE, JSON.stringify(result));
|
|
118
122
|
return [2 /*return*/, result];
|
|
119
123
|
case 2:
|
|
120
|
-
err_1 =
|
|
124
|
+
err_1 = _b.sent();
|
|
121
125
|
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: err_1 === null || err_1 === void 0 ? void 0 : err_1.message });
|
|
122
126
|
throw err_1;
|
|
123
127
|
case 3:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAGqD;AACrD,0CAAoD;AACpD,uCAAqE;AAKrE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AgentTool/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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iCAAqB,EAAC,IAAI,CAAC;qDACrC;oDACD,SAAS,EAAE,MAAM,CAAC,SAAS;iDAC5B,CAAC,EAAA;;4CAPE,MAAM,GACV,MAAA,CAAC,SAMC,CAAC,mCAAI,IAAI;4CACb,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gDACpB,sBAAO;4CACT,CAAC;4CACD,IAAI,CAAC,YAAY,CACf,wDAAgC,CAAC,YAAY,EAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACvB,CAAC;4CACF,sBAAO,MAAM,EAAC;;;4CAEd,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,oBAAc,CAAC,KAAK,EAAE,OAAO,EAAG,KAAa,aAAb,KAAG,uBAAH,KAAG,CAAY,OAAO,EAAE,CAAC,CAAC;4CACjF,MAAM,KAAG,CAAC;;4CAEV,IAAI,CAAC,GAAG,EAAE,CAAC;;;;;iCAEd;yBACF,CAAC,EAAA;4BAhDF,sBAAA,SAgDE,EAAA;;;aAAA,IAC+B;AAvDrC,CAuDqC,CAAC;AA1D3B,QAAA,eAAe,mBA0DY"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type z from 'zod';
|
|
2
|
+
import type { AgentMessage, AgentToolResultContent } from '../Agent/types';
|
|
2
3
|
import type { OtelInfoType, PromiseAble } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Defines the structure of a **Synchronous Internal Tool**.
|
|
@@ -15,7 +16,7 @@ import type { OtelInfoType, PromiseAble } from '../types';
|
|
|
15
16
|
* - Use for **Read-only** operations that don't require distributed consensus.
|
|
16
17
|
* - Do **not** use for long-running tasks, as this blocks the Agent execution.
|
|
17
18
|
*/
|
|
18
|
-
export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any
|
|
19
|
+
export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any> = {
|
|
19
20
|
/**
|
|
20
21
|
* The unique identifier for this tool (e.g. `calculator`, `get_current_time`).
|
|
21
22
|
* This name is injected into the LLM's system prompt.
|
|
@@ -32,11 +33,6 @@ export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any, TOutputSc
|
|
|
32
33
|
* Arvo automatically validates the LLM's JSON output against this schema before calling `fn`.
|
|
33
34
|
*/
|
|
34
35
|
input: TInputSchema;
|
|
35
|
-
/**
|
|
36
|
-
* Zod Schema defining what this tool returns.
|
|
37
|
-
* Used for type inference and documentation, though runtime validation of the result is optional.
|
|
38
|
-
*/
|
|
39
|
-
output: TOutputSchema;
|
|
40
36
|
/**
|
|
41
37
|
* If the LLM attempts to call multiple tools in parallel (e.g. `delete_user` + `human_approval`),
|
|
42
38
|
* Arvo sorts calls by priority and **only executes the highest priority batch**.
|
|
@@ -49,11 +45,33 @@ export type AgentInternalTool<TInputSchema extends z.ZodTypeAny = any, TOutputSc
|
|
|
49
45
|
* The implementation logic.
|
|
50
46
|
*
|
|
51
47
|
* @param input - The validated arguments matching `TInputSchema`. You do not need to re-validate.
|
|
52
|
-
* @param config - Observability context (Span/Headers) to link any internal logging or network calls
|
|
53
|
-
*
|
|
48
|
+
* @param config - Observability context (Span/Headers) to link any internal logging or network calls,
|
|
49
|
+
* plus the `toolUseId` for correlation.
|
|
50
|
+
* @returns One of three forms:
|
|
51
|
+
* - `{ messages }` — Provide full control over the tool result message(s) sent back to the LLM.
|
|
52
|
+
* Can be a single user message or a tuple starting with a user message followed by additional agent messages.
|
|
53
|
+
* Use this to supply multimedia data from as user message
|
|
54
|
+
* - `{ data }` — A simple key-value object that Arvo automatically wraps into a tool result content block.
|
|
55
|
+
* - `void` — Return nothing; Arvo treats this as a successful no-op (useful for side-effect-only tools).
|
|
54
56
|
*/
|
|
55
57
|
fn: (input: z.infer<TInputSchema>, config: {
|
|
56
58
|
otelInfo: OtelInfoType;
|
|
57
|
-
|
|
59
|
+
toolUseId: string;
|
|
60
|
+
}) => PromiseAble<{
|
|
61
|
+
messages: {
|
|
62
|
+
role: 'user';
|
|
63
|
+
seenCount: number;
|
|
64
|
+
content: AgentToolResultContent;
|
|
65
|
+
} | [
|
|
66
|
+
{
|
|
67
|
+
role: 'user';
|
|
68
|
+
seenCount: number;
|
|
69
|
+
content: AgentToolResultContent;
|
|
70
|
+
},
|
|
71
|
+
...AgentMessage[]
|
|
72
|
+
];
|
|
73
|
+
} | {
|
|
74
|
+
data: Record<string, any>;
|
|
75
|
+
} | void>;
|
|
58
76
|
};
|
|
59
77
|
//# sourceMappingURL=types.d.ts.map
|