Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scoopika/client

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scoopika/client

Run AI agents & boxes on the client side with real-time streaming hooks and client-side actions

  • 1.0.9
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Scoopika Client

Documentation | Github repo

This package facilitates communication with a Scoopika server, allowing you to run LLM-powered agents and multi-agent boxes from the client-side with client-side actions and real-time streaming hooks supported out-of-the-box.

Installation

Using Npm

npm install @scoopika/client

Using Bun

bun add @scoopika/client

Note: This package has been tested with Bun version 1.0.15.

Using a CDN

<script src="https://cdn.jsdelivr.net/npm/@scoopika/client/index.global.js"></script>

When loaded from a CDN, the global variable is Scoopika.

Usage

Ensure you have a running Scoopika server. Refer to the documentation for more details.

Initialize client:

import { Client } from "@scoopika/client";

const client = new Client("SCOOPIKA_SERVER_URL");

// iife
const client = new Scoopika.Client("SCOOPIKA_SERVER_URL");

Run AI agent

import { Client, Agent } from "@scoopika/client";

const client = new Client("SCOOPIKA_SERVER_URL");
const agent = new Agent("AGENT_ID", client);

(async () => {
  const response = await agent.run({
    inputs: { message: "Hello!" },
    hooks: {
      onToken: (token) => console.log(token), // real-time hook
    },
  });

  console.log(response);
})();

Run Multi-agent box

import { Client, Box } from "@scoopika/client";

const client = new Client("SCOOPIKA_SERVER_URL");
const box = new Box("BOX_ID", client);

(async () => {
  const response = await box.run({
    inputs: { message: "Hello!" },
    hooks: {
      onToken: (token) => console.log(token), // real-time hook
    },
  });

  console.log(response);
})();

Manage history sessions

import { Client, Agent } from "@scoopika/client";

const client = new Client("SCOOPIKA_SERVER_URL");

(async () => {
  // Create new session
  const session = await client.store.newSesssion({
    user_id: "USER_1", // optional
  });
  console.log(session); // StoreSession

  // Get session info by id
  const mySession = await client.store.getSession(session.id);
  console.log(mySession); // StoreSession

  // List user sessions
  const userSessions = await client.store.listUserSessions("USER_1");
  console.log(userSessions); // string[]

  // Get session runs (messages)
  const runs = await client.store.getSessionRuns(userSessions[0]);
  console.log(runs); // HistoryRun[]
})();

Development

You're free to clone the Github repository, The code can be found in the src directory and the tests in the tests and e2e directories.

Read the tests/README.md for more information on how to setup and run tests.

Keywords

FAQs

Package last updated on 15 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc