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

@agentmug/runtime

v0.13.0

Published

Universal AI agent runtime — portable .agent files run identically in cloud, desktop, CLI, and as an MCP server. Multi-LLM (Anthropic, OpenAI, Gemini), pluggable adapters, MCP client + server, streaming, abort, pause/resume.

Downloads

1,339

Readme

@agentmug/runtime

The portable AI agent runtime. The same .agent file runs identically in cloud, on the desktop (Tauri), from the CLI, and as a Model Context Protocol server for any compatible client (Claude Code, Cursor, Continue, Cline).

npm install @agentmug/runtime

Hello agent in 10 lines

import { quickRun, parseAgentFile } from "@agentmug/runtime";
import { readFileSync } from "node:fs";

const agentFile = parseAgentFile(JSON.parse(readFileSync("./hello.agent", "utf8")));

const result = await quickRun({
  agentFile,
  userInput: "Say hi in 5 words.",
  llm: { anthropicApiKey: process.env.ANTHROPIC_API_KEY! },
  onEvent: (e) => e.type === "token" && process.stdout.write(e.content),
});

console.log("\n→", result.totalTokens, "tokens");

That's the whole API for a quickstart. quickRun() wires in-memory persistence + tracing for you. When you need production storage, swap in runAgent() directly with your own adapters — everything below is optional power.

What you get out of the box

  • Multi-LLM — Anthropic, OpenAI, Gemini. Routes by model-ID prefix (claude-sonnet-4-6, claude-opus-4-8, gpt-4o, gemini-2.0-flash). No allowlist, so newer model IDs work without a runtime upgrade. Per-model token pricing.
  • Pluggable adapters — persistence, tracing, LLM, transcription, reminders, OAuth. Swap any layer.
  • Streaming eventsstarted, token, tool_start, tool_complete, paused, error, done.
  • Abort + pause/resumeAbortSignal aborts mid-run (cuts the in-flight LLM stream). ask_user pauses for input; resume from a snapshot.
  • Self-improving — runs carry a built-in "learn from feedback" directive so an agent can refine its own behavior over time.
  • Tool registry — 25 built-in tool definitions (Gmail, Slack, GitHub, Calendar, web search/browse, image gen, code exec, memory, shell, Twilio/WhatsApp/Telegram/Discord, Sheets, etc.). Plus pluggable MCP and HTTP tools. (Executors are supplied by the host; a first-party executor bundle is rolling out.)
  • MCP both ways — call out to MCP servers (LangGraph, Continue toolbox, etc.) AND be called as one (via @agentmug/mcp-bridge).
  • Portable .agent files — declarative JSON spec (system prompt + tools + parameters + inputs/outputs). Version-controllable. Forkable.

The .agent file format

{
  "$schema": "https://agentmug.com/schemas/agent.v1.json",
  "id": "email-triage",
  "name": "Email Triage",
  "description": "Sorts your unread Gmail and drafts replies.",
  "emoji": "📧",
  "blueprint": {
    "primaryModel": "claude-sonnet-4-6",
    "systemPrompt": "You triage emails…",
    "tools": ["gmail.send", "memory.save", "ask_user"]
  },
  "inputs": { "accepts": ["text"] },
  "outputs": { "shape": "text" }
}

Pass it to runAgent({ agentFile, ... }) or load via parseAgentFile(json).

Adapters — the universality lever

The runtime knows nothing about where it's running. Everything that touches the outside world is an adapter:

| Adapter | What it does | Example impls | |---|---|---| | LlmClient | Sends messages, streams tokens | AnthropicLlmClient, OpenAiLlmClient, GeminiLlmClient, or write your own | | PersistenceAdapter | Creates/updates run records | Postgres (cloud), in-memory (CLI), .agent file (desktop) | | TracingAdapter | Records LLM call telemetry | Postgres, console, OpenTelemetry | | TranscriptionAdapter | Audio → text | Gemini live | | RemindersAdapter | Where reminders land | iCloud CalDAV, local .ics, Postgres |

Run identically against any combination.

Tool registry

import { InMemoryToolRegistry, gmailSendDefinition } from "@agentmug/runtime";

const tools = new InMemoryToolRegistry();
tools.register(gmailSendDefinition, new YourGmailExecutor());

Tools are normal classes implementing ToolExecutor. They receive a ToolExecutionContext with runId, userId, optional signal (for abort), and currentToolUseId (for streaming side channels).

Sister packages

Status

v0.4.x — published on npm and used in production by agentmug.com. The API may still move before v1.0 based on real-world adoption. Issues + PRs welcome at the main repo.

License

MIT