1
1
---
2
2
name : FindAgent
3
3
cbbaseinfo :
4
- description : Finds an agent suitable for the specified task.
4
+ description : Finds an agent suitable for the specified task using AI and/or vector database filtering .
5
5
cbparameters :
6
6
parameters :
7
7
- name : task
8
8
typeName : string
9
- description : The task for which an agent is needed.
9
+ description : The task description for which an agent is needed (e.g., "Write a function to sum of Two number", "create node js app") .
10
10
- name : maxResult
11
11
typeName : number
12
- description : Maximum number of agents to return (default 1).
12
+ description : Maximum number of agents to return (default 1, commonly used values are 3-10 ).
13
13
- name : agents
14
14
typeName : array
15
- description : List of agents to filter in vector database (empty array for no filtering).
15
+ description : List of specific agent names/IDs to filter in vector database (empty array for no filtering).
16
16
- name : agentLocation
17
- typeName : AgentLocation
18
- description : Location preference for agents (ALL, LOCAL_ONLY, REMOTE_ONLY) . Default is ALL .
17
+ typeName : string
18
+ description : Location preference for agents. Valid values are 'remote_only', 'local_only', 'all' . Default is 'all' .
19
19
- name : getFrom
20
- typeName : FilterUsing
21
- description : Filtering method (USE_AI, USE_VECTOR_DB, USE_BOTH) . Default is USE_VECTOR_DB .
20
+ typeName : string
21
+ description : Filtering method. Valid values are 'use_ai', 'use_vector_db', 'use_both' . Default is 'use_vector_db' .
22
22
returns :
23
23
signatureTypeName : Promise
24
- description : A promise that resolves with the agent details .
24
+ description : A promise that resolves with a findAgentByTaskResponse object containing an array of found agents .
25
25
typeArgs :
26
- - type : reference
27
- name : any
26
+ - type : object
27
+ properties :
28
+ type :
29
+ type : string
30
+ description : The response type, always "findAgentByTaskResponse"
31
+ agents :
32
+ type : array
33
+ description : Array of found agents
34
+ items :
35
+ type : object
36
+ properties :
37
+ type :
38
+ type : string
39
+ description : The agent type, typically "function"
40
+ function :
41
+ type : object
42
+ properties :
43
+ name :
44
+ type : string
45
+ description : The name/identifier of the agent
46
+ description :
47
+ type : string
48
+ description : Detailed description of the agent's capabilities
49
+ parameters :
50
+ type : object
51
+ properties :
52
+ type :
53
+ type : string
54
+ description : Parameter type, typically "object"
55
+ properties :
56
+ type : object
57
+ properties :
58
+ task :
59
+ type : object
60
+ properties :
61
+ type :
62
+ type : string
63
+ description : Parameter type, typically "string"
64
+ description :
65
+ type : string
66
+ description : Description of the task parameter
67
+ required :
68
+ type : array
69
+ items :
70
+ type : string
71
+ description : Array of required parameter names
72
+ additionalProperties :
73
+ type : boolean
74
+ description : Whether additional properties are allowed
75
+ strict :
76
+ type : boolean
77
+ description : Whether the agent enforces strict parameter validation
28
78
data :
29
79
name : findAgent
30
80
category : agent
@@ -36,28 +86,72 @@ data:
36
86
### Examples
37
87
38
88
``` js
39
- // Example 1: Find a single agent for a task using default parameters
40
- const agent = await codebolt .agent .findAgent (" dataProcessing " );
89
+ // Example 1: Find agents for a specific task with default parameters
90
+ const agent = await codebolt .agent .findAgent (" Write a function to sum of Two number " );
41
91
console .log (" Found Agent:" , agent);
42
92
43
- // Example 2: Find multiple agents with specific filters
93
+ // Example 2: Find multiple agents with remote-only preference
44
94
const agents = await codebolt .agent .findAgent (
45
- " imageProcessing " ,
46
- 3 , // maxResult
47
- [], // agents
48
- codebolt . agent . AgentLocation . LOCAL_ONLY ,
49
- codebolt . agent . FilterUsing . USE_VECTOR_DB
95
+ " create node js app " ,
96
+ 10 , // maxResult
97
+ [], // agents filter
98
+ ' remote_only ' , // agentLocation
99
+ ' use_both ' // getFrom
50
100
);
51
101
console .log (" Found Agents:" , agents);
52
102
53
- // Example 3: Find agents using AI filtering
103
+ // Example 3: Find agents using AI filtering with local-only preference
54
104
const aiFilteredAgents = await codebolt .agent .findAgent (
55
- " naturalLanguageProcessing " ,
56
- 2 ,
105
+ " Analyze data and provide insights " ,
106
+ 1 ,
57
107
[],
58
- codebolt . agent . AgentLocation . ALL ,
59
- codebolt . agent . FilterUsing . USE_AI
108
+ ' local_only ' ,
109
+ ' use_ai '
60
110
);
61
111
console .log (" AI Filtered Agents:" , aiFilteredAgents);
112
+
113
+ // Example 4: Find agents with specific agent filtering
114
+ const filteredAgents = await codebolt .agent .findAgent (
115
+ " Code generation task" ,
116
+ 2 ,
117
+ [' agent1' , ' agent2' ], // specific agents to filter
118
+ ' all' ,
119
+ ' use_both'
120
+ );
121
+ console .log (" Filtered Agents:" , filteredAgents);
62
122
```
63
123
124
+ ### Response example:
125
+ ``` js
126
+ {
127
+ " type" : " findAgentByTaskResponse" ,
128
+ " agents" : [
129
+ {
130
+ " type" : " function" ,
131
+ " function" : {
132
+ " name" : " documentaionagent" ,
133
+ " description" : " A basic agent designed for the Codebolt platform..." ,
134
+ " parameters" : {
135
+ " type" : " object" ,
136
+ " properties" : {
137
+ " task" : {
138
+ " type" : " string" ,
139
+ " description" : " The specific task to execute."
140
+ }
141
+ },
142
+ " required" : [" task" ],
143
+ " additionalProperties" : false
144
+ },
145
+ " strict" : true
146
+ }
147
+ }
148
+ ]
149
+ }
150
+
151
+ ### Notes
152
+ - The ` task` parameter should be a clear description of what you want the agent to do
153
+ - When using ` remote_only` or ` local_only` , make sure you have agents available in those locations
154
+ - Using ` use_both` for filtering provides the most comprehensive results but may be slower
155
+ - The returned agents array contains detailed information about each agent including their capabilities and metadata
156
+ - Each agent in the response includes its function signature and parameter requirements
157
+
0 commit comments