Skip to content

Commit 7250e75

Browse files
committed
updated docs
1 parent 34c9a12 commit 7250e75

File tree

7 files changed

+307
-286
lines changed

7 files changed

+307
-286
lines changed

docs/api/apiaccess/agent/findAgent.md

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ cbparameters:
99
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, commonly used values are 3-10).
12+
description: "Optional: Maximum number of agents to return. Defaults to 1."
1313
- name: agents
1414
typeName: array
15-
description: List of specific agent names/IDs to filter in vector database (empty array for no filtering).
15+
description: "Optional: List of specific agent names or IDs to filter from the vector database. Defaults to an empty array (no filtering)."
1616
- name: agentLocation
1717
typeName: string
18-
description: Location preference for agents. Valid values are 'remote_only', 'local_only', 'all'. Default is 'all'.
18+
description: "Optional: Location preference for agents. Defaults to 'all'. Possible values are 'all', 'local_only', 'remote_only'."
1919
- name: getFrom
2020
typeName: string
21-
description: Filtering method. Valid values are 'use_ai', 'use_vector_db', 'use_both'. Default is 'use_vector_db'.
21+
description: "Optional: The filtering method to use. Defaults to 'use_vector_db'. Possible values are 'use_ai', 'use_vector_db', 'use_both'."
2222
returns:
23-
signatureTypeName: Promise
24-
description: A promise that resolves with a findAgentByTaskResponse object containing an array of found agents.
25-
typeArgs:
26-
- type: reference
27-
name: FindAgentByTaskResponse
23+
signatureTypeName: Promise<FindAgentByTaskResponse>
24+
description: A promise that resolves with a `FindAgentByTaskResponse` object containing an array of found agents.
2825
data:
2926
name: findAgent
3027
category: agent
@@ -37,66 +34,63 @@ data:
3734

3835
The method returns a Promise that resolves to a `FindAgentByTaskResponse` object with the following properties:
3936

40-
**Response Properties:**
41-
- `type`: Always "findAgentByTaskResponse"
42-
- `agents`: Optional array of agent objects containing found agents
43-
- `success`: Optional boolean indicating if the operation was successful
44-
- `message`: Optional string with additional information
45-
- `error`: Optional string containing error details if the operation failed
46-
- `messageId`: Optional unique identifier for the message
47-
- `threadId`: Optional thread identifier
37+
- **`type`** (string): Always "findAgentByTaskResponse".
38+
- **`agents`** (array, optional): An array of agent objects that match the task.
39+
- **`success`** (boolean, optional): Indicates if the operation was successful.
40+
- **`message`** (string, optional): A message with additional information.
41+
- **`error`** (string, optional): Error details if the operation failed.
42+
- **`messageId`** (string, optional): A unique identifier for the message.
43+
- **`threadId`** (string, optional): The thread identifier.
4844

49-
**Agent Structure:**
5045
Each agent in the `agents` array has the following structure:
51-
- `type`: Always "function"
52-
- `function`: Agent function details including:
53-
- `name`: The name/identifier of the agent
54-
- `description`: Detailed description of the agent's capabilities
55-
- `parameters`: Parameter specification object with type, properties, required fields, and additionalProperties flag
56-
- `strict`: Optional boolean indicating whether the agent enforces strict parameter validation
46+
- **`type`** (string): Always "function".
47+
- **`function`** (object): Details of the agent function, including:
48+
- **`name`** (string): The name or identifier of the agent.
49+
- **`description`** (string): A detailed description of the agent's capabilities.
50+
- **`parameters`** (object): An object specifying the parameters the agent accepts.
51+
- **`strict`** (boolean, optional): Indicates if the agent enforces strict parameter validation.
5752

5853
### Examples
5954

60-
```js
61-
// Example 1: Find agents for a specific task with default parameters
62-
const agent = await codebolt.agent.findAgent("Write a function to sum of Two number");
55+
```javascript
56+
// Example 1: Find the single best agent for a task (default parameters)
57+
const agent = await codebolt.agent.findAgent("Write a function to calculate the factorial of a number");
6358
console.log("Found Agent:", agent);
6459

65-
// Example 2: Find multiple agents with remote-only preference
60+
// Example 2: Find up to 5 agents for a task, searching both local and remote
6661
const agents = await codebolt.agent.findAgent(
67-
"create node js app",
68-
10, // maxResult
69-
[], // agents filter
70-
'remote_only', // agentLocation
62+
"Create a simple Express.js server",
63+
5, // maxResult
64+
[], // agents (no filter)
65+
'all', // agentLocation
7166
'use_both' // getFrom
7267
);
7368
console.log("Found Agents:", agents);
7469

