Creates a new AgentGroup instance
Initializes an agent group with the provided configuration data and optional URI. The agent group represents a collection of AI agents that can work together.
Agent group configuration data
Optionaluri: stringOptional URI path for the agent group endpoint. Defaults to '/group'
Get the image functionality for this agent group
This getter provides access to the agent group's image operations through the Image class. It allows for image uploads and other image-related operations specific to this agent group.
A new Image instance configured for this agent group
Get the chat functionality for this agent group
This getter provides access to the group's collaborative chat capabilities through the Chat class. It enables coordinated responses from multiple agents within the group.
A new Chat instance configured for this agent group
Basic group chat:
const response = await group.chat.completions.create({
messages: [
{ role: 'user', content: 'I need help with a complex issue.' }
]
});
Advanced group chat with context:
const response = await group.chat.completions.create({
messages: [
{
role: 'system',
content: 'You are a collaborative team of experts.'
},
{
role: 'user',
content: 'This problem requires both technical and billing expertise.'
}
],
temperature: 0.7,
max_tokens: 200
});
console.log('Team response:', response.choices[0].message.content);
Like or unlike this agent group
Toggles the like status of this agent group. If the group is already liked, it will be unliked, and vice versa.
Promise that resolves to the updated agent group instance
Check if the entity is active
This method checks the active status of the entity. Most entities in the system can be active or inactive, which affects their availability and usability in the platform.
True if the entity is active, false otherwise
Convert model instance to interface data
This method serializes the model instance to a plain object that matches the interface type. This is useful for:
The model data as a plain object matching the interface type
Convert model instance to API payload
This method creates a payload suitable for API requests by:
A clean object suitable for API requests
Update model data with new values
This method updates the model's data and instance properties with new values. It performs a shallow merge of the updates with existing data, allowing for partial updates of the model's properties.
Object containing properties to update
const user = new User({
email: 'old@example.com',
firstName: 'John'
});
// Update multiple properties
user.update({
email: 'new@example.com',
lastName: 'Doe'
});
// Save changes to API
await user.save();
This method only updates the local model instance. To persist changes to the API, call save after updating.
Save the model instance to the API
This method persists the current state of the model to the API using a PUT request. It requires the model to have an ID (existing instance). For new instances, use the collection's create method instead.
The method:
Promise resolving to the updated model data
Delete the model instance from the API
This method permanently deletes the model instance from the API and clears the local data. This operation cannot be undone.
The method:
Promise that resolves when deletion is successful
AgentGroup class for managing collaborative AI agent groups
This class represents a collection of AI agents that work together to handle complex tasks and workflows. Agent groups enable coordinated responses and shared knowledge across multiple specialized agents.
Features:
Remarks
Agent groups are particularly useful for scenarios requiring multiple specialized agents to work together, such as:
Example
Basic group setup:
Example
Using group chat: