@inkeep/agents-sdk 0.18.1 → 0.19.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.
- package/README.md +15 -15
- package/dist/index.cjs +375 -345
- package/dist/index.d.cts +126 -119
- package/dist/index.d.ts +126 -119
- package/dist/index.js +362 -343
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import { MCPToolConfig as MCPToolConfig$1,
|
|
2
|
-
export { FunctionToolConfig, ModelSettings, SandboxConfig } from '@inkeep/agents-core';
|
|
1
|
+
import { ArtifactComponentInsert, MCPToolConfig as MCPToolConfig$1, CredentialReferenceApiInsert, DataComponentInsert, CredentialReferenceSelect, FunctionToolConfig, SubAgentApiInsert, DataComponentApiInsert, ArtifactComponentApiInsert, AgentConversationHistoryConfig, AgentStopWhen, ModelSettings, StatusUpdateSettings, FullAgentDefinition, ToolInsert, McpTransportConfig, StopWhen, SandboxConfig, FullProjectDefinition } from '@inkeep/agents-core';
|
|
2
|
+
export { ANTHROPIC_MODELS, FunctionToolConfig, GOOGLE_MODELS, ModelSettings, OPENAI_MODELS, SandboxConfig } from '@inkeep/agents-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
+
type ArtifactComponentConfigWithZod = Omit<ArtifactComponentInsert, 'tenantId' | 'projectId' | 'props'> & {
|
|
6
|
+
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
7
|
+
};
|
|
8
|
+
interface ArtifactComponentInterface {
|
|
9
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
10
|
+
init(): Promise<void>;
|
|
11
|
+
getId(): ArtifactComponentInsert['id'];
|
|
12
|
+
getName(): ArtifactComponentInsert['name'];
|
|
13
|
+
getDescription(): ArtifactComponentInsert['description'];
|
|
14
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
15
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
16
|
+
}
|
|
17
|
+
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
18
|
+
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
19
|
+
private baseURL;
|
|
20
|
+
private tenantId;
|
|
21
|
+
private projectId;
|
|
22
|
+
private initialized;
|
|
23
|
+
private id;
|
|
24
|
+
constructor(config: ArtifactComponentConfigWithZod);
|
|
25
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
26
|
+
getId(): string;
|
|
27
|
+
getName(): string;
|
|
28
|
+
getDescription(): string;
|
|
29
|
+
getProps(): ArtifactComponentInsert['props'];
|
|
30
|
+
init(): Promise<void>;
|
|
31
|
+
private upsertArtifactComponent;
|
|
32
|
+
}
|
|
33
|
+
|
|
5
34
|
interface ToolInterface {
|
|
6
35
|
config: MCPToolConfig$1;
|
|
7
36
|
init(): Promise<void>;
|
|
@@ -32,32 +61,6 @@ declare class Tool implements ToolInterface {
|
|
|
32
61
|
private upsertTool;
|
|
33
62
|
}
|
|
34
63
|
|
|
35
|
-
interface ArtifactComponentInterface {
|
|
36
|
-
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
37
|
-
init(): Promise<void>;
|
|
38
|
-
getId(): ArtifactComponentInsert['id'];
|
|
39
|
-
getName(): ArtifactComponentInsert['name'];
|
|
40
|
-
getDescription(): ArtifactComponentInsert['description'];
|
|
41
|
-
getProps(): ArtifactComponentInsert['props'];
|
|
42
|
-
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
43
|
-
}
|
|
44
|
-
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
45
|
-
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
46
|
-
private baseURL;
|
|
47
|
-
private tenantId;
|
|
48
|
-
private projectId;
|
|
49
|
-
private initialized;
|
|
50
|
-
private id;
|
|
51
|
-
constructor(config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>);
|
|
52
|
-
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
53
|
-
getId(): string;
|
|
54
|
-
getName(): string;
|
|
55
|
-
getDescription(): string;
|
|
56
|
-
getProps(): ArtifactComponentInsert['props'];
|
|
57
|
-
init(): Promise<void>;
|
|
58
|
-
private upsertArtifactComponent;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
64
|
/**
|
|
62
65
|
* Function signature for transfer conditions
|
|
63
66
|
*/
|
|
@@ -86,10 +89,10 @@ interface ComponentConfig {
|
|
|
86
89
|
description: string;
|
|
87
90
|
}
|
|
88
91
|
interface ArtifactComponentConfig extends ComponentConfig {
|
|
89
|
-
props: Record<string, unknown>;
|
|
92
|
+
props: Record<string, unknown> | z.ZodObject<any>;
|
|
90
93
|
}
|
|
91
94
|
interface DataComponentConfig extends ComponentConfig {
|
|
92
|
-
props: Record<string, unknown>;
|
|
95
|
+
props: Record<string, unknown> | z.ZodObject<any>;
|
|
93
96
|
}
|
|
94
97
|
type AgentMcpConfig = {
|
|
95
98
|
server: Tool;
|
|
@@ -97,7 +100,7 @@ type AgentMcpConfig = {
|
|
|
97
100
|
headers?: Record<string, string>;
|
|
98
101
|
};
|
|
99
102
|
/**
|
|
100
|
-
* Creates a transfer configuration for agent
|
|
103
|
+
* Creates a transfer configuration for agent transfers.
|
|
101
104
|
*
|
|
102
105
|
* Transfers allow one agent to hand off control to another agent
|
|
103
106
|
* based on optional conditions.
|
|
@@ -110,7 +113,7 @@ type AgentMcpConfig = {
|
|
|
110
113
|
* @example
|
|
111
114
|
* ```typescript
|
|
112
115
|
* // Simple transfer
|
|
113
|
-
* const
|
|
116
|
+
* const transfer = transfer(supportAgent, 'Transfer to support');
|
|
114
117
|
*
|
|
115
118
|
* // Conditional transfer
|
|
116
119
|
* const conditionalHandoff = transfer(
|
|
@@ -122,6 +125,9 @@ type AgentMcpConfig = {
|
|
|
122
125
|
*/
|
|
123
126
|
declare function transfer(targetAgent: SubAgent, description?: string, condition?: TransferConditionFunction): TransferConfig;
|
|
124
127
|
|
|
128
|
+
type DataComponentConfigWithZod = Omit<DataComponentInsert, 'tenantId' | 'projectId' | 'props'> & {
|
|
129
|
+
props?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
130
|
+
};
|
|
125
131
|
interface DataComponentInterface {
|
|
126
132
|
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
127
133
|
init(): Promise<void>;
|
|
@@ -138,7 +144,7 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
138
144
|
private projectId;
|
|
139
145
|
private initialized;
|
|
140
146
|
private id;
|
|
141
|
-
constructor(config:
|
|
147
|
+
constructor(config: DataComponentConfigWithZod);
|
|
142
148
|
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
143
149
|
getId(): string;
|
|
144
150
|
getName(): string;
|
|
@@ -400,7 +406,7 @@ interface RunResult {
|
|
|
400
406
|
transfers: TransferConfig[];
|
|
401
407
|
};
|
|
402
408
|
}
|
|
403
|
-
interface
|
|
409
|
+
interface AgentConfig {
|
|
404
410
|
id: string;
|
|
405
411
|
name?: string;
|
|
406
412
|
description?: string;
|
|
@@ -408,8 +414,8 @@ interface GraphConfig {
|
|
|
408
414
|
subAgents?: () => AllSubAgentInterface[];
|
|
409
415
|
contextConfig?: any;
|
|
410
416
|
credentials?: () => CredentialReferenceApiInsert[];
|
|
411
|
-
stopWhen?:
|
|
412
|
-
|
|
417
|
+
stopWhen?: AgentStopWhen;
|
|
418
|
+
agentPrompt?: string;
|
|
413
419
|
models?: {
|
|
414
420
|
base?: ModelSettings;
|
|
415
421
|
structuredOutput?: ModelSettings;
|
|
@@ -461,7 +467,7 @@ interface ExternalAgentInterface {
|
|
|
461
467
|
getHeaders(): Record<string, string> | undefined;
|
|
462
468
|
setContext?(tenantId: string, baseURL?: string): void;
|
|
463
469
|
}
|
|
464
|
-
interface
|
|
470
|
+
interface AgentInterface {
|
|
465
471
|
init(): Promise<void>;
|
|
466
472
|
setConfig(tenantId: string, projectId: string, apiUrl: string): void;
|
|
467
473
|
getId(): string;
|
|
@@ -471,10 +477,10 @@ interface GraphInterface {
|
|
|
471
477
|
generate(input: MessageInput, options?: GenerateOptions): Promise<string>;
|
|
472
478
|
stream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
473
479
|
generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
474
|
-
|
|
475
|
-
|
|
480
|
+
getDefaultSubAgent(): SubAgentInterface | undefined;
|
|
481
|
+
getSubAgent(name: string): AllSubAgentInterface | undefined;
|
|
476
482
|
getSubAgents(): AllSubAgentInterface[];
|
|
477
|
-
|
|
483
|
+
toFullAgentDefinition(): Promise<FullAgentDefinition>;
|
|
478
484
|
}
|
|
479
485
|
interface BuilderToolConfig {
|
|
480
486
|
name: string;
|
|
@@ -543,45 +549,45 @@ declare class SubAgent implements SubAgentInterface {
|
|
|
543
549
|
private createAgentToolRelation;
|
|
544
550
|
}
|
|
545
551
|
|
|
546
|
-
declare class
|
|
552
|
+
declare class Agent implements AgentInterface {
|
|
547
553
|
private subAgents;
|
|
548
554
|
private agentMap;
|
|
549
555
|
private defaultSubAgent?;
|
|
550
556
|
private baseURL;
|
|
551
557
|
private tenantId;
|
|
552
558
|
private projectId;
|
|
553
|
-
private
|
|
554
|
-
private
|
|
555
|
-
private
|
|
559
|
+
private agentId;
|
|
560
|
+
private agentName;
|
|
561
|
+
private agentDescription?;
|
|
556
562
|
private initialized;
|
|
557
563
|
private contextConfig?;
|
|
558
564
|
private credentials?;
|
|
559
565
|
private models?;
|
|
560
566
|
private statusUpdateSettings?;
|
|
561
|
-
private
|
|
567
|
+
private agentPrompt?;
|
|
562
568
|
private stopWhen?;
|
|
563
569
|
private dbClient;
|
|
564
|
-
constructor(config:
|
|
570
|
+
constructor(config: AgentConfig);
|
|
565
571
|
/**
|
|
566
572
|
* Set or update the configuration (tenantId, projectId and apiUrl)
|
|
567
573
|
* This is used by the CLI to inject configuration from inkeep.config.ts
|
|
568
574
|
*/
|
|
569
575
|
setConfig(tenantId: string, projectId: string, apiUrl: string): void;
|
|
570
576
|
/**
|
|
571
|
-
* Convert the
|
|
577
|
+
* Convert the Agent to FullAgentDefinition format for the new agent endpoint
|
|
572
578
|
*/
|
|
573
|
-
|
|
579
|
+
toFullAgentDefinition(): Promise<FullAgentDefinition>;
|
|
574
580
|
/**
|
|
575
581
|
* Initialize all tools in all agents (especially IPCTools that need MCP server URLs)
|
|
576
582
|
*/
|
|
577
583
|
private initializeAllTools;
|
|
578
584
|
/**
|
|
579
|
-
* Initialize the
|
|
585
|
+
* Initialize the agent and all agents in the backend using the new agent endpoint
|
|
580
586
|
*/
|
|
581
587
|
init(): Promise<void>;
|
|
582
588
|
/**
|
|
583
589
|
* Legacy initialization method - kept for backward compatibility
|
|
584
|
-
* Initialize the
|
|
590
|
+
* Initialize the agent and all agents in the backend using individual endpoints
|
|
585
591
|
*/
|
|
586
592
|
initLegacy(): Promise<void>;
|
|
587
593
|
/**
|
|
@@ -597,23 +603,23 @@ declare class AgentGraph implements GraphInterface {
|
|
|
597
603
|
*/
|
|
598
604
|
generateStream(input: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
599
605
|
/**
|
|
600
|
-
* Run with a specific agent from the
|
|
606
|
+
* Run with a specific agent from the agent
|
|
601
607
|
*/
|
|
602
608
|
runWith(subAgentId: string, input: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
603
609
|
/**
|
|
604
610
|
* Get an agent by name (unified method for all agent types)
|
|
605
611
|
*/
|
|
606
|
-
|
|
612
|
+
getSubAgent(name: string): AllSubAgentInterface | undefined;
|
|
607
613
|
/**
|
|
608
|
-
* Add an agent to the
|
|
614
|
+
* Add an agent to the agent
|
|
609
615
|
*/
|
|
610
616
|
addSubAgent(agent: SubAgentInterface): void;
|
|
611
617
|
/**
|
|
612
|
-
* Remove an agent from the
|
|
618
|
+
* Remove an agent from the agent
|
|
613
619
|
*/
|
|
614
620
|
removeSubAgent(id: string): boolean;
|
|
615
621
|
/**
|
|
616
|
-
* Get all agents in the
|
|
622
|
+
* Get all agents in the agent
|
|
617
623
|
*/
|
|
618
624
|
getSubAgents(): AllSubAgentInterface[];
|
|
619
625
|
/**
|
|
@@ -623,54 +629,54 @@ declare class AgentGraph implements GraphInterface {
|
|
|
623
629
|
/**
|
|
624
630
|
* Set the default agent
|
|
625
631
|
*/
|
|
626
|
-
|
|
632
|
+
setDefaultSubAgent(agent: SubAgentInterface): void;
|
|
627
633
|
/**
|
|
628
634
|
* Get the default agent
|
|
629
635
|
*/
|
|
630
|
-
|
|
636
|
+
getDefaultSubAgent(): SubAgentInterface | undefined;
|
|
631
637
|
/**
|
|
632
|
-
* Get the
|
|
638
|
+
* Get the agent ID
|
|
633
639
|
*/
|
|
634
640
|
getId(): string;
|
|
635
641
|
getName(): string;
|
|
636
642
|
getDescription(): string | undefined;
|
|
637
643
|
getTenantId(): string;
|
|
638
644
|
/**
|
|
639
|
-
* Get the
|
|
645
|
+
* Get the agent's model settingsuration
|
|
640
646
|
*/
|
|
641
647
|
getModels(): typeof this.models;
|
|
642
648
|
/**
|
|
643
|
-
* Set the
|
|
649
|
+
* Set the agent's model settingsuration
|
|
644
650
|
*/
|
|
645
651
|
setModels(models: typeof this.models): void;
|
|
646
652
|
/**
|
|
647
|
-
* Get the
|
|
653
|
+
* Get the agent's prompt configuration
|
|
648
654
|
*/
|
|
649
|
-
|
|
655
|
+
getAgentPrompt(): string | undefined;
|
|
650
656
|
/**
|
|
651
|
-
* Get the
|
|
657
|
+
* Get the agent's stopWhen configuration
|
|
652
658
|
*/
|
|
653
|
-
getStopWhen():
|
|
659
|
+
getStopWhen(): AgentStopWhen;
|
|
654
660
|
/**
|
|
655
|
-
* Get the
|
|
661
|
+
* Get the agent's status updates configuration
|
|
656
662
|
*/
|
|
657
663
|
getStatusUpdateSettings(): StatusUpdateSettings | undefined;
|
|
658
664
|
/**
|
|
659
|
-
* Get the summarizer model from the
|
|
665
|
+
* Get the summarizer model from the agent's model settings
|
|
660
666
|
*/
|
|
661
667
|
getSummarizerModel(): ModelSettings | undefined;
|
|
662
668
|
/**
|
|
663
|
-
* Get
|
|
669
|
+
* Get agent statistics
|
|
664
670
|
*/
|
|
665
671
|
getStats(): {
|
|
666
672
|
agentCount: number;
|
|
667
673
|
defaultSubAgent: string | null;
|
|
668
674
|
initialized: boolean;
|
|
669
|
-
|
|
675
|
+
agentId: string;
|
|
670
676
|
tenantId: string;
|
|
671
677
|
};
|
|
672
678
|
/**
|
|
673
|
-
* Validate the
|
|
679
|
+
* Validate the agent configuration
|
|
674
680
|
*/
|
|
675
681
|
validate(): {
|
|
676
682
|
valid: boolean;
|
|
@@ -690,19 +696,19 @@ declare class AgentGraph implements GraphInterface {
|
|
|
690
696
|
*/
|
|
691
697
|
private getProjectStopWhenDefaults;
|
|
692
698
|
/**
|
|
693
|
-
* Apply model inheritance hierarchy: Project ->
|
|
699
|
+
* Apply model inheritance hierarchy: Project -> Agent -> Agent
|
|
694
700
|
*/
|
|
695
701
|
private applyModelInheritance;
|
|
696
702
|
/**
|
|
697
|
-
* Apply stopWhen inheritance hierarchy: Project ->
|
|
703
|
+
* Apply stopWhen inheritance hierarchy: Project -> Agent -> Agent
|
|
698
704
|
*/
|
|
699
705
|
private applyStopWhenInheritance;
|
|
700
706
|
/**
|
|
701
|
-
* Propagate
|
|
707
|
+
* Propagate agent-level model settings to agents (supporting partial inheritance)
|
|
702
708
|
*/
|
|
703
709
|
private propagateModelSettingsToAgent;
|
|
704
710
|
/**
|
|
705
|
-
* Immediately propagate
|
|
711
|
+
* Immediately propagate agent-level models to all agents during construction
|
|
706
712
|
*/
|
|
707
713
|
private propagateImmediateModelSettings;
|
|
708
714
|
/**
|
|
@@ -746,7 +752,7 @@ interface ProjectConfig {
|
|
|
746
752
|
};
|
|
747
753
|
stopWhen?: StopWhen;
|
|
748
754
|
sandboxConfig?: SandboxConfig;
|
|
749
|
-
|
|
755
|
+
agents?: () => Agent[];
|
|
750
756
|
tools?: () => Tool[];
|
|
751
757
|
dataComponents?: () => DataComponent[];
|
|
752
758
|
artifactComponents?: () => ArtifactComponent[];
|
|
@@ -764,13 +770,13 @@ interface ProjectInterface {
|
|
|
764
770
|
getTenantId(): string;
|
|
765
771
|
getModels(): ProjectConfig['models'];
|
|
766
772
|
getStopWhen(): ProjectConfig['stopWhen'];
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
773
|
+
getAgents(): Agent[];
|
|
774
|
+
addAgent(agent: Agent): void;
|
|
775
|
+
removeAgent(id: string): boolean;
|
|
770
776
|
getStats(): {
|
|
771
777
|
projectId: string;
|
|
772
778
|
tenantId: string;
|
|
773
|
-
|
|
779
|
+
agentCount: number;
|
|
774
780
|
initialized: boolean;
|
|
775
781
|
};
|
|
776
782
|
validate(): {
|
|
@@ -781,8 +787,8 @@ interface ProjectInterface {
|
|
|
781
787
|
/**
|
|
782
788
|
* Project class for managing agent projects
|
|
783
789
|
*
|
|
784
|
-
* Projects are the top-level organizational unit that contains
|
|
785
|
-
* They provide model inheritance and execution limits that cascade down to
|
|
790
|
+
* Projects are the top-level organizational unit that contains agent, agents, and shared configurations.
|
|
791
|
+
* They provide model inheritance and execution limits that cascade down to agent and agents.
|
|
786
792
|
*
|
|
787
793
|
* @example
|
|
788
794
|
* ```typescript
|
|
@@ -791,8 +797,8 @@ interface ProjectInterface {
|
|
|
791
797
|
* name: 'Customer Support System',
|
|
792
798
|
* description: 'Multi-agent customer support system',
|
|
793
799
|
* models: {
|
|
794
|
-
* base: { model: 'gpt-
|
|
795
|
-
* structuredOutput: { model: 'gpt-
|
|
800
|
+
* base: { model: 'gpt-4.1-mini' },
|
|
801
|
+
* structuredOutput: { model: 'gpt-4.1' }
|
|
796
802
|
* },
|
|
797
803
|
* stopWhen: {
|
|
798
804
|
* transferCountIs: 10,
|
|
@@ -815,8 +821,8 @@ declare class Project implements ProjectInterface {
|
|
|
815
821
|
private models?;
|
|
816
822
|
private stopWhen?;
|
|
817
823
|
private sandboxConfig?;
|
|
818
|
-
private
|
|
819
|
-
private
|
|
824
|
+
private agents;
|
|
825
|
+
private agentMap;
|
|
820
826
|
private credentialReferences?;
|
|
821
827
|
private projectTools;
|
|
822
828
|
private projectDataComponents;
|
|
@@ -876,32 +882,33 @@ declare class Project implements ProjectInterface {
|
|
|
876
882
|
usage: Record<string, Array<{
|
|
877
883
|
type: string;
|
|
878
884
|
id: string;
|
|
879
|
-
|
|
885
|
+
agentId?: string;
|
|
880
886
|
}>>;
|
|
881
887
|
}>;
|
|
888
|
+
getFullDefinition(): Promise<FullProjectDefinition>;
|
|
882
889
|
/**
|
|
883
|
-
* Get all
|
|
890
|
+
* Get all agent in the project
|
|
884
891
|
*/
|
|
885
|
-
|
|
892
|
+
getAgents(): Agent[];
|
|
886
893
|
/**
|
|
887
|
-
* Get
|
|
894
|
+
* Get an agent by ID
|
|
888
895
|
*/
|
|
889
|
-
|
|
896
|
+
getAgent(id: string): Agent | undefined;
|
|
890
897
|
/**
|
|
891
|
-
* Add
|
|
898
|
+
* Add an agent to the project
|
|
892
899
|
*/
|
|
893
|
-
|
|
900
|
+
addAgent(agent: Agent): void;
|
|
894
901
|
/**
|
|
895
|
-
* Remove
|
|
902
|
+
* Remove an agent from the project
|
|
896
903
|
*/
|
|
897
|
-
|
|
904
|
+
removeAgent(id: string): boolean;
|
|
898
905
|
/**
|
|
899
906
|
* Get project statistics
|
|
900
907
|
*/
|
|
901
908
|
getStats(): {
|
|
902
909
|
projectId: string;
|
|
903
910
|
tenantId: string;
|
|
904
|
-
|
|
911
|
+
agentCount: number;
|
|
905
912
|
initialized: boolean;
|
|
906
913
|
};
|
|
907
914
|
/**
|
|
@@ -918,14 +925,14 @@ declare class Project implements ProjectInterface {
|
|
|
918
925
|
}
|
|
919
926
|
|
|
920
927
|
/**
|
|
921
|
-
* Helper function to create
|
|
928
|
+
* Helper function to create agent - OpenAI style
|
|
922
929
|
*/
|
|
923
|
-
declare function
|
|
930
|
+
declare function agent(config: AgentConfig): Agent;
|
|
924
931
|
/**
|
|
925
932
|
* Helper function to create projects - OpenAI style
|
|
926
933
|
*
|
|
927
|
-
* Projects are the top-level organizational unit that contains
|
|
928
|
-
* They provide model inheritance and execution limits that cascade down to
|
|
934
|
+
* Projects are the top-level organizational unit that contains agent, agents, and shared configurations.
|
|
935
|
+
* They provide model inheritance and execution limits that cascade down to agent and agents.
|
|
929
936
|
*
|
|
930
937
|
* @param config - Project configuration
|
|
931
938
|
* @returns A new Project instance
|
|
@@ -937,18 +944,18 @@ declare function agentGraph(config: GraphConfig): AgentGraph;
|
|
|
937
944
|
* name: 'Customer Support System',
|
|
938
945
|
* description: 'Multi-agent customer support system',
|
|
939
946
|
* models: {
|
|
940
|
-
* base: { model: 'gpt-
|
|
941
|
-
* structuredOutput: { model: 'gpt-
|
|
947
|
+
* base: { model: 'gpt-4.1-mini' },
|
|
948
|
+
* structuredOutput: { model: 'gpt-4.1' }
|
|
942
949
|
* },
|
|
943
950
|
* stopWhen: {
|
|
944
951
|
* transferCountIs: 10,
|
|
945
952
|
* stepCountIs: 50
|
|
946
953
|
* },
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* id: 'support-
|
|
950
|
-
* name: 'Support
|
|
951
|
-
* // ...
|
|
954
|
+
* agent: () => [
|
|
955
|
+
* agent({
|
|
956
|
+
* id: 'support-agent',
|
|
957
|
+
* name: 'Support Agent',
|
|
958
|
+
* // ... agent config
|
|
952
959
|
* })
|
|
953
960
|
* ]
|
|
954
961
|
* });
|
|
@@ -1236,39 +1243,39 @@ declare function deleteFullProjectViaAPI(tenantId: string, apiUrl: string, proje
|
|
|
1236
1243
|
|
|
1237
1244
|
declare class Runner {
|
|
1238
1245
|
/**
|
|
1239
|
-
* Run
|
|
1246
|
+
* Run an agent until completion, handling transfers and tool calls
|
|
1240
1247
|
* Similar to OpenAI's Runner.run() pattern
|
|
1241
|
-
* NOTE: This now requires
|
|
1248
|
+
* NOTE: This now requires an agent instead of an agent
|
|
1242
1249
|
*/
|
|
1243
|
-
static run(
|
|
1250
|
+
static run(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
1244
1251
|
/**
|
|
1245
|
-
* Stream
|
|
1252
|
+
* Stream an agent's response
|
|
1246
1253
|
*/
|
|
1247
|
-
static stream(
|
|
1254
|
+
static stream(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<StreamResponse>;
|
|
1248
1255
|
/**
|
|
1249
|
-
* Execute multiple
|
|
1256
|
+
* Execute multiple agent in parallel and return the first successful result
|
|
1250
1257
|
*/
|
|
1251
|
-
static
|
|
1258
|
+
static raceAgents(agent: AgentInterface[], messages: MessageInput, options?: GenerateOptions): Promise<RunResult>;
|
|
1252
1259
|
private static normalizeToMessageHistory;
|
|
1253
1260
|
/**
|
|
1254
|
-
* Validate
|
|
1261
|
+
* Validate agent configuration before running
|
|
1255
1262
|
*/
|
|
1256
|
-
static
|
|
1263
|
+
static validateAgent(agent: AgentInterface): {
|
|
1257
1264
|
valid: boolean;
|
|
1258
1265
|
errors: string[];
|
|
1259
1266
|
};
|
|
1260
1267
|
/**
|
|
1261
|
-
* Get execution statistics for
|
|
1268
|
+
* Get execution statistics for an agent
|
|
1262
1269
|
*/
|
|
1263
|
-
static getExecutionStats(
|
|
1270
|
+
static getExecutionStats(agent: AgentInterface, messages: MessageInput, options?: GenerateOptions): Promise<{
|
|
1264
1271
|
estimatedTurns: number;
|
|
1265
1272
|
estimatedTokens: number;
|
|
1266
|
-
|
|
1273
|
+
subAgentCount: number;
|
|
1267
1274
|
defaultSubAgent: string | undefined;
|
|
1268
1275
|
}>;
|
|
1269
1276
|
}
|
|
1270
1277
|
declare const run: typeof Runner.run;
|
|
1271
1278
|
declare const stream: typeof Runner.stream;
|
|
1272
|
-
declare const
|
|
1279
|
+
declare const raceAgents: typeof Runner.raceAgents;
|
|
1273
1280
|
|
|
1274
|
-
export {
|
|
1281
|
+
export { type AgentConfig, AgentError, type AgentInterface, type AgentResponse, type AgentTool, type AllSubAgentInterface, ArtifactComponent, type ArtifactComponentInterface, type ArtifactComponentWithZodProps, type AssistantMessage, type BuilderAgentConfig, type BuilderRelationConfig, type BuilderToolConfig, type CredentialReference, DataComponent, type DataComponentInterface, type DataComponentWithZodProps, ExternalAgent, type ExternalAgentInterface, type ExtractCredentialIds, type FetchDefinitionConfig, FunctionTool, type GenerateOptions, type MCPToolConfig, MaxTurnsExceededError, type Message, type MessageInput, Project, type RequestSchemaConfig, type RequestSchemaDefinition, type RunResult, Runner, type ServerConfig, type StreamEvent, type StreamResponse, SubAgent, type SubAgentCanUseType, type SubAgentConfig, type SubAgentInterface, type SystemMessage, Tool, type ToolCall, type ToolConfig, ToolExecutionError, type ToolMessage, type ToolResult, type TransferConfig, TransferError, type UnionCredentialIds, type UserMessage, agent, agentMcp, artifactComponent, createEnvironmentSettings, createFullProjectViaAPI, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, stream, subAgent, transfer, updateFullProjectViaAPI };
|