2.0.3 • Published 6 days ago

@or-sdk/agents v2.0.3

Weekly downloads
-
License
-
Repository
-
Last release
6 days ago

Agents SDK

The @or-sdk/agents package provides a client for managing agents within the OneReach.ai ecosystem. With this client, you can perform operations such as creating, updating, retrieving, and deleting agents.

Installation

To install the package, run the following command:

$ npm install @or-sdk/agents

Usage

To use the Agents client, you need to create an instance of the class with the appropriate configuration options. Here is an example:

import { Agents } from '@or-sdk/agents';

const agents = new Agents({
  token: 'my-account-token-string',
  serviceUrl: 'http://example.agents/endpoint',
  accountId: 'your-account-id',
  feature: 'master', // service feature name
});

Once you have an instance of the Agents client, you can use its methods to interact with the agents system. The available methods are:

createAgent

Create a new agent.

Params

  • params: CreateAgent - An object containing the properties of the agent to create.

Example

const newAgent = await agents.createAgent({
  name: 'New Agent',
  description: 'Description of the new agent',
  // ...other properties
});

// Example response
{
  id: 'new-agent-id',
  name: 'New Agent',
  description: 'Description of the new agent',
  // ...other properties
}

findAgents

Find agents with optional pagination and query.

Params

  • params: FindAgentsOptions (optional) - Optional find parameters.

Example

const agentsList = await agents.findAgents({
query: 'search query',
size: 10,
from: 0,
});
// Example response
{
items: [
  {
    id: 'agent-id',
    name: 'Agent Name',
    description: 'Agent Description',
    // ...other properties
    },
    // ...more agents
  ],
  total: 1
}

getAgent

Get an agent by its ID.

Params

  • agentId: string - The ID of the agent to retrieve.

Example

const agent = await agents.getAgent('agent-id');

// Example response
{
  id: 'agent-id',
  name: 'Agent Name',
  description: 'Agent Description',
  // ...other properties
}

updateAgent

Update an agent by its ID.

Params

  • agentId: string - The ID of the agent to update.
  • params: UpdateAgent - The update agent parameters.

Example

const updatedAgent = await agents.updateAgent('agent-id', {
  name: 'Updated Agent Name',
  description: 'Updated description',
  // ...other update parameters
});

// Example response
{
  id: 'agent-id',
  name: 'Updated Agent Name',
  description: 'Updated description',
  // ...other properties
}

deleteAgent

Delete an agent by its ID.

Params

  • agentId: string - The ID of the agent to delete.

Example

await agents.deleteAgent('agent-id');
// No direct response, the agent is deleted

Note: Deleting an agent is a permanent operation, and the removed data cannot be recovered. Be cautious when using this method and ensure you have backups of your data if necessary.

This documentation update provides a basic overview of the @or-sdk/agents package, including installation, usage, and examples for the main methods available in the Agents class. Additional methods and their usage can be added following the same structure.