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

@morphixai/agent-framework

v1.19.2

Published

Construction-injected agent instances over pi-agent-core — one conversation = one instance; context, sandbox, capabilities and LLM all injected, nothing ambient.

Readme

@morphixai/agent-framework

Construction-injected agent instances over pi-agent-core. One conversation = one instance. Everything an agent touches — context, sandbox, capabilities, LLM, history — is injected at construction; nothing is ambient, nothing is global.

v2 is a ground-up rewrite. The v1 API (createAgentFramework / defineAgent / LangGraph runner) was removed entirely — see Versioning below.

Install

npm install @morphixai/agent-framework

Companions (installed as dependencies): @morphixai/agent-core (RunContext + tool-middleware onion) · @morphixai/agent-bus (parent↔child messaging) · @morphixai/agent-workspace (Sandbox hierarchy). LLM access via pi-ai.

Quick start

import { createInstance, ToolV2 } from '@morphixai/agent-framework';
import { VirtualSandbox } from '@morphixai/agent-workspace';
import { z } from 'zod';

class WriteFileTool extends ToolV2 {
  static toolName = 'write_file';
  static description = 'Write a file into the sandbox.';
  static requires = ['userId', 'appId'];               // RunContext keys gate
  static inputSchema = z.object({ path: z.string(), content: z.string() });
  async handler(ctx, { path, content }) {
    await ctx.sandbox.files.write(path, content);
    return { ok: true };
  }
}

class DashboardAgent {
  static id = 'dashboard';
  static scope = 'app' as const;      // declaration only: which binding the host supplies
  static prompt = 'You build dashboards.';
  static tools = [WriteFileTool];
  static skills = [JiraSkill];        // skills CARRY tools (see below)
  static canSpawn = [MediaAgent];     // spawn whitelist
}

const inst = createInstance(DashboardAgent, {
  context: { userId, appId, conversationId },  // frozen RunContext; lineage auto-derived
  sandbox: new VirtualSandbox(),               // or your LogicalSandbox subclass
  capabilities: { observations, connections }, // DI slot for tool handlers
  llm: { model },                              // pi-ai model (streamFn override for tests)
  history: persistedMessages,                  // rehydration = message replay
});

const r = await inst.prompt('add a weather card');
// r.status: 'completed' | 'interrupted' | 'error' | 'aborted'
// r.messages: the transcript — persist it; it IS the resumable state

Core features

  • HITL (human-in-the-loop) — a tool calls ctx.requestUserInput(payload); the run ends interrupted with the payload attached. Resume by constructing the instance from the persisted transcript and calling inst.prompt(answer).
  • Parent ↔ child, both directions — inst.spawn(ChildDef, opts) creates a child instance (own sandbox/context, derived lineage). The child asks up via ctx.bus.askParent(question); the parent answers deterministically with inst.onAsk(async (childRunId, question) => answer). Steering and inbox notes (bus.deliver) are injected before the next turn.
  • Skills carry tools — a skill is { id, description, prompt, tools }. Descriptions are listed in the system prompt; when the agent calls the built-in load_skill, the skill's knowledge enters the conversation and its tools become callable the same run.
  • Tool-middleware onion — (ctx, args, next) middleware composes at three levels (global → agent → tool): rewrite args, deny before the handler runs, emit side effects after, or wrap for timing/retry.
  • Rehydration contract — no checkpointer. Persist r.messages; a new createInstance(def, { ..., history }) continues the conversation exactly.
  • Testing — pi-ai createFauxCore (scripted LLM) + VirtualSandbox give a fully deterministic closed loop with zero external dependencies.
  • Request-time context providers — hosts may inject temporary asynchronous context (for example a Memory recall) before provider requests. Contributions are not appended to the canonical transcript, and provider failures are observable without silently changing identity or storage scope.

Persistence is intentionally optional and lives in companion packages: @morphixai/agent-memory defines scope-bound Memory ports and @morphixai/agent-session defines canonical transcript persistence. Local JSON and JSONL adapters are explicit Node-only conveniences; production hosts can implement the same protocols with their own storage backends.

Exports

  • createInstance, AgentInstance, InstanceOptions, RunResult, InstanceEvent
  • ToolV2 / ToolV2Class, ToolCtxV2, AgentDefV2, SkillDefV2 / SkillDefClass
  • Re-exported primitives: RunContext, Lineage, ToolMiddleware (from agent-core)

Versioning

  • ≥ 1.0.0 — framework v2 (this API). The whole quartet (agent-core / agent-bus / agent-workspace / agent-framework) ships as a 1.x stable line; cross-package compatibility is guaranteed within it.
  • 0.x — the legacy LangGraph-based v1. No migration path is provided; v2 is a rewrite. Pin <1.0.0 if you still depend on v1 shapes.

License

MIT © MorphixAI