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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloudbase/agent-adapter-llm

v0.0.24

Published

Direct LLM adapter for AG-Kit agents (OpenAI & Anthropic)

Readme

@cloudbase/agent-adapter-llm

Direct LLM adapter for AG-Kit agents with support for OpenAI and Anthropic models.

Features

  • ✅ Direct OpenAI and Anthropic model integration
  • ✅ Automatic streaming message conversion to AGUI events
  • ✅ Support for tool calls (function calling)
  • ✅ Type-safe with TypeScript
  • ✅ Observable-based event streaming
  • ✅ No additional abstraction layers

Installation

npm install @cloudbase/agent-adapter-llm openai @anthropic-ai/sdk

Quick Start

With OpenAI

import OpenAI from 'openai';
import { LLMAgent } from '@cloudbase/agent-adapter-llm';

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
});

const agent = new LLMAgent({
  agentId: 'my-agent',
  model: openai,
  modelName: 'gpt-4o-mini',
  systemPrompt: 'You are a helpful assistant.',
  temperature: 0.7,
  maxTokens: 2000
});

const observable = agent.run({
  messages: [
    { id: 'msg_1', role: 'user', content: 'Hello!' }
  ],
  runId: 'run_123',
  threadId: 'thread_456',
  tools: []
});

observable.subscribe({
  next: (event) => {
    console.log('Event:', event);
  }
});

With Anthropic

import Anthropic from '@anthropic-ai/sdk';
import { LLMAgent } from '@cloudbase/agent-adapter-llm';

const anthropic = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY
});

const agent = new LLMAgent({
  agentId: 'my-agent',
  model: anthropic,
  modelName: 'claude-3-5-sonnet-20241022',
  systemPrompt: 'You are a helpful assistant.',
  temperature: 0.7,
  maxTokens: 2000
});

AGUI Events

The agent emits the following AGUI protocol events:

  • RUN_STARTED - Run has started
  • TEXT_MESSAGE_START - Text message streaming started
  • TEXT_MESSAGE_CONTENT - Text content delta
  • TEXT_MESSAGE_END - Text message streaming ended
  • TOOL_CALL_START - Tool call started
  • TOOL_CALL_ARGS - Tool call arguments delta
  • TOOL_CALL_END - Tool call ended
  • RUN_FINISHED - Run completed successfully
  • RUN_ERROR - Run encountered an error

Configuration

LLMAgentConfig

interface LLMAgentConfig {
  agentId: string;           // Unique agent identifier
  name?: string;             // Agent name
  description?: string;      // Agent description
  model: OpenAI | Anthropic; // Model provider instance
  modelName: string;         // Model name (e.g., 'gpt-4o-mini', 'claude-3-5-sonnet-20241022')
  systemPrompt?: string;     // System prompt
  temperature?: number;      // Temperature (0-2)
  maxTokens?: number;        // Max tokens to generate
  threadId?: string;         // Thread ID
}

Streaming Example

import { EventType } from '@ag-ui/client';

observable.subscribe({
  next: (event) => {
    switch (event.type) {
      case EventType.TEXT_MESSAGE_CONTENT:
        process.stdout.write(event.delta);
        break;
      case EventType.TOOL_CALL_START:
        console.log(`\nTool: ${event.toolCallName}`);
        break;
      case EventType.RUN_FINISHED:
        console.log('\nDone!');
        break;
    }
  }
});

Tool Calling

const tools = [
  {
    name: 'get_weather',
    description: 'Get the current weather',
    parameters: JSON.stringify({
      type: 'object',
      properties: {
        location: { type: 'string' }
      },
      required: ['location']
    })
  }
];

agent.run({ messages, runId, threadId, tools });

License

MIT