@toolpack-sdk/agents 2.0.0-alpha.1 → 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/README.md +9 -3
- package/dist/{base-agent-Cx2kWzLF.d.ts → base-agent-DPdK4Pnl.d.cts} +100 -5
- package/dist/{base-agent-CjrUlo6Y.d.cts → base-agent-nU8pr4nu.d.ts} +100 -5
- package/dist/capabilities/index.cjs +19 -14
- package/dist/capabilities/index.d.cts +4 -3
- package/dist/capabilities/index.d.ts +4 -3
- package/dist/capabilities/index.js +19 -14
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.d.cts +3 -615
- package/dist/channels/index.d.ts +3 -615
- package/dist/channels/index.js +2 -2
- package/dist/index-Du6S0eG7.d.cts +927 -0
- package/dist/index-o8Lbzv5N.d.ts +927 -0
- package/dist/index.cjs +111 -12
- package/dist/index.d.cts +71 -8
- package/dist/index.d.ts +71 -8
- package/dist/index.js +111 -12
- package/dist/{intent-classifier-agent-BLpDwKVf.d.ts → intent-classifier-agent-0JZDlhpk.d.ts} +2 -2
- package/dist/{intent-classifier-agent-BLXXcbNJ.d.cts → intent-classifier-agent-DxyfJWcm.d.cts} +2 -2
- package/dist/interceptors/index.d.cts +5 -4
- package/dist/interceptors/index.d.ts +5 -4
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/{types-BWoRx1ZE.d.cts → types-TB6yypig.d.cts} +38 -1
- package/dist/{types-BWoRx1ZE.d.ts → types-TB6yypig.d.ts} +38 -1
- package/package.json +5 -5
|
@@ -122,6 +122,36 @@ type BaseAgentOptions = {
|
|
|
122
122
|
} | {
|
|
123
123
|
toolpack: Toolpack;
|
|
124
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Configuration for AI-driven agent delegation.
|
|
127
|
+
* When enabled, a delegation tool is injected into every `run()` call
|
|
128
|
+
* so the LLM can decide which peer agent to hand the task to.
|
|
129
|
+
*/
|
|
130
|
+
interface AgentDelegationConfig {
|
|
131
|
+
/** Must be true for the delegation tool to be injected. */
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Restrict which peer agents can be delegated to.
|
|
135
|
+
* When set, only the named agents appear in the tool's enum.
|
|
136
|
+
* When omitted, all peers in the registry are available.
|
|
137
|
+
*/
|
|
138
|
+
allowedAgents?: string[];
|
|
139
|
+
/**
|
|
140
|
+
* Delegation mode.
|
|
141
|
+
*
|
|
142
|
+
* - `'await'` (default) — injects `delegate_to_agent`: calls the sub-agent,
|
|
143
|
+
* waits for its result, and returns it to the LLM. Use when the orchestrator
|
|
144
|
+
* needs to relay or act on the sub-agent's response.
|
|
145
|
+
*
|
|
146
|
+
* - `'forget'` — injects `delegate_and_forget`: fires the sub-agent without
|
|
147
|
+
* waiting for its result and returns `{ status: 'delegated' }` immediately.
|
|
148
|
+
* Use when sub-agents handle their own delivery via tools (e.g. posting to
|
|
149
|
+
* Slack or GitHub directly) and the orchestrator has nothing to relay.
|
|
150
|
+
* The LLM naturally outputs an empty string, eliminating any need for
|
|
151
|
+
* post-run result extraction.
|
|
152
|
+
*/
|
|
153
|
+
mode?: 'await' | 'forget';
|
|
154
|
+
}
|
|
125
155
|
/**
|
|
126
156
|
* Input structure for agent invocation.
|
|
127
157
|
* Channels normalize external events into this format.
|
|
@@ -188,6 +218,13 @@ interface AgentOutput {
|
|
|
188
218
|
interface AgentRunOptions {
|
|
189
219
|
/** One-off workflow override for this specific run */
|
|
190
220
|
workflow?: Record<string, unknown>;
|
|
221
|
+
/**
|
|
222
|
+
* Hard cap on tool-call rounds for this specific run.
|
|
223
|
+
* Overrides ToolsConfig.maxToolRounds and bypasses the query-classifier
|
|
224
|
+
* adjustment. Use this for agents that should only make one tool call
|
|
225
|
+
* per invocation (e.g. single-shot routers using delegate_to_agent).
|
|
226
|
+
*/
|
|
227
|
+
maxToolRounds?: number;
|
|
191
228
|
}
|
|
192
229
|
/**
|
|
193
230
|
* Agent instance interface - shape of a BaseAgent instance.
|
|
@@ -392,4 +429,4 @@ interface IAgentRegistry {
|
|
|
392
429
|
cleanupExpiredAsks(): number;
|
|
393
430
|
}
|
|
394
431
|
|
|
395
|
-
export { type AgentInput as A, type BaseAgentOptions as B, type ChannelInterface as C, type Interceptor as I, type NextFunction as N, type PendingAsk as P, SKIP_SENTINEL as S, type WorkflowStep as W, type AgentResult as a, type
|
|
432
|
+
export { type AgentInput as A, type BaseAgentOptions as B, type ChannelInterface as C, type Interceptor as I, type NextFunction as N, type PendingAsk as P, SKIP_SENTINEL as S, type WorkflowStep as W, type AgentResult as a, type AgentDelegationConfig as b, type IAgentRegistry as c, type AgentRunOptions as d, type AgentOutput as e, type AgentInstance as f, type InterceptorChainConfig as g, type InterceptorContext as h, type InterceptorResult as i, isSkipSentinel as j, skip as s };
|
|
@@ -122,6 +122,36 @@ type BaseAgentOptions = {
|
|
|
122
122
|
} | {
|
|
123
123
|
toolpack: Toolpack;
|
|
124
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Configuration for AI-driven agent delegation.
|
|
127
|
+
* When enabled, a delegation tool is injected into every `run()` call
|
|
128
|
+
* so the LLM can decide which peer agent to hand the task to.
|
|
129
|
+
*/
|
|
130
|
+
interface AgentDelegationConfig {
|
|
131
|
+
/** Must be true for the delegation tool to be injected. */
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Restrict which peer agents can be delegated to.
|
|
135
|
+
* When set, only the named agents appear in the tool's enum.
|
|
136
|
+
* When omitted, all peers in the registry are available.
|
|
137
|
+
*/
|
|
138
|
+
allowedAgents?: string[];
|
|
139
|
+
/**
|
|
140
|
+
* Delegation mode.
|
|
141
|
+
*
|
|
142
|
+
* - `'await'` (default) — injects `delegate_to_agent`: calls the sub-agent,
|
|
143
|
+
* waits for its result, and returns it to the LLM. Use when the orchestrator
|
|
144
|
+
* needs to relay or act on the sub-agent's response.
|
|
145
|
+
*
|
|
146
|
+
* - `'forget'` — injects `delegate_and_forget`: fires the sub-agent without
|
|
147
|
+
* waiting for its result and returns `{ status: 'delegated' }` immediately.
|
|
148
|
+
* Use when sub-agents handle their own delivery via tools (e.g. posting to
|
|
149
|
+
* Slack or GitHub directly) and the orchestrator has nothing to relay.
|
|
150
|
+
* The LLM naturally outputs an empty string, eliminating any need for
|
|
151
|
+
* post-run result extraction.
|
|
152
|
+
*/
|
|
153
|
+
mode?: 'await' | 'forget';
|
|
154
|
+
}
|
|
125
155
|
/**
|
|
126
156
|
* Input structure for agent invocation.
|
|
127
157
|
* Channels normalize external events into this format.
|
|
@@ -188,6 +218,13 @@ interface AgentOutput {
|
|
|
188
218
|
interface AgentRunOptions {
|
|
189
219
|
/** One-off workflow override for this specific run */
|
|
190
220
|
workflow?: Record<string, unknown>;
|
|
221
|
+
/**
|
|
222
|
+
* Hard cap on tool-call rounds for this specific run.
|
|
223
|
+
* Overrides ToolsConfig.maxToolRounds and bypasses the query-classifier
|
|
224
|
+
* adjustment. Use this for agents that should only make one tool call
|
|
225
|
+
* per invocation (e.g. single-shot routers using delegate_to_agent).
|
|
226
|
+
*/
|
|
227
|
+
maxToolRounds?: number;
|
|
191
228
|
}
|
|
192
229
|
/**
|
|
193
230
|
* Agent instance interface - shape of a BaseAgent instance.
|
|
@@ -392,4 +429,4 @@ interface IAgentRegistry {
|
|
|
392
429
|
cleanupExpiredAsks(): number;
|
|
393
430
|
}
|
|
394
431
|
|
|
395
|
-
export { type AgentInput as A, type BaseAgentOptions as B, type ChannelInterface as C, type Interceptor as I, type NextFunction as N, type PendingAsk as P, SKIP_SENTINEL as S, type WorkflowStep as W, type AgentResult as a, type
|
|
432
|
+
export { type AgentInput as A, type BaseAgentOptions as B, type ChannelInterface as C, type Interceptor as I, type NextFunction as N, type PendingAsk as P, SKIP_SENTINEL as S, type WorkflowStep as W, type AgentResult as a, type AgentDelegationConfig as b, type IAgentRegistry as c, type AgentRunOptions as d, type AgentOutput as e, type AgentInstance as f, type InterceptorChainConfig as g, type InterceptorContext as h, type InterceptorResult as i, isSkipSentinel as j, skip as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolpack-sdk/agents",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Agent layer for the Toolpack SDK - build, compose, and deploy AI agents with a consistent, extensible pattern",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"README.md"
|
|
47
47
|
],
|
|
48
48
|
"publishConfig": {
|
|
49
|
-
"tag": "
|
|
49
|
+
"tag": "latest",
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"url": "https://github.com/toolpack-ai/toolpack-sdk/issues"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@toolpack-sdk/knowledge": "^2.0.0
|
|
87
|
-
"better-sqlite3": "^
|
|
86
|
+
"@toolpack-sdk/knowledge": "^2.0.0",
|
|
87
|
+
"better-sqlite3": "^12.6.2",
|
|
88
88
|
"discord.js": "^14.x",
|
|
89
89
|
"nodemailer": "^6.x",
|
|
90
|
-
"toolpack-sdk": "^2.0.0
|
|
90
|
+
"toolpack-sdk": "^2.0.0",
|
|
91
91
|
"twilio": "^5.x"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|