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

@smythos/sdk

v1.3.40

Published

SRE SDK

Readme

Welcome to the SmythOS SDK! This powerful toolkit allows you to build, manage, and deploy sophisticated AI agents with ease. Whether you're creating a simple chatbot or a complex multi-agent system, the SmythOS SDK provides the tools you need to bring your ideas to life.

The SDK is a lightweight wrapper around the Smyth Runtime Environment. It lets you create and run agents with minimal setup while still allowing advanced customisation when needed.

Key Features

  • Fluent Agent API: A clean and intuitive API for creating and interacting with agents.
  • Extensible Skills: Easily add new capabilities to your agents, from calling APIs to running custom code.
  • Streaming Support: Get real-time responses from your agents for dynamic and interactive experiences.
  • Integrated AI Components: Seamlessly connect to LLMs, Vector Databases, and Storage solutions.
  • Agent Serialization: Save and load your agent's state, including skills and memory.
  • Team Management: Orchestrate multiple agents to work together in teams.
  • Document Parsing: Built-in support for parsing various document types like PDF, DOCX, and Markdown.
  • Full SRE Access: Access the complete Smyth Runtime Environment API through @smythos/sdk/core for advanced use cases.

Import Paths

The SDK provides two import paths:

Main SDK (@smythos/sdk)

The simplified, developer-friendly API for common use cases:

import { Agent, LLM, VectorDB, Storage } from '@smythos/sdk';

Core SRE (@smythos/sdk/core)

Full access to the complete Smyth Runtime Environment for advanced scenarios:

import { SmythRuntime, SecureConnector, ACL, TAccessLevel } from '@smythos/sdk/core';

This allows you to use a single package while having access to both the simplified SDK API and the full SRE capabilities when needed.

Getting Started

Let's build your first agent in just a few lines of code. This example creates a simple agent that can fetch cryptocurrency prices.

1. Install SmythOS CLI

The easiest way to get started is by using the scaffolding command from the SmythOS CLI.

Install the cli using your preferred package manager

# install the cli using your preferred package manager
npm i -g @smythos/cli

this will install "sre" command in your system.

Create a new project

Run the following command, and follow the instructions to create a new project.

sre create "My Awesome Agent"

Select Empty Project template when asked.

2. Create your First Agent

Edit index.ts file and add the following code:

import { Agent } from '@smythos/sdk';

async function main() {
    // Create a new agent
    const agent = new Agent({
        name: 'Book Assistant',
        model: 'gpt-4o',
        behavior: 'You are a helpful assistant that can answer questions about the books.',
    });

    // Add a skill to the agent that uses the openlibrary api to get information about a book
    agent.addSkill({
        name: 'get_book_info',
        description: 'Use this skill to get information about a book',
        process: async ({ book_name }) => {
            const url = `https://openlibrary.org/search.json?q=${book_name}`;

            const response = await fetch(url);
            const data = await response.json();

            return data.docs[0];
        },
    });

    // Prompt the agent and let it use the skill
    const promptResult = await agent.prompt('What is the author of the book "The Great Gatsby" ?');

    //get the result
    console.log(promptResult);
}

main();

3. Run your Agent

first you need to build the project

npm run build

then you can run the agent

npm start

You should see your agent respond with the author of the book "The Great Gatsby"!

Reporting Issues

If you face any issues with the CLI or the code, set environment variable LOG_LEVEL="debug" and run your code again. Then share the logs with us, it will help diagnose the problem. You can request help on our Discord or by creating an issue on GitHub

Core Concepts

Agents

The Agent is the fundamental building block of the SmythOS SDK. It encapsulates a model, a set of behaviors, and a collection of skills. You can interact with an agent by sending it prompts.

import { Agent } from '@smythos/sdk';

const agent = new Agent({
    name: 'Book Assistant',
    model: 'gpt-4o',
    behavior: 'You are a helpful assistant that can answer questions about the books.',
});

Prompting

The prompt() method is the primary way to interact with an agent. It returns a special AgentCommand object which can be awaited directly for a simple response, or used to stream the response for real-time applications.

Promise-based response:

const response = await agent.prompt('What is the author of the book "The Great Gatsby" ?');
console.log(response);

Streaming response:

const stream = await agent.prompt('Tell me a story.').stream();
stream.on(TLLMEvent.Content, (chunk) => process.stdout.write(chunk));

//other events are available
//TLLMEvent.Content  : Generated response chunks
//TLLMEvent.Thinking : Thinking blocks/chunks
//TLLMEvent.End : End of the response
//TLLMEvent.Error : Error
//TLLMEvent.ToolInfo : Tool information : emitted by the LLM determines the next tool call
//TLLMEvent.ToolCall : Tool call : emitted before the tool call
//TLLMEvent.ToolResult : Tool result : emitted after the tool call
//TLLMEvent.Usage : Tokens usage information
//TLLMEvent.Interrupted : Interrupted : emitted when the response is interrupted before completion

Skills

Skills are functions that you can add to your agent to extend its capabilities. The agent's LLM can intelligently decide which skill to use based on the user's prompt.

Code skills

A code skill, is a skill where the logic is defined in the skill "process" function. This is the classic way of implementing skills via SDK

agent.addSkill({
    name: 'calculator',
    description: 'Perform mathematical calculations.',
    process: async ({ operation, a, b }) => {
        if (operation === 'add') return a + b;
        if (operation === 'subtract') return a - b;
        // ...
    },
});

Workflow skills

A workflow skill, is a skill where the logic is defined in a workflow. This is the internal mode used by the visual designer, but can also be implemented programmatically. (Will be covered in a separate documentation)

You can also call a skill directly using agent.call():

const sum = await agent.call('calculator', { operation: 'add', a: 5, b: 3 });
console.log(sum); // 8

Documentation

Comprehensive guides are available in the docs/ directory:

  1. Getting Started - Installation and your first agent
  2. Building Agents - Agent creation, modes, and skills
  3. Streaming Responses - Real-time response handling
  4. Chat Conversations - Building conversational agents
  5. Smyth Files - Working with .smyth workflow files
  6. Workflows - Building complex workflows
  7. Services - Using LLM, VectorDB, and Storage services
  8. Vector Databases - Vector database integration
  9. Advanced Topics - Deep dive into advanced features
  10. Language Models - Complete guide to model configuration
  11. Cheat Sheet - Quick reference guide

API Reference

For a detailed breakdown of all classes and methods, please refer to our full API documentation.

Contributing

We welcome contributions! Please see our Contributing Guide for more details.