75-
// Example 3: Find agents using AI filtering with local-only preference
76-
const aiFilteredAgents = await codebolt.agent.findAgent(
77-
"Analyze data and provide insights",
70+
// Example 3: Find a local agent using only AI filtering
71+
const aiFilteredAgent = await codebolt.agent.findAgent(
72+
"Analyze a dataset and create a visualization",
7873
1,
7974
[],
8075
'local_only',
8176
'use_ai'
8277
);
83-
console.log("AI Filtered Agents:", aiFilteredAgents);
78+
console.log("AI Filtered Agent:", aiFilteredAgent);
8479

85-
// Example 4: Find agents with specific agent filtering
86-
const filteredAgents = await codebolt.agent.findAgent(
87-
"Code generation task",
88-
2,
89-
['agent1', 'agent2'], // specific agents to filter
90-
'all',
91-
'use_both'
80+
// Example 4: Find specific agents by name/ID from remote agents
81+
const specificAgents = await codebolt.agent.findAgent(
82+
"Generate a CI/CD pipeline for a Node.js project",
83+
3,
84+
['ci-builder-agent', 'deployment-helper'], // specific agents to filter
85+
'remote_only',
86+
'use_vector_db'
9287
);
93-
console.log("Filtered Agents:", filteredAgents);
88+
console.log("Filtered Agents:", specificAgents);
9489
```
9590

9691
### Notes
97-
- The `task` parameter should be a clear description of what you want the agent to do
98-
- When using `remote_only` or `local_only`, make sure you have agents available in those locations
99-
- Using `use_both` for filtering provides the most comprehensive results but may be slower
100-
- The returned agents array contains detailed information about each agent including their capabilities and metadata
101-
- Each agent in the response includes its function signature and parameter requirements
92+
- The `task` parameter should be a clear and concise description of the desired action.
93+
- `agentLocation` helps you control where to search for agents, which can be useful for security or performance reasons.
94+
- `getFrom` allows you to choose between a faster vector-based search, a more intelligent AI-based search, or a combination of both.
95+
- The response will contain a list of agents that you can then use with `codebolt.agent.startAgent`.
10296

docs/api/apiaccess/agent/getAgentsDetail.md

Lines changed: 50 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ cbparameters:
66
parameters:
77
- name: agentList
88
typeName: array
9-
description: List of agent IDs to get details for (empty array for all agents).
9+
description: "Optional: An array of agent IDs to get details for. If the array is empty, it retrieves details for all agents. Defaults to an empty array."
1010
returns:
11-
signatureTypeName: Promise
12-
description: A promise that resolves with the detailed information of the specified agents.
13-
typeArgs:
14-
- type: reference
15-
name: AgentsDetailResponse
11+
signatureTypeName: Promise<AgentsDetailResponse>
12+
description: A promise that resolves with an `AgentsDetailResponse` object containing the detailed information of the specified agents.
1613
data:
1714
name: getAgentsDetail
1815
category: agent
@@ -25,87 +22,65 @@ data:
2522

2623
The method returns a Promise that resolves to an `AgentsDetailResponse` object with the following properties:
2724

28-
**Response Properties:**
29-
- `type`: Always "agentsDetailResponse"
30-
- `payload`: Optional object containing the actual agent details data
31-
- `agents`: Array of agent detail objects with detailed agent information
32-
- `success`: Optional boolean indicating if the operation was successful
33-
- `message`: Optional string with additional information
34-
- `error`: Optional string containing error details if the operation failed
35-
- `messageId`: Optional unique identifier for the message
36-
- `threadId`: Optional thread identifier
25+
- **`type`** (string): Always "agentsDetailResponse".
26+
- **`payload`** (object, optional): An object containing the agent details.
27+
- **`agents`** (array): An array of agent detail objects.
28+
- **`success`** (boolean, optional): Indicates if the operation was successful.
29+
- **`message`** (string, optional): A message with additional information.
30+
- **`error`** (string, optional): Error details if the operation failed.
31+
- **`messageId`** (string, optional): A unique identifier for the message.
32+
- **`threadId`** (string, optional): The thread identifier.
3733

38-
**Agent Detail Structure:**
3934
Each agent in the `payload.agents` array has the following structure:
40-
- `id`: Unique agent identifier
41-
- `name`: Agent display name
42-
- `description`: Agent description text
43-
- `capabilities`: Optional array of agent capabilities
44-
- `isLocal`: Boolean indicating if the agent is local
45-
- `version`: Version string of the agent
46-
- `status`: String status of the agent
47-
- `unique_id`: Unique identifier string for the agent
35+
- **`id`** (string): The unique identifier of the agent.
36+
- **`name`** (string): The display name of the agent.
37+
- **`description`** (string): A description of the agent's capabilities.
38+
- **`capabilities`** (array, optional): An array of strings describing the agent's capabilities.
39+
- **`isLocal`** (boolean): `true` if the agent is local, `false` otherwise.
40+
- **`version`** (string): The version of the agent.
41+
- **`status`** (string): The current status of the agent (e.g., "enabled", "disabled").
42+
- **`unique_id`** (string): Another unique identifier for the agent.
4843

4944
### Examples
5045

51-
```js
52-
// Example 1: Get details for specific agents
53-
// First, get the list of available agents
54-
const agentsList = await codebolt.agent.getAgentsList('downloaded');
55-
56-
if (agentsList?.agents && agentsList.agents.length > 0) {
57-
// Extract agent IDs from the first few agents
58-
const agentIds = agentsList.agents.slice(0, 3).map(agent => agent.function?.name);
59-
console.log('Agent IDs to get details for:', agentIds);
46+
```javascript
47+
// Example 1: Get details for a few specific agents
48+
async function getSpecificAgentDetails() {
49+
// First, get a list of available agents
50+
const listResponse = await codebolt.agent.getAgentsList('downloaded');
51+
52+
if (listResponse?.agents && listResponse.agents.length > 0) {
53+
// Get the IDs of the first two agents
54+
const agentIds = listResponse.agents.slice(0, 2).map(agent => agent.function.name);
6055

61-
// Get detailed information for the selected agents
62-
const agentsDetailResult = await codebolt.agent.getAgentsDetail(agentIds);
63-
console.log('Agent details result type:', agentsDetailResult?.type); // "agentsDetailResponse"
64-
console.log('Success:', agentsDetailResult?.success);
65-
console.log('Message ID:', agentsDetailResult?.messageId);
66-
console.log('Thread ID:', agentsDetailResult?.threadId);
67-
console.log('Details count:', agentsDetailResult?.payload?.agents?.length || 0);
68-
console.log('Agent details:', agentsDetailResult);
56+
console.log("Requesting details for agent IDs:", agentIds);
6957

70-
// Access individual agent details
71-
if (agentsDetailResult?.payload?.agents?.length > 0) {
72-
const firstAgent = agentsDetailResult.payload.agents[0];
73-
console.log('First agent ID:', firstAgent.id);
74-
console.log('First agent name:', firstAgent.name);
75-
console.log('First agent description:', firstAgent.description);
76-
console.log('First agent version:', firstAgent.version);
77-
console.log('First agent is local:', firstAgent.isLocal);
78-
console.log('First agent status:', firstAgent.status);
79-
console.log('First agent unique_id:', firstAgent.unique_id);
80-
console.log('First agent capabilities:', firstAgent.capabilities);
58+
// Get the details for the selected agents
59+
const detailsResponse = await codebolt.agent.getAgentsDetail(agentIds);
60+
console.log("Agent Details:", detailsResponse);
61+
62+
if (detailsResponse.success) {
63+
detailsResponse.payload.agents.forEach(agent => {
64+
console.log(`- Name: ${agent.name}, Version: ${agent.version}, Status: ${agent.status}`);
65+
});
8166
}
67+
}
8268
}
69+
getSpecificAgentDetails();
8370

84-
// Example 2: Get details for all agents (using empty array)
85-
const allAgentDetails = await codebolt.agent.getAgentsDetail([]);
86-
console.log('All agent details:', allAgentDetails);
87-
console.log('Success:', allAgentDetails?.success);
88-
console.log('Type:', allAgentDetails?.type);
89-
console.log('Total agents:', allAgentDetails?.payload?.agents?.length || 0);
71+
// Example 2: Get details for all available agents
72+
async function getAllAgentDetails() {
73+
// Pass an empty array to get details for all agents
74+
const allDetails = await codebolt.agent.getAgentsDetail([]);
75+
console.log("All Agent Details:", allDetails);
9076

91-
// Display each agent's key information
92-
if (allAgentDetails?.payload?.agents) {
93-
allAgentDetails.payload.agents.forEach((agent, index) => {
94-
console.log(`Agent ${index + 1}:`);
95-
console.log(` - ID: ${agent.id}`);
96-
console.log(` - Name: ${agent.name}`);
97-
console.log(` - Description: ${agent.description}`);
98-
console.log(` - Version: ${agent.version}`);
99-
console.log(` - Status: ${agent.status}`);
100-
console.log(` - Is Local: ${agent.isLocal}`);
101-
console.log(` - Unique ID: ${agent.unique_id}`);
102-
console.log(` - Capabilities: ${agent.capabilities || 'None'}`);
103-
});
77+
if (allDetails.success) {
78+
console.log(`Found details for ${allDetails.payload.agents.length} agents.`);
79+
}
10480
}
81+
getAllAgentDetails();
10582
```
10683
10784
### Usage Notes
108-
109-
- Agent IDs can be obtained from the `getAgentsList()` method using `agent.function?.name`
110-
- Pass an empty array `[]` to get details for all available agents
111-
- The response includes both basic WebSocket response properties and detailed agent information in the `payload` field
85+
- You can obtain agent IDs from the `getAgentsList()` method. The ID is typically found in `agent.function.name`.
86+
- This function is useful for getting a deeper understanding of an agent's capabilities, version, and status before using it.

0 commit comments

Comments
 (0)