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 🙏

© 2025 – Pkg Stats / Ryan Hefner

truffle-ai

v2.0.2

Published

An SDK to interact with serverless AI agents using Truffle AI

Downloads

123

Readme

TruffleAI SDK

A TypeScript SDK for interacting with the TruffleAI API. Build and deploy AI agents with ease.

📚 View Full Documentation

Installation

npm install truffle-ai

Quick Start

import { TruffleAI } from 'truffle-ai';

// Initialize the client
const client = new TruffleAI('your-api-key');

// Create and deploy a new agent
const agent = await client.deployAgent({
    name: 'My Assistant',
    instruction: 'Help users with their questions',
    model: 'gpt-4o-mini',
    tool: 'None'
});

// Run a task with the agent
const result = await agent.run('What is the capital of France?');
console.log(result.data); // Paris

// Load an existing agent
// AgentId can be found in the dashboard
const existingAgent = await client.loadAgent('agent-id');

Core Features

  • 🚀 Create and deploy AI agents with minimal setup
  • 🤖 Run one-off tasks with deployed agents
  • 🔒 Type-safe with comprehensive error handling

Creating Agents

Agents are created with a configuration that defines their behavior:

const agentConfig = {
    name: 'My Assistant',        // Name of your agent
    instruction: 'You are...',   // Instructions defining behavior
    model: 'gpt-4o-mini',       // AI model to use
    tool: 'None'                // Tool configuration
};

const agent = await client.deployAgent(agentConfig);

Using Tools

Agents can be equipped with powerful tools to enhance their capabilities. Here's an example using the pre-built Tavily Research tool for web search. For a complete list of available tools and capabilities, check out our documentation.

// Create an agent with Tavily Research tool
const researchAgent = await client.deployAgent({
    name: 'Research Assistant',
    instruction: 'You are a research assistant that helps users find accurate information from the web.',
    model: 'gpt-4o-mini',
    tool: 'Tavily Research'      // Enable web search capabilities
});

// Run a research task
const result = await researchAgent.run('What are the latest developments in quantum computing?');
console.log(result.data);        // Contains AI-processed research findings from the web

Running Tasks

Once deployed, you can run tasks with your agent:

// Run a single task
const result = await agent.run('Analyze this text...');
console.log(result.data);

// Load and use an existing agent
const existingAgent = await client.loadAgent('agent-id');
const result = await existingAgent.run('Another task...');

Error Handling

The SDK provides structured error handling:

try {
    const agent = await client.deployAgent({
        name: 'My Assistant',
        instruction: 'Help users with questions',
        model: 'gpt-4o-mini'
    });
} catch (error) {
    if (error instanceof ValidationError) {
        // Handle validation errors (e.g., missing required fields)
        console.error('Invalid configuration:', error.message);
    } else if (error instanceof AuthenticationError) {
        // Handle authentication errors (e.g., invalid API key)
        console.error('Authentication failed:', error.message);
    } else if (error instanceof TruffleError) {
        // Handle other API errors
        console.error('API error:', error.message);
    }
}

Support

For support, email founders@trytruffle.ai or open an issue on GitHub.