Skip to content

Commit a5e2e56

Browse files
committed
updated
1 parent 3d19558 commit a5e2e56

22 files changed

+18917
-289
lines changed

docs/api/apiaccess/agent/findAgent.md

Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -23,58 +23,8 @@ cbparameters:
2323
signatureTypeName: Promise
2424
description: A promise that resolves with a findAgentByTaskResponse object containing an array of found agents.
2525
typeArgs:
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
26+
- type: reference
27+
name: FindAgentByTaskResponse
7828
data:
7929
name: findAgent
8030
category: agent
@@ -83,6 +33,18 @@ data:
8333
<CBBaseInfo/>
8434
<CBParameters/>
8535

36+
### Response Structure
37+
38+
The method returns a Promise that resolves to a `FindAgentByTaskResponse` object with:
39+
- `type`: The response type, always "findAgentByTaskResponse"
40+
- `agents`: Array of found agents, each containing:
41+
- `type`: The agent type, typically "function"
42+
- `function`: Agent function details including:
43+
- `name`: The name/identifier of the agent
44+
- `description`: Detailed description of the agent's capabilities
45+
- `parameters`: Parameter specification object with type, properties, required fields, and additionalProperties flag
46+
- `strict`: Boolean indicating whether the agent enforces strict parameter validation
47+
8648
### Examples
8749

8850
```js
@@ -121,33 +83,6 @@ const filteredAgents = await codebolt.agent.findAgent(
12183
console.log("Filtered Agents:", filteredAgents);
12284
```
12385

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-
15186
### Notes
15287
- The `task` parameter should be a clear description of what you want the agent to do
15388
- When using `remote_only` or `local_only`, make sure you have agents available in those locations

docs/api/apiaccess/agent/getAgentsDetail.md

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cbparameters:
1212
description: A promise that resolves with the detailed information of the specified agents.
1313
typeArgs:
1414
- type: reference
15-
name: any
15+
name: AgentsDetailResponse
1616
data:
1717
name: getAgentsDetail
1818
category: agent
@@ -21,14 +21,75 @@ data:
2121
<CBBaseInfo/>
2222
<CBParameters/>
2323

24-
### Example
24+
### Response Structure
25+
26+
The method returns a Promise that resolves to an `AgentsDetailResponse` object with:
27+
- `type`: "agentsDetailResponse"
28+
- `messageId`: Unique message identifier string
29+
- `threadId`: Thread identifier string
30+
- `success`: Boolean indicating if the request was successful
31+
- `payload`: Object containing the actual data:
32+
- `agents`: Array of detailed agent objects, each containing:
33+
- `id`: Unique agent identifier
34+
- `name`: Agent display name
35+
- `description`: Agent description text
36+
- `capabilities`: Array of agent capabilities (may be empty)
37+
- `isLocal`: Boolean indicating if the agent is local
38+
- `version`: Version string of the agent
39+
- `status`: Numeric status code (1 = active)
40+
- `unique_id`: Unique identifier string for the agent
41+
42+
### Examples
2543

2644
```js
2745
// Example 1: Get details for specific agents
28-
const agentDetails = await codebolt.agent.getAgentsDetail(["agent-id-1", "agent-id-2"]);
29-
console.log("Agent Details:", agentDetails);
46+
// First, get the list of available agents
47+
const agentsList = await codebolt.agent.getAgentsList('downloaded');
48+
49+
if (agentsList?.agents && agentsList.agents.length > 0) {
50+
// Extract agent IDs from the first few agents
51+
const agentIds = agentsList.agents.slice(0, 3).map(agent => agent.function?.name);
52+
console.log('Agent IDs to get details for:', agentIds);
53+
54+
// Get detailed information for the selected agents
55+
const agentsDetailResult = await codebolt.agent.getAgentsDetail(agentIds);
56+
console.log('Agent details result type:', agentsDetailResult?.type); // "agentsDetailResponse"
57+
console.log('Message ID:', agentsDetailResult?.messageId);
58+
console.log('Success:', agentsDetailResult?.success);
59+
console.log('Details count:', agentsDetailResult?.payload?.agents?.length || 0);
60+
console.log('Agent details:', agentsDetailResult);
61+
62+
// Access individual agent details
63+
if (agentsDetailResult?.payload?.agents?.length > 0) {
64+
const firstAgent = agentsDetailResult.payload.agents[0];
65+
console.log('First agent ID:', firstAgent.id);
66+
console.log('First agent name:', firstAgent.name);
67+
console.log('First agent version:', firstAgent.version);
68+
console.log('First agent is local:', firstAgent.isLocal);
69+
}
70+
}
3071

31-
// Example 2: Get details for all agents
72+
// Example 2: Get details for all agents (using empty array)
3273
const allAgentDetails = await codebolt.agent.getAgentsDetail([]);
33-
console.log("All Agent Details:", allAgentDetails);
34-
```
74+
console.log('All agent details:', allAgentDetails);
75+
console.log('Success:', allAgentDetails?.success);
76+
console.log('Total agents:', allAgentDetails?.payload?.agents?.length || 0);
77+
78+
// Display each agent's key information
79+
if (allAgentDetails?.payload?.agents) {
80+
allAgentDetails.payload.agents.forEach((agent, index) => {
81+
console.log(`Agent ${index + 1}:`);
82+
console.log(` - ID: ${agent.id}`);
83+
console.log(` - Name: ${agent.name}`);
84+
console.log(` - Version: ${agent.version}`);
85+
console.log(` - Status: ${agent.status}`);
86+
console.log(` - Is Local: ${agent.isLocal}`);
87+
console.log(` - Unique ID: ${agent.unique_id}`);
88+
});
89+
}
90+
```
91+
92+
### Usage Notes
93+
94+
- Agent IDs can be obtained from the `getAgentsList()` method using `agent.function?.name`
95+
- Pass an empty array `[]` to get details for all available agents

docs/api/apiaccess/agent/getAgentsList.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ cbbaseinfo:
55
cbparameters:
66
parameters:
77
- name: type
8-
typeName: Agents
9-
description: The type of agents to list (LOCAL, ALL, DOWNLOADED). Default is DOWNLOADED.
8+
typeName: string
9+
description: The type of agents to list ('downloaded', 'all', 'local'). Default is 'downloaded'.
1010
returns:
1111
signatureTypeName: Promise
1212
description: A promise that resolves with the list of agents
1313
typeArgs:
1414
- type: reference
15-
name: any
15+
name: AgentsListResponse
1616
data:
1717
name: getAgentsList
1818
category: agent
@@ -21,19 +21,37 @@ data:
2121
<CBBaseInfo/>
2222
<CBParameters/>
2323

24-
### Example
24+
### Response Structure
25+
26+
The method returns a Promise that resolves to an `AgentsListResponse` object with:
27+
- `type`: Response type identifier
28+
- `agents`: Array of agent objects containing agent information
29+
30+
### Examples
2531

2632
```js
2733
// Example 1: Getting list of downloaded agents (default)
28-
const downloadedAgents = await codebolt.agent.getAgentsList();
29-
console.log("Downloaded Agents:", downloadedAgents);
34+
const downloadedAgents = await codebolt.agent.getAgentsList('downloaded');
35+
console.log('✅ Agents list result:', downloadedAgents);
36+
console.log(' - Type:', downloadedAgents?.type);
37+
console.log(' - Agents count:', downloadedAgents?.agents?.length || 0);
38+
if (downloadedAgents?.agents?.length > 0) {
39+
console.log(' - First agent:', downloadedAgents.agents[0]);
40+
// Agent IDs can be extracted using agent.function?.name
41+
const agentId = downloadedAgents.agents[0].function?.name;
42+
console.log(' - First agent ID:', agentId);
43+
}
3044

