@@ -12,10 +12,10 @@ The `subAgent` tool creates a sub-agent that runs synchronously until completion
12
12
``` typescript
13
13
subAgent ({
14
14
description: " A brief description of the sub-agent's purpose" ,
15
- goal: " The main objective that the sub-agent needs to achieve" ,
16
- projectContext: " Context about the problem or environment" ,
17
- workingDirectory: " /path/to/working/directory" , // optional
18
- relevantFilesDirectories: " src/**/*.ts" , // optional
15
+ goal: ' The main objective that the sub-agent needs to achieve' ,
16
+ projectContext: ' Context about the problem or environment' ,
17
+ workingDirectory: ' /path/to/working/directory' , // optional
18
+ relevantFilesDirectories: ' src/**/*.ts' , // optional
19
19
});
20
20
```
21
21
@@ -35,10 +35,10 @@ The `agentStart` tool creates a sub-agent and immediately returns an instance ID
35
35
``` typescript
36
36
const { instanceId } = agentStart ({
37
37
description: " A brief description of the sub-agent's purpose" ,
38
- goal: " The main objective that the sub-agent needs to achieve" ,
39
- projectContext: " Context about the problem or environment" ,
40
- workingDirectory: " /path/to/working/directory" , // optional
41
- relevantFilesDirectories: " src/**/*.ts" , // optional
38
+ goal: ' The main objective that the sub-agent needs to achieve' ,
39
+ projectContext: ' Context about the problem or environment' ,
40
+ workingDirectory: ' /path/to/working/directory' , // optional
41
+ relevantFilesDirectories: ' src/**/*.ts' , // optional
42
42
enableUserPrompt: false , // optional, default: false
43
43
});
44
44
```
@@ -50,22 +50,22 @@ The `agentMessage` tool allows interaction with a running sub-agent. It can be u
50
50
``` typescript
51
51
// Check agent progress
52
52
const { output, completed } = agentMessage ({
53
- instanceId: " agent-instance-id" ,
54
- description: " Checking agent progress" ,
53
+ instanceId: ' agent-instance-id' ,
54
+ description: ' Checking agent progress' ,
55
55
});
56
56
57
57
// Provide guidance (note: guidance implementation is limited in the current version)
58
58
agentMessage ({
59
- instanceId: " agent-instance-id" ,
60
- guidance: " Focus on the task at hand and avoid unnecessary exploration" ,
61
- description: " Providing guidance to the agent" ,
59
+ instanceId: ' agent-instance-id' ,
60
+ guidance: ' Focus on the task at hand and avoid unnecessary exploration' ,
61
+ description: ' Providing guidance to the agent' ,
62
62
});
63
63
64
64
// Terminate the agent
65
65
agentMessage ({
66
- instanceId: " agent-instance-id" ,
66
+ instanceId: ' agent-instance-id' ,
67
67
terminate: true ,
68
- description: " Terminating the agent" ,
68
+ description: ' Terminating the agent' ,
69
69
});
70
70
```
71
71
@@ -74,15 +74,15 @@ agentMessage({
74
74
``` typescript
75
75
// Start multiple sub-agents
76
76
const agent1 = agentStart ({
77
- description: " Agent 1" ,
78
- goal: " Implement feature A" ,
79
- projectContext: " Project X" ,
77
+ description: ' Agent 1' ,
78
+ goal: ' Implement feature A' ,
79
+ projectContext: ' Project X' ,
80
80
});
81
81
82
82
const agent2 = agentStart ({
83
- description: " Agent 2" ,
84
- goal: " Implement feature B" ,
85
- projectContext: " Project X" ,
83
+ description: ' Agent 2' ,
84
+ goal: ' Implement feature B' ,
85
+ projectContext: ' Project X' ,
86
86
});
87
87
88
88
// Check progress of both agents
@@ -93,27 +93,27 @@ while (!agent1Completed || !agent2Completed) {
93
93
if (! agent1Completed ) {
94
94
const result1 = agentMessage ({
95
95
instanceId: agent1 .instanceId ,
96
- description: " Checking Agent 1 progress" ,
96
+ description: ' Checking Agent 1 progress' ,
97
97
});
98
98
agent1Completed = result1 .completed ;
99
-
99
+
100
100
if (agent1Completed ) {
101
- console .log (" Agent 1 completed with result:" , result1 .output );
101
+ console .log (' Agent 1 completed with result:' , result1 .output );
102
102
}
103
103
}
104
-
104
+
105
105
if (! agent2Completed ) {
106
106
const result2 = agentMessage ({
107
107
instanceId: agent2 .instanceId ,
108
- description: " Checking Agent 2 progress" ,
108
+ description: ' Checking Agent 2 progress' ,
109
109
});
110
110
agent2Completed = result2 .completed ;
111
-
111
+
112
112
if (agent2Completed ) {
113
- console .log (" Agent 2 completed with result:" , result2 .output );
113
+ console .log (' Agent 2 completed with result:' , result2 .output );
114
114
}
115
115
}
116
-
116
+
117
117
// Wait before checking again
118
118
if (! agent1Completed || ! agent2Completed ) {
119
119
sleep ({ seconds: 5 });
@@ -127,4 +127,4 @@ while (!agent1Completed || !agent2Completed) {
127
127
- Use ` agentStart ` and ` agentMessage ` for:
128
128
- Parallel execution of multiple sub-agents
129
129
- Tasks where you need to monitor progress
130
- - Situations where you may need to provide guidance or terminate early
130
+ - Situations where you may need to provide guidance or terminate early
0 commit comments