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

@qoxop/deep-agent

v0.1.0

Published

A TypeScript SDK for a tool-using coding agent runtime.

Readme

deep-agent

deep-agent is a TypeScript SDK for building tool-using agents. It packages the runtime layer of a coding agent into reusable library APIs: prompt assembly, provider calls, tool execution, permissions, hooks, sessions, artifacts, context management, MCP adapters, sub-agents, and observability.

It is deliberately not a complete client. The package does not include TUI/React screens, slash-command panels, login flows, themes, voice, remote bridge clients, telemetry dashboards, or application state for a product shell.

Install

npm install
npm run typecheck
npm test

The SDK is ESM-only and requires Node.js 22 or newer.

Quick Start

import { createDeepAgent } from "@qoxop/deep-agent";

const agent = createDeepAgent({
  cwd: process.cwd(),
  permissions: {
    mode: "ask",
    async onRequest(request) {
      if (request.tool.isReadOnly) return { behavior: "allow" };
      return { behavior: "deny", reason: "This host only allows read-only tools." };
    },
  },
});

const result = await agent.run("Read package.json and summarize this project.");

console.log(result.text);
await agent.close();

By default, the Anthropic provider reads configuration from environment variables or nearby .env files:

ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_BASE_URL=https://api.anthropic.com
ANTHROPIC_MODEL=claude-sonnet-4-5

Core Capabilities

  • Model/tool loop with run() and event streaming through stream().
  • Built-in tools for files, search, shell, todo state, sub-agents, skills, MCP resources/prompts, and stored tool results.
  • Selective built-in tool registration through tools.builtIns, including include / exclude controls.
  • Tool lifecycle governance: schema validation, hooks, permission resolution, sandbox checks, retries, timeouts, cancellation, progress, and large-result storage.
  • Provider abstraction with registries, model metadata, dynamic credentials, Anthropic support, provider capabilities, streaming, retry, prompt cache support, usage normalization, and extended thinking options.
  • Provider-aware message repair for tool-call ids, missing tool results, and thinking-block compatibility.
  • Event-sourced transcript, optional file-backed sessions, replay, branching with branchSession(), session listing/resume/delete APIs, and recovery analysis.
  • Context management with token/character budgets, snip, compaction, file-operation breadcrumbs, prompt cache planning, and provider context_too_large recovery.
  • Long-running run control through per-run start().steer() and start().followUp(), including additional follow-up turn budgets.
  • Sub-agent definitions, experimental background task registry, host interaction protocol, MCP lifecycle, and observability hooks.

Documentation

Common Patterns

Event Streaming

for await (const event of agent.stream("Inspect this repository.", { stream: true })) {
  if (event.type === "message") process.stdout.write(event.text);
  if (event.type === "tool_use") console.log("tool:", event.name);
  if (event.type === "tool_result") console.log("result:", event.name, event.isError);
  if (event.type === "done") console.log("done:", event.text);
}

Durable Sessions

const agent = createDeepAgent({
  session: {
    persist: true,
    path: ".deep-agent",
  },
});

await agent.run("Analyze this codebase.");

const sessions = await agent.listSessions();
const snapshot = await agent.resumeSession(sessions[0]!.sessionId);
console.log(snapshot.events.length);

Custom Tools

import type { ToolDefinition } from "@qoxop/deep-agent";

const readPackageName: ToolDefinition<{ path: string }, { name?: string }> = {
  name: "readPackageName",
  description: "Read package.json and return its package name.",
  inputSchema: {
    type: "object",
    required: ["path"],
    properties: { path: { type: "string" } },
    additionalProperties: false,
  },
  isReadOnly: () => true,
  async execute(input, context) {
    const result = await context.agent.run(`Use readFile to inspect ${input.path}.`);
    return { content: result.text, data: { name: undefined } };
  },
};

const agent = createDeepAgent({
  tools: { definitions: [readPackageName] },
});

Verification

npm run typecheck
npm test
npm run test:coverage
npm run examples:subagent
npm run examples:multi-agent
npm run examples:crew
npm run examples:long

Coverage is enforced with Vitest/V8 thresholds for statements, branches, functions, and lines.

Project Boundary

deep-agent is a runtime SDK. Hosts are expected to provide the UI, approval surfaces, task panels, process isolation, enterprise policy, and product-specific orchestration around the runtime.