Skip to content

Commit d122298

Browse files
committed
updated
1 parent 1c8a42c commit d122298

File tree

1 file changed

+118
-24
lines changed

1 file changed

+118
-24
lines changed

docs/api/apiaccess/agent/findAgent.md

Lines changed: 118 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,80 @@
11
---
22
name: FindAgent
33
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.
55
cbparameters:
66
parameters:
77
- name: task
88
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").
1010
- name: maxResult
1111
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).
1313
- name: agents
1414
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).
1616
- 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'.
1919
- 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'.
2222
returns:
2323
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.
2525
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
2878
data:
2979
name: findAgent
3080
category: agent
@@ -36,28 +86,72 @@ data:
3686
### Examples
3787

3888
```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");
4191
console.log("Found Agent:", agent);
4292

43-
// Example 2: Find multiple agents with specific filters
93+
// Example 2: Find multiple agents with remote-only preference
4494
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
50100
);
51101
console.log("Found Agents:", agents);
52102

53-
// Example 3: Find agents using AI filtering
103+
// Example 3: Find agents using AI filtering with local-only preference
54104
const aiFilteredAgents = await codebolt.agent.findAgent(
55-
"naturalLanguageProcessing",
56-
2,
105+
"Analyze data and provide insights",
106+
1,
57107
[],
58-
codebolt.agent.AgentLocation.ALL,
59-
codebolt.agent.FilterUsing.USE_AI
108+
'local_only',
109+
'use_ai'
60110
);
61111
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);
62122
```
63123

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

Comments
 (0)