31-
// Example 2: Getting list of local agents
32-
const localAgents = await codebolt.agent.getAgentsList("local");
33-
console.log("Local Agents:", localAgents);
45+
// Example 2: Getting list of all agents
46+
const allAgents = await codebolt.agent.getAgentsList('all');
47+
console.log('✅ All agents result:', allAgents);
48+
console.log(' - Type:', allAgents?.type);
49+
console.log(' - Total agents count:', allAgents?.agents?.length || 0);
3450

35-
// Example 3: Getting list of all agents
36-
const allAgents = await codebolt.agent.getAgentsList("ALL");
37-
console.log("All Agents:", allAgents);
51+
// Example 3: Getting list of local agents
52+
const localAgents = await codebolt.agent.getAgentsList('local');
53+
console.log('✅ Local agents result:', localAgents);
54+
console.log(' - Type:', localAgents?.type);
55+
console.log(' - Local agents count:', localAgents?.agents?.length || 0);
3856
```
3957

docs/api/apiaccess/agent/startAgent.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cbparameters:
1515
description: A promise that resolves when the agent has been successfully started.
1616
typeArgs:
1717
- type: reference
18-
name: any
18+
name: StartAgentResponse
1919
data:
2020
name: startAgent
2121
category: agent
@@ -24,11 +24,61 @@ data:
2424
<CBBaseInfo/>
2525
<CBParameters/>
2626

27-
### Example
27+
### Response Structure
28+
29+
The method returns a Promise that resolves to a `StartAgentResponse` object with:
30+
- `status`: Status of the agent start operation
31+
- `type`: Response type identifier
32+
- Additional agent-specific response data
33+
34+
### Examples
2835

2936
```js
30-
// Example: Starting an agent for a task
31-
const startResponse = await codebolt.agent.startAgent("agent-123", "dataProcessing");
32-
console.log("Agent Start Response:", startResponse);
37+
// Example 1: Complete workflow - Find and start an agent
38+
try {
39+
// First, find an appropriate agent for the task
40+
const findResult = await codebolt.agent.findAgent(
41+
'create node js app',
42+
10, // maxResult
43+
[], // agents filter
44+
'remote_only', // agentLocation
45+
'use_both' // getFrom
46+
);
47+
48+
console.log('✅ Find result:', findResult);
49+
50+
if (findResult?.agents && findResult.agents.length > 0) {
51+
// Extract agent ID from the found agent
52+
const agentId = findResult.agents[0].function?.name ||
53+
findResult.agents[0].id ||
54+
findResult.agents[0].name;
55+
56+
const startTask = 'Hi how are you';
57+
console.log('✅ Starting agent:', agentId, 'with task:', startTask);
58+
59+
// Start the agent with the task
60+
const startAgentResult = await codebolt.agent.startAgent("act", startTask);
61+
62+
console.log('✅ Start agent result:', startAgentResult);
63+
console.log(' - Agent ID:', agentId);
64+
console.log(' - Task:', startTask);
65+
console.log(' - Status:', startAgentResult?.status);
66+
console.log(' - Response type:', startAgentResult?.type);
67+
} else {
68+
console.log('⚠️ No agents found to start');
69+
}
70+
} catch (error) {
71+
console.log('⚠️ Agent starting failed:', error.message);
72+
}
73+
74+
// Example 2: Direct agent start (if you know the agent ID)
75+
try {
76+
const startResponse = await codebolt.agent.startAgent("act", "Help me with data analysis");
77+
console.log('Agent started successfully:', startResponse);
78+
console.log('Status:', startResponse?.status);
79+
console.log('Type:', startResponse?.type);
80+
} catch (error) {
81+
console.error('Failed to start agent:', error.message);
82+
}
3383

3484
```

0 commit comments

Comments
 (0)