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

@kagenti/adk

v0.8.1

Published

TypeScript/JavaScript client SDK for building applications that interact with Kagenti ADK agents.

Downloads

64

Readme

Kagenti ADK Client SDK

TypeScript/JavaScript client SDK for building applications that interact with Kagenti ADK agents.

npm version License LF AI & Data

Overview

The @kagenti/adk provides TypeScript and JavaScript tools for building client applications that communicate with agents deployed on Kagenti ADK. It includes utilities for handling the A2A (Agent2Agent) protocol, working with extensions, and calling the Kagenti ADK platform API.

Key Features

  • A2A Protocol Support - Parse agent cards and task status updates with typed utilities
  • Extension System - Resolve service demands and UI metadata with typed helpers
  • Platform API Client - Typed access to core platform resources
  • Type Safe Responses - Zod validated payloads with structured API error helpers

Installation

npm install @kagenti/adk @a2a-js/sdk

Quickstart

import {
  buildApiClient,
  createAuthenticatedFetch,
  unwrapResult,
  getAgentCardPath,
  handleAgentCard,
  handleTaskStatusUpdate,
  resolveUserMetadata,
  type TaskStatusUpdateType,
  type Fulfillments,
} from '@kagenti/adk';
import {
  ClientFactory,
  ClientFactoryOptions,
  DefaultAgentCardResolver,
  JsonRpcTransportFactory,
} from '@a2a-js/sdk/client';

const baseUrl = 'https://your-adk-instance.com'; // or http://localhost:8333 for local development
const accessToken = '<user-access-token>';

const api = buildApiClient({
  baseUrl,
  fetch: createAuthenticatedFetch(accessToken),
});

const providers = unwrapResult(await api.listProviders());
const providerId = providers[0]?.id;

const context = unwrapResult(await api.createContext({ provider_id: providerId }));
const contextToken = unwrapResult(
  await api.createContextToken({
    context_id: context.id,
    grant_global_permissions: {
      llm: ['*'],
      embeddings: ['*'],
      a2a_proxy: ['*'],
    },
    grant_context_permissions: {
      files: ['*'],
      vector_stores: ['*'],
      context_data: ['*'],
    },
  }),
);

const fetchImpl = createAuthenticatedFetch(contextToken.token);
const factory = new ClientFactory(
  ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
    transports: [new JsonRpcTransportFactory({ fetchImpl })],
    cardResolver: new DefaultAgentCardResolver({ fetchImpl }),
  }),
);

const agentCardPath = getAgentCardPath(providerId);
const client = await factory.createFromUrl(baseUrl, agentCardPath);

const card = await client.getAgentCard();
const { resolveMetadata, demands } = handleAgentCard(card);

const selectedLlmModels: Record<string, string> = { default: 'gpt-4o' };

const fulfillments: Fulfillments = {
  llm: demands.llmDemands
    ? async ({ llm_demands }) => ({
        llm_fulfillments: Object.fromEntries(
          Object.keys(llm_demands).map((key) => [
            key,
            {
              identifier: 'llm_proxy',
              api_base: `${baseUrl}/api/v1/openai/`,
              api_key: contextToken.token,
              api_model: selectedLlmModels[key],
            },
          ]),
        ),
      })
    : undefined,
};

const agentMetadata = await resolveMetadata(fulfillments);

const stream = client.sendMessageStream({
  message: {
    kind: 'message',
    role: 'user',
    messageId: crypto.randomUUID(),
    contextId: context.id,
    parts: [{ kind: 'text', text: 'Hello' }],
    metadata: agentMetadata,
  },
});

let taskId: string | undefined;

for await (const event of stream) {
  switch (event.kind) {
    case 'task':
      taskId = event.id;
    case 'status-update':
      taskId = event.taskId;

      for (const update of handleTaskStatusUpdate(event)) {
        switch (update.type) {
          case TaskStatusUpdateType.FormRequired:
          // Render form
          case TaskStatusUpdateType.OAuthRequired:
          // Redirect to update.url
          case TaskStatusUpdateType.SecretRequired:
          // Prompt for secrets
          case TaskStatusUpdateType.ApprovalRequired:
          // Request approval
          case TaskStatusUpdateType.TextInputRequired:
          // Prompt for text input
        }
      }
    case 'message':
    // Render message parts and metadata
    case 'artifact-update':
    // Render artifacts
  }
}

Core APIs

  • buildApiClient returns a typed API client for platform endpoints.
  • handleAgentCard extracts extension demands and returns resolveMetadata.
  • handleTaskStatusUpdate parses A2A status updates into UI actions.
  • resolveUserMetadata builds metadata when the user submits forms, canvas edits, or approvals.
  • createAuthenticatedFetch helps add bearer auth headers to API calls.
  • buildLLMExtensionFulfillmentResolver matches LLM providers and returns fulfillments.
  • unwrapResult returns the response data on success, throws an ApiErrorException on error

Extensions

Service extensions (client fulfillments):

  • Embedding - Provide embedding access (api_base, api_key, api_model) for RAG or search.
  • Form - Request structured user input via forms.
  • LLM - Resolve model access and credentials for text generation.
  • MCP - Connect Model Context Protocol services and tools.
  • OAuth - Provide OAuth credentials or redirect URIs.
  • Platform API - Inject context token metadata for platform access.
  • Secrets - Supply or request secret values securely.

UI extensions (message metadata your UI can render):

  • Agent Detail - Show agent specific metadata and context.
  • Approval - Ask the user to approve actions or tool calls.
  • Canvas - Provide canvas edit requests and updates.
  • Citation - Display inline source references.
  • Error - Render structured error messages.
  • Form Request - Render interactive forms in the UI.
  • Settings - Read or update runtime configuration values.
  • Trajectory - Render execution traces or reasoning steps.

Documentation

Resources

Contributing

Contributions are welcome! Please see the Contributing Guide for details.

Support


Developed by contributors to the Kagenti project, this initiative is part of the Linux Foundation AI & Data program. Its development follows open, collaborative, and community-driven practices.