Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

agent-protocol

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agent-protocol

API for interacting with Agent

latest
Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
53
130.43%
Maintainers
2
Weekly downloads
 
Created
Source

Agent Communication Protocol - JavaScript/TypeScript SDK

This SDK implements the Agent Communication Protocol in JavaScript/TypeScript and allows you to easily wrap your agent in a webserver compatible with the protocol - you only need to define an agent task handler.

Installation

npm install agent-protocol

Then add the following code to your agent:

Typescript

import Agent, {
  type StepHandler,
  type StepInput,
  type StepResult,
  type TaskInput,
} from 'agent-protocol'

async function taskHandler(taskInput: TaskInput | null): Promise<StepHandler> {
  console.log(`task: ${taskInput}`)

  async function stepHandler(stepInput: StepInput | null): Promise<StepResult> {
    console.log(`step: ${stepInput}`)
    return {
      output: stepInput,
    }
  }

  return stepHandler
}

Agent.handleTask(taskHandler, {}).start()

See the [https://github.com/AI-Engineer-Foundation/agent-protocol/tree/main/packages/sdk/js/examples](examples folder) for running in serverless environments.

Docs

You can find more info and examples in the docs.

Contributing

git clone https://github.com/AI-Engineers-Foundation/agent-protocol
cd agent-protocol/packages/sdk/js
npm install
npm run build

Keywords

agent

FAQs

Package last updated on 02 Apr 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