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

solaflare-agent

v1.0.4

Published

SDK for spinning up AI agents inside sandboxed environments

Readme

Solaflare Agent SDK

Solaflare Agent is a Node.js SDK for running AI agents and raw Linux commands inside sandboxed E2B environments. It wraps sandbox lifecycle, prompt execution, shell execution, file operations, MCP configuration, and session reuse behind a single Agent class.

Installation

npm install solaflare-agent
# or
pnpm add solaflare-agent
# or
yarn add solaflare-agent

Environment Requirements

  • Node.js >= 22
  • An accessible E2B template name such as open-code or open-code:large
  • E2B credentials available to the underlying E2B client, typically through sandboxSettings.apiKey or E2B_API_KEY
  • At least one AI provider API key only when using execute() or stream()

Typical host environment setup:

ANTHROPIC_API_KEY=your_anthropic_key
OPENAI_API_KEY=your_openai_key
GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_key
E2B_API_KEY=your_e2b_key

Quick Start

Prompt-based usage:

import { Agent } from "solaflare-agent";

const agent = new Agent({
  name: "open-code",
  capabilities: {
    rules: "You are a careful TypeScript assistant.",
  },
});

const output = await agent.execute({
  prompt: "Write a hello world function in TypeScript.",
});

console.log(output);
console.log("Agent ID:", agent.agentId);

await agent.kill();

Direct shell usage:

import { Agent } from "solaflare-agent";

const agent = new Agent({
  name: "open-code",
});

const result = await agent.runCommand("pwd && ls -la", {
  timeoutMs: 30_000,
});

console.log(result.exitCode);
console.log(result.stdout);
console.log(result.stderr);

await agent.kill();

runCommand() does not require AI provider keys. execute() and stream() do.

Documentation Map

Core Concepts

Template names

The name field is the E2B template identifier used when creating a new sandbox. The bundled template is open-code, and tagged variants such as open-code:large can be used when you need a different size profile.

Lazy initialization

The constructor does not create a sandbox immediately. Initialization happens when you call init() or the first method that needs a live sandbox, such as runCommand(), stream(), execute(), uploadFiles(), listDir(), readFile(), downloadUrl(), or getUrl().

Execution surfaces

  • runCommand() executes a raw Linux command inside the sandbox and returns { stdout, stderr, exitCode, error? }
  • execute() writes prompt.txt, invokes run.sh, and returns the complete stdout output as a string
  • stream() writes prompt.txt, invokes run.sh, and yields Response chunks as output arrives

Prompt continuation

execute() and stream() use ./run.sh -c after the first successful prompt in a session. Reconnected sandboxes start in continue mode immediately. runCommand() does not change this prompt continuation state.

Host environment vs sandbox environment

  • providers supplies AI provider credentials for prompt execution
  • If providers is omitted, the SDK falls back to host environment variables
  • If providers is supplied, the SDK uses that object as-is and does not merge missing keys from the host environment
  • env injects arbitrary environment variables into the sandbox
  • When the same key exists in both places, provider keys override env

Built-in open-code template

The bundled open-code template uses /home/user as its working directory. On new sandboxes, Solaflare Agent writes MCP configuration into .solaflare-agent/mcps.json, writes rules into AGENTS.md, runs init.sh once, and uses run.sh for prompt execution. runCommand() bypasses prompt.txt and run.sh and executes the provided shell command directly inside the sandbox.

This README stays focused on onboarding. For full technical documentation, use the linked guide and API reference above.