SDK — Agents

The rivano.agents resource lets you manage AI agent definitions programmatically — the same agents you define in rivano.yaml and deploy via the CLI.

List agents

import Rivano from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

const { data, total } = await rivano.agents.list();

console.log(`${total} agents`);
for (const agent of data) {
  console.log(`${agent.name} — ${agent.environment ?? 'no environment'}`);
}

Get a single agent

import Rivano from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

const agent = await rivano.agents.get('agent_abc123');
console.log(agent.name, agent.modelProvider, agent.modelName);

Create an agent

import Rivano from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

const agent = await rivano.agents.create({
  name: 'contract-summarizer',
  description: 'Summarizes legal contracts for review teams',
  modelProvider: 'openai',
  modelName: 'gpt-4o',
  environment: 'production',
});

console.log('Created agent:', agent.id);

Create parameters

ParameterTypeRequiredDescription
namestringYesUnique agent name within the tenant
descriptionstringNoHuman-readable description
modelProviderstringNoProvider key: openai, anthropic, google, etc.
modelNamestringNoModel identifier, e.g. gpt-4o, claude-3-5-sonnet-20241022
environmentstringNoDeployment environment: production, staging, development
configYamlstringNoRaw YAML config for advanced agent configuration

Get agent tools

Returns the tools (function definitions) associated with an agent:

import Rivano from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

const tools = await rivano.agents.getTools('agent_abc123');
for (const tool of tools) {
  console.log(tool.name, tool.description);
}

Get deployment history

Returns a list of all deployments for an agent, newest first:

import Rivano from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

const history = await rivano.agents.getHistory('agent_abc123');
for (const deployment of history) {
  console.log(deployment.version, deployment.deployedAt, deployment.deployedBy);
}
💡

Use the CLI to roll back to a previous version: rivano agents rollback contract-summarizer. The SDK exposes deployment history so you can build rollback automation into your own tooling.

Error handling

ErrorWhen it occurs
SdkAuthErrorInvalid API key
SdkForbiddenErrorKey lacks access to this tenant
SdkNotFoundErrorAgent ID does not exist
SdkErrorValidation failure (e.g. duplicate name)
import Rivano, { SdkNotFoundError, SdkError } from '@rivano/sdk';

const rivano = new Rivano({ apiKey: 'rv_...' });

try {
  const agent = await rivano.agents.get('agent_does_not_exist');
} catch (error) {
  if (error instanceof SdkNotFoundError) {
    console.error('No agent with that ID');
  } else if (error instanceof SdkError) {
    console.error('Unexpected error:', error.message);
  }
}