@deepagents/agent 0.1.1 → 0.2.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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1102 -6
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +34 -34
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/blog/deepagents.d.ts +2 -2
- package/dist/lib/blog/deepagents.d.ts.map +1 -1
- package/dist/lib/blog/mesh.d.ts +1 -1
- package/dist/lib/blog/mesh.d.ts.map +1 -1
- package/dist/lib/blog/research.d.ts +1 -1
- package/dist/lib/blog/research.d.ts.map +1 -1
- package/dist/lib/patterns/plan_and_execute/plan_and_execute.d.ts +1 -1
- package/dist/lib/patterns/plan_and_execute/plan_and_execute.d.ts.map +1 -1
- package/dist/lib/patterns/rewoo/rewoo.d.ts +2 -2
- package/dist/lib/patterns/rewoo/rewoo.d.ts.map +1 -1
- package/dist/lib/patterns/supervisor.d.ts +3 -3
- package/dist/lib/patterns/supervisor.d.ts.map +1 -1
- package/dist/lib/pipe.d.ts +15 -0
- package/dist/lib/pipe.d.ts.map +1 -0
- package/dist/lib/prompts.d.ts +53 -0
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/stream_utils.d.ts +7 -7
- package/dist/lib/stream_utils.d.ts.map +1 -1
- package/dist/lib/swarm.d.ts +12 -8
- package/dist/lib/swarm.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/lib/agent.d.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { type GenerateTextResult, type LanguageModel, type ModelMessage, type StreamTextResult, type
|
|
1
|
+
import { type GenerateTextResult, type LanguageModel, type ModelMessage, type StreamTextResult, type ToolChoice, type ToolSet, type UIDataTypes, type UIMessage, type UITools, generateText } from 'ai';
|
|
2
2
|
import z from 'zod';
|
|
3
|
-
export interface Handoff<
|
|
3
|
+
export interface Handoff<CIn> {
|
|
4
4
|
name: string;
|
|
5
|
-
instructions: Instruction<
|
|
5
|
+
instructions: Instruction<CIn>;
|
|
6
6
|
handoffDescription?: string;
|
|
7
|
-
tools:
|
|
7
|
+
tools: ToolSet;
|
|
8
8
|
}
|
|
9
|
-
export type Handoffs<
|
|
10
|
-
export type Runner<T,
|
|
9
|
+
export type Handoffs<CIn, COut> = (Agent<unknown, CIn, COut> | (() => Agent<unknown, CIn, COut>))[];
|
|
10
|
+
export type Runner<T, CIn> = (prompt: string, agent: Agent<CIn>, messages: ModelMessage[]) => Promise<T>;
|
|
11
11
|
type transfer_tool = `transfer_to_${string}`;
|
|
12
12
|
export type ContextVariables = Record<string, unknown>;
|
|
13
|
-
export declare function agent<Output,
|
|
13
|
+
export declare function agent<Output, CIn = ContextVariables, COut = CIn>(config: CreateAgent<Output, CIn, COut>): Agent<Output, CIn, COut>;
|
|
14
14
|
export type ResponseMessage = UIMessage<unknown, UIDataTypes, UITools>;
|
|
15
15
|
export type AgentModel = Exclude<LanguageModel, string>;
|
|
16
|
-
export type OutputExtractorFn = (output: GenerateTextResult<
|
|
16
|
+
export type OutputExtractorFn = (output: GenerateTextResult<ToolSet, any>) => string | Promise<string>;
|
|
17
17
|
export type PrepareHandoffFn = (messages: ModelMessage[]) => void | Promise<void>;
|
|
18
|
-
export type PrepareEndFn<C> = (config: {
|
|
18
|
+
export type PrepareEndFn<C, O> = (config: {
|
|
19
19
|
messages: ResponseMessage[];
|
|
20
20
|
responseMessage: ResponseMessage;
|
|
21
21
|
contextVariables: C;
|
|
22
22
|
abortSignal?: AbortSignal;
|
|
23
|
-
}) => StreamTextResult<
|
|
24
|
-
export interface CreateAgent<Output,
|
|
23
|
+
}) => StreamTextResult<ToolSet, O> | undefined | void;
|
|
24
|
+
export interface CreateAgent<Output, CIn, COut = CIn> {
|
|
25
25
|
name: string;
|
|
26
|
-
prompt: Instruction<
|
|
26
|
+
prompt: Instruction<CIn>;
|
|
27
27
|
temperature?: number;
|
|
28
28
|
handoffDescription?: string;
|
|
29
29
|
prepareHandoff?: PrepareHandoffFn;
|
|
30
|
-
prepareEnd?: PrepareEndFn<
|
|
31
|
-
handoffs?: Handoffs<
|
|
32
|
-
tools?:
|
|
30
|
+
prepareEnd?: PrepareEndFn<COut, Output>;
|
|
31
|
+
handoffs?: Handoffs<CIn, COut>;
|
|
32
|
+
tools?: ToolSet;
|
|
33
33
|
model: AgentModel;
|
|
34
|
-
toolChoice?: ToolChoice<Record<string,
|
|
34
|
+
toolChoice?: ToolChoice<Record<string, COut>>;
|
|
35
35
|
output?: z.Schema<Output>;
|
|
36
36
|
providerOptions?: Parameters<typeof generateText>[0]['providerOptions'];
|
|
37
37
|
}
|
|
38
|
-
export declare class Agent<Output = unknown,
|
|
38
|
+
export declare class Agent<Output = unknown, CIn = ContextVariables, COut = CIn> {
|
|
39
39
|
#private;
|
|
40
40
|
model: AgentModel;
|
|
41
|
-
toolChoice: ToolChoice<Record<string,
|
|
42
|
-
parent?: Agent<unknown,
|
|
43
|
-
handoffs: Handoffs<
|
|
41
|
+
toolChoice: ToolChoice<Record<string, COut>> | undefined;
|
|
42
|
+
parent?: Agent<unknown, any, any>;
|
|
43
|
+
handoffs: Handoffs<CIn, COut>;
|
|
44
44
|
readonly prepareHandoff?: PrepareHandoffFn;
|
|
45
|
-
readonly prepareEnd?: PrepareEndFn<
|
|
45
|
+
readonly prepareEnd?: PrepareEndFn<COut, Output>;
|
|
46
46
|
readonly internalName: string;
|
|
47
|
-
readonly handoff: Handoff<
|
|
47
|
+
readonly handoff: Handoff<CIn>;
|
|
48
48
|
readonly handoffToolName: transfer_tool;
|
|
49
|
-
readonly handoffTool:
|
|
49
|
+
readonly handoffTool: ToolSet;
|
|
50
50
|
readonly output?: z.Schema<Output>;
|
|
51
51
|
readonly temperature?: number;
|
|
52
|
-
readonly providerOptions?: CreateAgent<Output,
|
|
53
|
-
constructor(config: CreateAgent<Output,
|
|
52
|
+
readonly providerOptions?: CreateAgent<Output, CIn, COut>['providerOptions'];
|
|
53
|
+
constructor(config: CreateAgent<Output, CIn, COut>);
|
|
54
54
|
get transfer_tools(): {
|
|
55
|
-
[k: string]: Tool
|
|
55
|
+
[k: string]: (import("ai").Tool<never, never> | import("ai").Tool<any, any> | import("ai").Tool<any, never> | import("ai").Tool<never, any>) & Pick<import("ai").Tool<any, any>, "execute" | "onInputAvailable" | "onInputStart" | "onInputDelta">;
|
|
56
56
|
};
|
|
57
57
|
get toolsNames(): string[];
|
|
58
|
-
instructions(contextVariables?:
|
|
59
|
-
toHandoffs(): Agent<unknown,
|
|
58
|
+
instructions(contextVariables?: CIn): string;
|
|
59
|
+
toHandoffs(): Agent<unknown, CIn, COut>[];
|
|
60
60
|
asTool(props?: {
|
|
61
61
|
toolDescription?: string;
|
|
62
62
|
outputExtractor?: OutputExtractorFn;
|
|
63
|
-
}): Tool<{
|
|
63
|
+
}): import("ai").Tool<{
|
|
64
64
|
input: string;
|
|
65
65
|
output?: string | undefined;
|
|
66
|
-
}, string | import("ai").TypedToolResult<
|
|
66
|
+
}, string | import("ai").TypedToolResult<ToolSet>[]>;
|
|
67
67
|
toTool(props?: {
|
|
68
68
|
toolDescription?: string;
|
|
69
69
|
outputExtractor?: OutputExtractorFn;
|
|
70
70
|
}): {
|
|
71
|
-
[x: string]: Tool<{
|
|
71
|
+
[x: string]: import("ai").Tool<{
|
|
72
72
|
input: string;
|
|
73
73
|
output?: string | undefined;
|
|
74
|
-
}, string | import("ai").TypedToolResult<
|
|
74
|
+
}, string | import("ai").TypedToolResult<ToolSet>[]>;
|
|
75
75
|
};
|
|
76
76
|
debug(prefix?: string): void;
|
|
77
77
|
toToolset(options?: {
|
|
78
78
|
includeTransferTool?: boolean;
|
|
79
79
|
includeHandoffs?: boolean;
|
|
80
|
-
}):
|
|
81
|
-
clone(agent?: Omit<Partial<CreateAgent<Output,
|
|
80
|
+
}): ToolSet;
|
|
81
|
+
clone(agent?: Omit<Partial<CreateAgent<Output, CIn, COut>>, 'handoffs'>): Agent<Output, CIn, COut>;
|
|
82
82
|
}
|
|
83
83
|
export type Instruction<C> = string | string[] | ((contextVariables?: C) => string);
|
|
84
84
|
export interface PurposeRoutineInstructions {
|
package/dist/lib/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/lib/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/lib/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,OAAO,EAEZ,YAAY,EAIb,MAAM,IAAI,CAAC;AAGZ,OAAO,CAAC,MAAM,KAAK,CAAC;AASpB,MAAM,WAAW,OAAO,CAAC,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;CAChB;AACD,MAAM,MAAM,QAAQ,CAAC,GAAG,EAAE,IAAI,IAAI,CAC9B,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GACzB,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CACpC,EAAE,CAAC;AAEJ,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAC3B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,QAAQ,EAAE,YAAY,EAAE,KACrB,OA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AAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,0BAA0B,UAkB5E;yBAlBe,YAAY;sCAoBgB,0BAA0B;4CA0BnE,0BAA0B;qDA0B1B,0BAA0B;;AA+B7B,KAAK,cAAc,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,YAAY,GAAG;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC;AACtD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,GAAG,SAAS,GACxB,IAAI,IAAI,YAAY,CAiBtB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,EAAE,8BAgB7D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ToolSet } from 'ai';
|
|
2
2
|
import { type Agent, type AgentModel } from '../agent.ts';
|
|
3
3
|
export declare const SYSTEM_PROMPT_DEEPAGENTS: string;
|
|
4
4
|
export type SubAgent = {
|
|
@@ -8,5 +8,5 @@ export type SubAgent = {
|
|
|
8
8
|
tools?: string[];
|
|
9
9
|
model_settings?: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
|
-
export declare function create_deep_agent(tools:
|
|
11
|
+
export declare function create_deep_agent(tools: ToolSet, prompt: string, model: AgentModel, subagents?: SubAgent[]): Agent<unknown, import("../agent.ts").ContextVariables, import("../agent.ts").ContextVariables>;
|
|
12
12
|
//# sourceMappingURL=deepagents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepagents.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/deepagents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"deepagents.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/deepagents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,IAAI,CAAC;AAG/C,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAuB,MAAM,aAAa,CAAC;AAkJ/E,eAAO,MAAM,wBAAwB,QAI7B,CAAC;AAGT,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,QAAQ,EAAE,kGAwEvB"}
|
package/dist/lib/blog/mesh.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Agent } from '../agent.ts';
|
|
2
2
|
export declare const SYSTEM_PROMPT: string;
|
|
3
|
-
export declare const triage: Agent<unknown, import("../agent.ts").ContextVariables>;
|
|
3
|
+
export declare const triage: Agent<unknown, import("../agent.ts").ContextVariables, import("../agent.ts").ContextVariables>;
|
|
4
4
|
//# sourceMappingURL=mesh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/mesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,aAAa,QAMlB,CAAC;AAyDT,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/mesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,aAAa,QAMlB,CAAC;AAyDT,eAAO,MAAM,MAAM,gGA8BjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Handoffs } from '../agent.ts';
|
|
2
2
|
export declare const RESEARCH_SYSTEM_PROMPT: string;
|
|
3
|
-
export declare const researchAgent: <C>(handoffs: Handoffs<C>) => import("../agent.ts").Agent<unknown, C>;
|
|
3
|
+
export declare const researchAgent: <C>(handoffs: Handoffs<C, C>) => import("../agent.ts").Agent<unknown, C, C>;
|
|
4
4
|
//# sourceMappingURL=research.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/research.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,sBAAsB,QAI3B,CAAC;AA4FT,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,UAAU,QAAQ,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../src/lib/blog/research.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,sBAAsB,QAI3B,CAAC;AA4FT,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,UAAU,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,+CA8BrD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const triage: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables>;
|
|
1
|
+
export declare const triage: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables, import("../../agent.ts").ContextVariables>;
|
|
2
2
|
export declare function planAndExecute(objective: string, autoConfirm?: boolean): Promise<string>;
|
|
3
3
|
//# sourceMappingURL=plan_and_execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan_and_execute.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute.ts"],"names":[],"mappings":"AAsGA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"plan_and_execute.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute.ts"],"names":[],"mappings":"AAsGA,eAAO,MAAM,MAAM,+HAUjB,CAAC;AAGH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,UAAQ,GAClB,OAAO,CAAC,MAAM,CAAC,CAmFjB"}
|
|
@@ -41,8 +41,8 @@ export declare const rewooPlanner: import("../../agent.ts").Agent<{
|
|
|
41
41
|
depends_on: string[];
|
|
42
42
|
}[];
|
|
43
43
|
notes?: string | undefined;
|
|
44
|
-
}, import("../../agent.ts").ContextVariables>;
|
|
45
|
-
export declare const rewooSolver: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables>;
|
|
44
|
+
}, import("../../agent.ts").ContextVariables, import("../../agent.ts").ContextVariables>;
|
|
45
|
+
export declare const rewooSolver: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables, import("../../agent.ts").ContextVariables>;
|
|
46
46
|
export declare function runRewoo(query: string): Promise<{
|
|
47
47
|
readonly plan: {
|
|
48
48
|
statements: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewoo.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/rewoo/rewoo.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAcpB,QAAA,MAAM,cAAc;;;;EAAoC,CAAC;AAiBzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAa1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AASF,eAAO,MAAM,YAAY;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"rewoo.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/rewoo/rewoo.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAcpB,QAAA,MAAM,cAAc;;;;EAAoC,CAAC;AAiBzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAa1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AASF,eAAO,MAAM,YAAY;;;;;;;;;;;;wFAoBvB,CAAC;AA+BH,eAAO,MAAM,WAAW,+HAgBtB,CAAC;AAMH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;GAmC3C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ToolSet } from 'ai';
|
|
2
2
|
import { type Agent, type AgentModel, type Instruction } from '../agent.ts';
|
|
3
3
|
export declare function createSupervisor<C>(props: {
|
|
4
4
|
prompt: Instruction<C>;
|
|
@@ -7,6 +7,6 @@ export declare function createSupervisor<C>(props: {
|
|
|
7
7
|
model: AgentModel;
|
|
8
8
|
outputMode?: 'full_history' | 'last_message';
|
|
9
9
|
handoffDescription?: string;
|
|
10
|
-
tools?:
|
|
11
|
-
}): Agent<unknown, C>;
|
|
10
|
+
tools?: ToolSet;
|
|
11
|
+
}): Agent<unknown, C, C>;
|
|
12
12
|
//# sourceMappingURL=supervisor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,aAAa,CAAC;AAKrB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE;IACzC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,wBA2EA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UIMessage, createUIMessageStream } from 'ai';
|
|
2
|
+
import { Agent } from './agent.ts';
|
|
3
|
+
export type Pipeable<I, O> = Agent<unknown, I, O> | StreamFunction<I, O> | StringFunction<I, O>;
|
|
4
|
+
type InitialState = {
|
|
5
|
+
messages: UIMessage[];
|
|
6
|
+
};
|
|
7
|
+
type InOf<IS, P> = P extends Agent<unknown, infer I, infer O> ? IS & I & O : P extends StreamFunction<infer I, infer O> ? IS & I & O : P extends StringFunction<infer I, infer O> ? IS & I & O : IS;
|
|
8
|
+
type InitialInput<P> = P extends Agent<unknown, infer I> ? I : P extends StreamFunction<infer I> ? I : P extends StringFunction<infer I> ? I : unknown;
|
|
9
|
+
export type StreamFunction<StateIn, StateOut = StateIn> = (state: StateIn, setState: (state: StateOut) => void) => ReturnType<typeof createUIMessageStream> | Promise<ReturnType<typeof createUIMessageStream>>;
|
|
10
|
+
export type StringFunction<StateIn, StateOut = StateIn> = (state: StateIn, setState: (state: StateOut) => void) => string | Promise<string>;
|
|
11
|
+
export declare function pipe<IS, P1 extends Pipeable<any, any>>(state: IS & InitialInput<P1>, p1: P1): () => ReturnType<typeof createUIMessageStream>;
|
|
12
|
+
export declare function pipe<IS, P1 extends Pipeable<any, any>, P2 extends Pipeable<InOf<IS, P1>, any>>(state: IS & InitialInput<P1>, p1: P1, p2: P2): () => ReturnType<typeof createUIMessageStream>;
|
|
13
|
+
export declare function pipe<IS extends InitialState, P1 extends Pipeable<any, any>, P2 extends Pipeable<InOf<IS, P1>, any>, P3 extends Pipeable<InOf<InOf<IS, P1>, P2>, any>>(state: IS & InitialInput<P1>, p1: P1, p2: P2, p3: P3): () => ReturnType<typeof createUIMessageStream>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=pipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../src/lib/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,qBAAqB,EAAc,MAAM,IAAI,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IACrB,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,GACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEzB,KAAK,YAAY,GAAG;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AY,CAAC,EAAE,CAAC,EAC5B,EAAE,EAAE,EAAE,GACL,MAAM,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClD,wBAAgB,IAAI,CAClB,EAAE,EACF,EAAE,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7B,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,EAEtC,KAAK,EAAE,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,EAC5B,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACL,MAAM,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClD,wBAAgB,IAAI,CAClB,EAAE,SAAS,YAAY,EACvB,EAAE,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7B,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,EACtC,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,EAEhD,KAAK,EAAE,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,EAC5B,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACL,MAAM,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/lib/prompts.d.ts
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
1
|
export declare const RECOMMENDED_PROMPT_PREFIX: string;
|
|
2
2
|
export declare const SUPERVISOR_PROMPT_PREFIX: string;
|
|
3
|
+
/**
|
|
4
|
+
* Third-person speaking style prompt for agents
|
|
5
|
+
* Makes the agent refer to itself as "this agent" or by a custom name instead of using "I"
|
|
6
|
+
*
|
|
7
|
+
* @param agentName - Optional name for the agent (e.g., "Freya", "the assistant")
|
|
8
|
+
* @param agentRole - The role/purpose of the agent (e.g., "code search assistant", "data analyst")
|
|
9
|
+
* @returns A prompt string that instructs the agent to speak in third person
|
|
10
|
+
*/
|
|
11
|
+
export declare function thirdPersonPrompt(agentName?: string, agentRole?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Interface for Step-Back prompting examples
|
|
14
|
+
* Used to demonstrate the abstraction process through few-shot learning
|
|
15
|
+
*/
|
|
16
|
+
export interface StepBackExample {
|
|
17
|
+
/** The original specific question */
|
|
18
|
+
originalQuestion: string;
|
|
19
|
+
/** The high-level step-back question that abstracts the original */
|
|
20
|
+
stepBackQuestion: string;
|
|
21
|
+
/** The answer to the step-back question (principles/context) */
|
|
22
|
+
stepBackAnswer: string;
|
|
23
|
+
/** Optional: The final answer to the original question (for demonstration) */
|
|
24
|
+
finalAnswer?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Default Step-Back examples for STEM domains (Physics, Chemistry, Math)
|
|
28
|
+
*/
|
|
29
|
+
export declare const STEM_STEP_BACK_EXAMPLES: StepBackExample[];
|
|
30
|
+
/**
|
|
31
|
+
* Default Step-Back examples for Knowledge QA domains
|
|
32
|
+
*/
|
|
33
|
+
export declare const KNOWLEDGE_QA_STEP_BACK_EXAMPLES: StepBackExample[];
|
|
34
|
+
/**
|
|
35
|
+
* Default Step-Back examples for General Reasoning
|
|
36
|
+
*/
|
|
37
|
+
export declare const GENERAL_STEP_BACK_EXAMPLES: StepBackExample[];
|
|
38
|
+
/**
|
|
39
|
+
* Step-back prompting strategy for improved reasoning via abstraction
|
|
40
|
+
* Based on "Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models" (DeepMind, 2023)
|
|
41
|
+
*
|
|
42
|
+
* This technique improves LLM reasoning by 7-36% through a two-step process:
|
|
43
|
+
* 1. Abstraction: Generate and answer a high-level "step-back question"
|
|
44
|
+
* 2. Reasoning: Use the step-back answer to solve the original question
|
|
45
|
+
*
|
|
46
|
+
* @param domain - The domain type: "stem" (physics/chemistry/math), "knowledge" (facts/history), or "general" (coding/reasoning)
|
|
47
|
+
* @param options - Optional configuration
|
|
48
|
+
* @param options.examples - Custom few-shot examples (if not provided, uses domain defaults)
|
|
49
|
+
* @param options.stepBackQuestionTemplate - Custom template for generating step-back questions
|
|
50
|
+
* @returns A two-step prompt string that guides the model through abstraction and reasoning
|
|
51
|
+
*/
|
|
52
|
+
export declare function stepBackPrompt(domain?: 'stem' | 'knowledge' | 'general', options?: {
|
|
53
|
+
examples?: StepBackExample[];
|
|
54
|
+
stepBackQuestionTemplate?: string;
|
|
55
|
+
}): string;
|
|
3
56
|
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,QAqB1B,CAAC;AAEb,eAAO,MAAM,wBAAwB,QAuBpC,CAAC"}
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,QAqB1B,CAAC;AAEb,eAAO,MAAM,wBAAwB,QAuBpC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,SAAe,EACxB,SAAS,SAAc,GACtB,MAAM,CAiBR;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAAe,EAmBpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,EAAE,eAAe,EAiB5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,eAAe,EAiBvD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,MAAM,GAAE,MAAM,GAAG,WAAW,GAAG,SAAqB,EACpD,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,GACA,MAAM,CA4DR"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { type GenerateTextResult, type InferUIMessageChunk, type StreamTextResult, type
|
|
2
|
-
export declare function streamWrite(response: StreamTextResult<
|
|
1
|
+
import { type GenerateTextResult, type InferUIMessageChunk, type StreamTextResult, type ToolCallOptions, type ToolSet, type UIDataTypes, type UIMessage, type UITools } from 'ai';
|
|
2
|
+
export declare function streamWrite(response: StreamTextResult<ToolSet, never>): Promise<void>;
|
|
3
3
|
export declare const printer: {
|
|
4
4
|
readableStream: (stream: ReadableStream<InferUIMessageChunk<UIMessage<unknown, UIDataTypes, UITools>>>, options?: {
|
|
5
5
|
reasoning?: boolean;
|
|
6
6
|
wrapInTags?: boolean;
|
|
7
7
|
text?: boolean;
|
|
8
8
|
}) => Promise<void>;
|
|
9
|
-
stdout: (response: StreamTextResult<
|
|
9
|
+
stdout: (response: StreamTextResult<ToolSet, unknown>, options?: {
|
|
10
10
|
reasoning?: boolean;
|
|
11
11
|
text?: boolean;
|
|
12
12
|
wrapInTags?: boolean;
|
|
13
13
|
}) => Promise<void>;
|
|
14
|
-
mermaid: (root: import("./agent.ts").Agent<any, import("./agent.ts").ContextVariables>, options?: import("./visualize.ts").VisualizeOptions | undefined) => void;
|
|
15
|
-
semantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables>) => void;
|
|
16
|
-
richSemantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables>) => void;
|
|
14
|
+
mermaid: (root: import("./agent.ts").Agent<any, import("./agent.ts").ContextVariables, import("./agent.ts").ContextVariables>, options?: import("./visualize.ts").VisualizeOptions | undefined) => void;
|
|
15
|
+
semantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables, import("./agent.ts").ContextVariables>) => void;
|
|
16
|
+
richSemantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables, import("./agent.ts").ContextVariables>) => void;
|
|
17
17
|
};
|
|
18
18
|
export declare function messageToUiMessage(message: string): UIMessage;
|
|
19
19
|
export declare const user: typeof messageToUiMessage;
|
|
@@ -21,6 +21,6 @@ export declare function input(defaultValue?: string): Promise<string>;
|
|
|
21
21
|
export declare function confirm(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
22
22
|
export declare function last<T>(iterable: AsyncIterable<T>, position?: number): Promise<NonNullable<T>>;
|
|
23
23
|
export declare function finished<T>(iterable: AsyncIterable<T>): Promise<void>;
|
|
24
|
-
export declare function toOutput<T>(result: Promise<GenerateTextResult<
|
|
24
|
+
export declare function toOutput<T>(result: Promise<GenerateTextResult<ToolSet, T>> | StreamTextResult<ToolSet, T>): Promise<T>;
|
|
25
25
|
export declare function toState<C>(options: ToolCallOptions): C;
|
|
26
26
|
//# sourceMappingURL=stream_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream_utils.d.ts","sourceRoot":"","sources":["../../src/lib/stream_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"stream_utils.d.ts","sourceRoot":"","sources":["../../src/lib/stream_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,OAAO,EAEb,MAAM,IAAI,CAAC;AAaZ,wBAAsB,WAAW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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ModelMessage, type PrepareStepFunction, type PrepareStepResult, type
|
|
1
|
+
import { type ModelMessage, type PrepareStepFunction, type PrepareStepResult, type ToolSet, type UIDataTypes, type UIMessage, type UITools, streamText } from 'ai';
|
|
2
2
|
import { type Agent, type AgentModel } from './agent.ts';
|
|
3
3
|
export type OutputMode = 'full_history' | 'last_message';
|
|
4
4
|
export interface ExecuteOptions {
|
|
@@ -7,16 +7,20 @@ export interface ExecuteOptions {
|
|
|
7
7
|
abortSignal?: AbortSignal;
|
|
8
8
|
outputMode?: OutputMode;
|
|
9
9
|
}
|
|
10
|
-
export declare function generate<O,
|
|
10
|
+
export declare function generate<O, CIn, COut = CIn>(agent: Agent<O, CIn, COut>, messages: UIMessage[] | string, contextVariables: CIn, config?: {
|
|
11
11
|
abortSignal?: AbortSignal;
|
|
12
12
|
providerOptions?: Parameters<typeof streamText>[0]['providerOptions'];
|
|
13
|
-
}): Promise<import("ai").GenerateTextResult<
|
|
14
|
-
|
|
13
|
+
}): Promise<import("ai").GenerateTextResult<ToolSet, O>> & {
|
|
14
|
+
state: COut;
|
|
15
|
+
};
|
|
16
|
+
export declare function execute<O, CIn, COut = CIn>(agent: Agent<O, CIn, COut>, messages: UIMessage[] | string, contextVariables: CIn, config?: {
|
|
15
17
|
abortSignal?: AbortSignal;
|
|
16
18
|
providerOptions?: Parameters<typeof streamText>[0]['providerOptions'];
|
|
17
|
-
}): import("ai").StreamTextResult<
|
|
19
|
+
}): import("ai").StreamTextResult<ToolSet, import("ai").DeepPartial<O>> & {
|
|
20
|
+
state: COut;
|
|
21
|
+
};
|
|
18
22
|
export declare const stream: typeof execute;
|
|
19
|
-
export declare const prepareStep: <
|
|
20
|
-
export declare function swarm<
|
|
21
|
-
export declare function prepareAgent<
|
|
23
|
+
export declare const prepareStep: <CIn>(agent: Agent<unknown, CIn, any>, model: AgentModel, contextVariables: CIn) => PrepareStepFunction<NoInfer<ToolSet>>;
|
|
24
|
+
export declare function swarm<CIn>(agent: Agent<unknown, CIn, any>, messages: UIMessage[] | string, contextVariables: CIn, abortSignal?: AbortSignal): ReadableStream<import("ai").InferUIMessageChunk<UIMessage<unknown, UIDataTypes, UITools>>>;
|
|
25
|
+
export declare function prepareAgent<CIn>(defaultModel: AgentModel, agent: Agent<unknown, CIn, any>, messages: ModelMessage[], contextVariables?: CIn): Promise<PrepareStepResult<NoInfer<ToolSet>>>;
|
|
22
26
|
//# sourceMappingURL=swarm.d.ts.map
|
package/dist/lib/swarm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../src/lib/swarm.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../src/lib/swarm.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAGtB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,KAAK,OAAO,EAOZ,UAAU,EAEX,MAAM,IAAI,CAAC;AAKZ,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EAGhB,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAsCD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,GAAG,EACzC,KAAK,EAAE,KAAK,CAAC,CAAC,E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,GAAG,CAAC,EAC/B,QAAQ,EAAE,YAAY,EAAE,EACxB,gBAAgB,CAAC,EAAE,GAAG,GACrB,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CA+B9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepagents/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"conf": "^15.0.2",
|
|
34
34
|
"@ai-sdk/openai-compatible": "^1.0.24",
|
|
35
35
|
"dedent": "1.7.0",
|
|
36
|
-
"@deepagents/retrieval": "0.
|
|
36
|
+
"@deepagents/retrieval": "0.2.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^3.25.76 || ^4.0.0"
|