npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@llynxai/agents

v0.1.19

Published

LLynx is currently in alpha. The purpose of this repo is for the team to share an example framework for building agents that work within [LLynx](https://docs.llynx.ai). This repo will grow over time and we hope the community can use this as a guide to bui

Downloads

8

Readme

LLynx Agents

LLynx is currently in alpha. The purpose of this repo is for the team to share an example framework for building agents that work within LLynx. This repo will grow over time and we hope the community can use this as a guide to build other agents that can plug into LLynx.

LLynx utilizes our proprietary LLynx model for planning orchestration, OpenAI embeddings and 3.5-turbo for schema completion in order to make API calls successful. In the future, we plan to train a version of LLynx to fulfill schema completion and remove reliance on 3.5-turbo.

Quick start Requirements:

In order to showcase LLynx working end-to-end as an application, we provide this prepackaged code to run LLynx on Google Calendar. To get set up, follow these step by step instructions.

  • Node 18 or later
  • OpenAI API key
  • Google OAuth authentication. Log in here with the email you registered to get a LLynx API key for.

To avoid the complexity of setting up Google OAuth yourself, we are offering a hosted solution via our application that you can authenticate into. Given this is an early alpha, the app isn't verified with Google so you will see a warning page when you try and sign in. Please ignore this for now, and proceed to authenticate your Google account.

Install from npm:

yarn install @llynxai/agents

or

npm install @llynxai/agents

OpenAI API key

You will also need to generate an OpenAI API key.

  1. Go to OpenAI's Platform website at platform.openai.com and sign in with an OpenAI account.
  2. Click your profile icon at the top-right corner of the page and select "View API Keys."
  3. Click "Create New Secret Key" to generate a new API key.

Quick Start Guide

Note: Clone this repo Quickstart Repo and follow the instructions there to avoid a lot of copy and pasting. Alternatively, follow the instructions below.

  1. Run the following commands in the terminal to get started.

    mkdir quickstart
    cd quickstart
    touch package.json
  1. Go to the quickstart folder, open the package.json file, add this snippet to it, and save.

    {
      "name": "llynx-quickstart",
      "version": "0.0.0",
      "type": "module",
      "private": true,
      "scripts": {},
      "devDependencies": {
        "@types/node": "^20.3.2"
      },
      "dependencies": {
        "@llynxai/agents": "^0.1.14",
        "axios": "1.4.0",
        "prompt-sync": "^4.2.0"
      }
    }
  1. Run the following command in the quickstart folder to install the packages.

    yarn install

    or

    npm install
  1. In the terminal run the following command.

      touch agent-script.js
  1. Open agent-script.js, paste the snippet below into it, and save the file.

    import { DelegatorAgent } from "@llynxai/agents";
    import axios from "axios";
    import fs from "fs/promises";
    import PromptSync from "prompt-sync";
    
    const prompt = PromptSync({ sigint: true });
    const api_key = "YOUR_LLYNX_API_KEY"
    
    const main = async () => {
      const query = prompt("What would you like for me to schedule for you? ");
    
      console.log("I will be happy to do that for you!\n");
    
      // Call the llynx api to get an action plan
      console.log("Getting action plan...");
      const res = await axios.post(
        "https://api.llynx.ai/actions/quickstart",
        { query },
        {
          headers: {
            "x-api-key": api_key,
          },
        }
      );
    
      console.log("Getting agent permissions...");
      const tokenRes = await axios.get("https://api.llynx.ai/tokens", {
        headers: {
          "x-api-key": api_key,
        },
      });
    
      const googleRefreshToken = tokenRes.data.tokens.googleRefreshToken;
    
      // Execute action plan using the DelegatorAgent
      const agent = new DelegatorAgent({
        actions: res.data.actions,
        tokens: {
          googleRefreshToken,
        },
        apiKey: api_key,
      });
    
      // Check the outputs after the run is complete
      const { failedSteps, actions, finalResponse } = await agent.run();
      await fs.writeFile("./output.json", JSON.stringify({ failedSteps, actions, finalResponse }));
    };
    
    // run main function
    main();
  1. Replace YOUR_LLYNX_API_KEY in agents-script.js, with your LLynx API key. If you don't have one, please submit a request here
  1. Before running the script make sure you have OpenAI environment variable set. You can set it by running this command in the terminal. Make sure you replace "YOUR_OPENAI_API_KEY" with the key you receive from OpenAI.

    export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
  1. Run the script in terminal, enter in your command, and check the results in your authenticated calendar.

    node agent-script.js

Agent Types

We hope the community will utilize this framework to build agents of all types. You can map any agent type to a tool category output from LLynx and store endpoints for those tools in a vector database of your choosing (e.g., Pinecone, Weaviate, ChromaDB) (see below for more information).
We took inspiration from Langchain on how to create agents and some of the classes will look familiar to anyone who used Langchain before.

Base Agents

Base agents are the foundation that every agent is built from. There are 3 types:

Execution Agents

Execution agents are the agents that actually execute an action. They are built off of the Base Agents mainly ActionAgent or ApiAgent and executed by the DelegatorAgent. You can check the agents we have already built in the executionAgent folder

Tool Database

In addition to the LLynx API we utilize a tool database to match an Action to a specific API and schema. This database contains an extensible number of tools and these tools can be mapped to individual users. Our database of choice is Pinecone, but there are several others to choose from including Weaviate, Chroma, and more.

OAuth

If you wish to use LLynx in your own environment and applications, you will need to set up OAuth for each tool you wish to connect to LLynx. For many APIs OAuth is required to authenticate users into their tools and for the application to be able to make requests on behalf of those users. You can check the OAuth documentation for Google, Microsoft, and Zoom to setup your own up.

Environment Variables

The following environment variables would need to be set if you plan to use these pre-built agents (Google Calendar, Gmail, Microsoft Outlook, and Zoom) out of the box.

GOOGLE_CLIENT_ID;
GOOGLE_CLIENT_SECRET;
ZOOM_CLIENT_SECRET;
ZOOM_CLIENT_ID;
MICROSOFT_CLIENT_ID;
MICROSOFT_CLIENT_SECRET;
OPENAI_API_KEY;

Credits