@@ -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
1616data :
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)
3273const 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
0 commit comments