SDK — Teams
The rivano.teams resource lets you organize users into groups, control which agents each group can access, and assign roles within a tenant.
List teams
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
const { data, total } = await rivano.teams.list();
for (const team of data) {
console.log(`${team.id} — ${team.name}`);
} Create a team
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
const team = await rivano.teams.create({ name: 'legal-ai-team' });
console.log('Team created:', team.id); Manage members
List members
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
const members = await rivano.teams.members('team_abc123');
for (const member of members) {
console.log(`${member.email} [${member.role}]`);
}
Add a member
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
await rivano.teams.addMember('team_abc123', {
email: '[email protected]',
role: 'member',
}); Remove a member
await rivano.teams.removeMember('team_abc123', '[email protected]');
Member roles
| Role | Permissions |
|---|---|
admin | Full access to team resources, can add/remove members |
member | Read/write access to agents and traces scoped to this team |
Scope agents to a team
By default, a team can see all agents in the tenant. Use setScopes to restrict a team to specific agents:
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
// Restrict legal-ai-team to only these two agents
await rivano.teams.setScopes('team_abc123', [
'contract-summarizer',
'compliance-checker',
]);
console.log('Team scopes updated'); 💡
Pass an empty array to setScopes to give the team access to all agents again (default behavior).
Error handling
| Error | When it occurs |
|---|---|
SdkAuthError | Invalid API key |
SdkForbiddenError | Insufficient permissions to manage teams |
SdkNotFoundError | Team ID does not exist |
SdkError | Duplicate team name or invalid role |
Related
- SDK Keys — Scoped API keys for team-level access control
- SDK Policies — Scope policies to specific teams with
teamId - Core Concepts — Teams — How teams fit the tenant model