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

@agentified/mastra

v2.0.0

Published

Mastra adapter layer for [Agentified](../../../README.md) — wraps SDK classes with Mastra-typed shells via composition, plus AG-UI streaming. See the [Mastra guide](../../../docs/typescript/integrations/mastra.md) for a full-stack walkthrough.

Readme

@agentified/mastra

Mastra adapter layer for Agentified — wraps SDK classes with Mastra-typed shells via composition, plus AG-UI streaming. See the Mastra guide for a full-stack walkthrough.

Install

npm install @agentified/mastra agentified

Peer dependencies: @mastra/core >= 1.0.0, @ag-ui/client >= 0.0.45, @ag-ui/mastra >= 1.0.0, zod >= 3.0.0

Quick Start

import { Agent } from "@mastra/core/agent";
import { Agentified } from "agentified";
import { mastra } from "@agentified/mastra";
import { openai } from "@ai-sdk/openai";

const ag = new Agentified().adaptTo(mastra());
await ag.connect("http://localhost:9119");

const instance = await ag.dataset("my-agent").register({
  tools: [
    { name: "get_weather", description: "Get weather", parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] }, handler: async (args) => ({ temp: 22 }) },
  ],
});

const session = instance.session("chat-1");
const agent = new Agent({
  name: "my-agent",
  model: openai("gpt-4o-mini"),
  instructions: "Use agentified_discover to find tools, then call them.",
});

// Simple — prepareStep is a property, includes discover by default
const result = await agent.generate(messages, {
  prepareStep: session.prepareStep,
  maxSteps: 10,
});

// With explicit tools via context chain
const ctx = await session.context
  .tools({ agentified_discover: session.discoverTool })
  .assemble();
// ctx.tools → { agentified_discover, ...discoveredTools }
// ctx.prepareStep → returns { tools } for Mastra injection
const result2 = await agent.generate(messages, {
  prepareStep: ctx.prepareStep,
  maxSteps: 10,
});

Note: @ai-sdk/openai must be ^3.0.0 (AI SDK v4). Mastra 1.11+ rejects v1.x.

Adapter Pattern

The mastra() factory returns an adapter for Agentified.adaptTo(). This wraps SDK classes in Mastra-typed shells via composition (not inheritance):

Agentified.adaptTo(mastra()) → MastraAgentified
  └─ .dataset(name) → MastraDatasetRef
       └─ .register({ tools }) → MastraInstance
            ├─ .discoverTool     — Mastra createTool
            ├─ .prepareStep      — property, returns { tools } for injection
            ├─ .session(id)      → MastraSession
            │    ├─ .discoverTool      — Mastra createTool
            │    ├─ .getMessagesTool  — Mastra createTool (conversation navigation)
            │    ├─ .prepareStep  — property, returns { tools }
            │    ├─ .context      → MastraContextBuilder
            │    │    ├─ .tools(Record<string, MastraTool>) — chainable
            │    │    ├─ .messages() / .recall()
            │    │    └─ .assemble() → MastraAssembledContext
            │    │         ├─ .tools — explicit + discovered
            │    │         └─ .prepareStep — returns { tools }
            │    ├─ .conversation (SDK passthrough)
            │    └─ .getMessages / .updateConversation
            └─ .namespace(id)    → MastraNamespace
                 └─ .session(id) → MastraSession

Import SDK classes from agentified, Mastra-specific adapters from @agentified/mastra.

API Reference

mastra()

Returns an adapter object for Agentified.adaptTo().

import { Agentified } from "agentified";
import { mastra } from "@agentified/mastra";

const ag = new Agentified().adaptTo(mastra());

MastraInstance

Wraps SDK Instance. discoverTool is a Mastra createTool result instead of a raw DiscoverTool.

MastraSession

Wraps SDK Session. discoverTool and getMessagesTool are Mastra createTool results. Delegates context, conversation, getMessages, updateConversation to the SDK session. prepareStep includes both agentified_discover and agentified_get_messages in the returned tools.

streamSSE(observable, res)

Pipes an AG-UI Observable into an HTTP SSE response.

import { streamSSE } from "@agentified/mastra";

jsonSchemaToZod(schema)

Converts a JSON Schema object to a Zod schema. Used internally to hydrate Mastra tools.

import { jsonSchemaToZod } from "@agentified/mastra";

Links

License

MIT