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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aigne/transport

v0.15.22

Published

AIGNE Transport SDK providing HTTP client and server implementations for communication between AIGNE components

Readme

@aigne/transport

GitHub star chart Open Issues codecov NPM Version Elastic-2.0 licensed

AIGNE Transport SDK providing HTTP client and server implementations for communication between AIGNE components within the AIGNE Framework.

Introduction

@aigne/transport provides a robust communication layer for AIGNE components, enabling seamless interaction between different parts of your AI applications. This package offers both HTTP client and server implementations that adhere to a consistent protocol, making it easy to build distributed AI systems with the AIGNE Framework.

Features

  • HTTP Client Implementation: Easy-to-use client for communicating with AIGNE servers
  • HTTP Server Implementation: Flexible server implementation that integrates with popular Node.js frameworks
  • Framework Agnostic: Supports Express, Hono, and other Node.js HTTP frameworks
  • Streaming Support: First-class support for streaming responses
  • Type Safety: Comprehensive TypeScript typings for all APIs
  • Error Handling: Robust error handling with detailed error messages
  • Middleware Support: Compatible with common HTTP middleware like compression

Installation

Using npm

npm install @aigne/transport @aigne/core

Using yarn

yarn add @aigne/transport @aigne/core

Using pnpm

pnpm add @aigne/transport @aigne/core

Basic Usage

Server Usage

You can use the AIGNE HTTP server with either Express or Hono frameworks.

Express Example

import { AIAgent, AIGNE } from "@aigne/core";
import { AIGNEHTTPClient } from "@aigne/transport/http-client/index.js";
import { AIGNEHTTPServer } from "@aigne/transport/http-server/index.js";
import express from "express";
import { OpenAIChatModel } from "../_mocks_/mock-models.js";

const model = new OpenAIChatModel();

const chat = AIAgent.from({
  name: "chat",
});

// AIGNE: Main execution engine of AIGNE Framework.
const aigne = new AIGNE({ model, agents: [chat] });

// Create an AIGNEServer instance
const aigneServer = new AIGNEHTTPServer(aigne);

// Setup the server to handle incoming requests
const server = express();
server.post("/aigne/invoke", async (req, res) => {
  await aigneServer.invoke(req, res);
});
const httpServer = server.listen(port);

// Create an AIGNEClient instance
const client = new AIGNEHTTPClient({ url });

// Invoke the agent by client
const response = await client.invoke("chat", { message: "hello" });

console.log(response); // Output: {message: "Hello world!"}

Hono Example

import { AIAgent, AIGNE } from "@aigne/core";
import { AIGNEHTTPClient } from "@aigne/transport/http-client/index.js";
import { AIGNEHTTPServer } from "@aigne/transport/http-server/index.js";
import { serve } from "bun";
import { Hono } from "hono";
import { OpenAIChatModel } from "../_mocks_/mock-models.js";

const model = new OpenAIChatModel();

const chat = AIAgent.from({
  name: "chat",
});

// AIGNE: Main execution engine of AIGNE Framework.
const aigne = new AIGNE({ model, agents: [chat] });

// Create an AIGNEServer instance
const aigneServer = new AIGNEHTTPServer(aigne);

// Setup the server to handle incoming requests
const honoApp = new Hono();
honoApp.post("/aigne/invoke", async (c) => {
  return aigneServer.invoke(c.req.raw);
});
const server = serve({ port, fetch: honoApp.fetch });

// Create an AIGNEClient instance
const client = new AIGNEHTTPClient({ url });

// Invoke the agent by client
const response = await client.invoke("chat", { message: "hello" });
console.log(response); // Output: {message: "Hello world!"}

HTTP Client

import { AIGNEHTTPClient } from "@aigne/transport/http-client/index.js";

const client = new AIGNEHTTPClient({ url });

const response = await client.invoke("chat", { message: "hello" });

console.log(response); // Output: {message: "Hello world!"}

Streaming Responses

import { isAgentResponseDelta } from "@aigne/core";
import { AIGNEHTTPClient } from "@aigne/transport/http-client/index.js";

const client = new AIGNEHTTPClient({ url });

const stream = await client.invoke(
  "chat",
  { message: "hello" },
  { streaming: true },
);

let text = "";
for await (const chunk of stream) {
  if (isAgentResponseDelta(chunk)) {
    if (chunk.delta.text?.message) text += chunk.delta.text.message;
  }
}

console.log(text); // Output: "Hello world!"

License

Elastic-2.0