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

codeable

v0.0.1

Published

A tool that lets AI agents write code to orchestrate tools instead of making sequential tool calls.

Downloads

9

Readme

Codeable

Codeable is a tool that lets you wrap existing tools into a code-writing environment. Instead of relying on an LLM to make multiple sequential tool calls (which can be fragile and token-expensive), Codeable allows the agent to write a single script that orchestrates these tools to achieve a goal.

Note: This concept is inspired by Cloudflare's Code Mode, but Codeable runs locally in your environment rather than on a Cloudflare Worker.

Why Codeable?

AI agents are often better at writing code than they are at managing complex tool calling chains.

  • Standard Tool Calling: The LLM must decide to call a tool, wait for the result, feed it back into context, and decide the next step. This involves multiple round-trips and context switching.
  • Codeable: The LLM writes a standard TypeScript/JavaScript function that calls the tools directly. It can use loops, variables, and logic natively. The code is then executed safely in your local environment.

Installation

npm install codeable
# or
pnpm add codeable

Usage

Codeable is designed to work seamlessly with the Vercel AI SDK.

1. Define Your Tools

First, define the tools your agent needs using the AI SDK's tool() function.

import { z } from "zod";
import { tool } from "ai";

const weatherTool = tool({
  description: "Get the weather for a location",
  inputSchema: z.object({ location: z.string() }),
  outputSchema: z.object({ temperature: z.number(), condition: z.string() }),
  execute: async ({ location }) => {
    // Mock implementation
    return { temperature: 72, condition: "Sunny" };
  },
});

2. Create a Codeable Instance

Wrap your tools using the codeable helper.

import { openai } from "@ai-sdk/openai";
import { codeable } from "codeable/ai-sdk";

const myCodeable = codeable({
  systemPrompt: "You are a helpful assistant.",
  llm: openai("gpt-4o"), // Model used to write the code
  tools: {
    weather: weatherTool,
    // ... add other tools here
  },
});

3. Use with Vercel AI SDK

Pass the codeable tool and its system prompt to your AI generation function.

import { streamText } from "ai";

const result = await streamText({
  model: openai("gpt-4o"),
  // The codeable system prompt helps the model understand available tools
  system: myCodeable.system,
  tools: {
    codeable: myCodeable.tool, // Expose the meta-tool
  },
  prompt:
    "Check the weather in Tokyo and New York, then tell me which is warmer.",
});

How It Works

  1. Prompting: When you ask a question, the LLM (via codeable) receives a description of all available tools as TypeScript definitions.
  2. Code Generation: Instead of calling weather directly, the LLM writes a script:
    async function main({ tools }) {
      const tokyo = await tools.weather({ location: "Tokyo" });
      const ny = await tools.weather({ location: "New York" });
      return tokyo.temperature > ny.temperature ? "Tokyo" : "New York";
    }
  3. Execution: Codeable executes this script locally, handling the tool calls and returning the final result to the main agent.