The Upstreet Agents SDK is now in public beta 🎉 Get started →
ConceptsUpstreet Agents SDK (usdk)

Agent Structure

Learn how an Agent is broken down into files and folders.

An Upstreet Agent project

This is an Upstreet Agent project bootstrapped with usdk create.

This README provides instructions for customizing and running your Upstreet Agent.

Prerequisites

Before you begin, ensure you have the following:

  • Upstreet SDK installed via npm
  • An active login to the Upstreet SDK
  • Sufficient credits to create and interact with agents

Read more in our documentation.

Key Files and Customization

1. wrangler.toml

We do not recommend modifying this configuration file manually. Following is a breakdown of some important variables within it:

  • AGENT_JSON: Contains essential Agent data. You should not need to modify anything here; manual modifications might break your Agent, so proceed with caution if changes are required.
  • WORKER_ENV: Defines the Agent's current environment: "development" or "production"

The file is located at the root of the Agent directory i.e myAgent/wrangler.toml.

2. agent.tsx

This is where the magic happens!

Customize your Agent's features using our React-based components, located at the root of the Agent directory i.e myAgent/agent.tsx.

The following is the base structure of an Agent:

import React from 'react';
import {
  Agent,
} from 'react-agents';
 
export default function MyAgent() {
  return (
    <Agent>
      {/* Add features here */}
    </Agent>
  );
}

You can easily add or remove features to customize your Agent. For example, here's how you can add Text-to-Speech (TTS) capability:

import React from 'react';
import {
  Agent,
  TTS,
  // Import more features here
} from 'react-agents';
 
export default function MyAgent() {
  return (
    <Agent>
      <TTS
        voiceEndpoint="elevenlabs:scillia:kNBPK9DILaezWWUSHpF9" 
      />
      {/* Add more features here */}
    </Agent>
  );
}

This modular approach allows you to easily add, remove, or modify features as needed. Experiment with different components to create an Agent that perfectly suits your requirements!

3. default-components.tsx

This file houses all default Agent features. Feel free to create your own custom React components to supercharge your Agent with unique capabilities!

The following are some default features an Agent has, which are designed for:

  • DefaultPrompts: Handles prompt injection based on all the functional components added to the Agent, to guide the Agent's responses.
  • DefaultPerceptions: Handles how the Agent perceives and responds to incoming stimulations from entities i.e messages and nudges.
  • DefaultActions: Handles chat, social media, and store-related actions that an Agent can execute in response to a prompt.
  • DefaultFormatters: Handles JSON formatting for actions.
  • DefaultGenerators: Handles media generation capabilities.
  • DefaultSenses: Provides multimedia perception and web browsing abilities.
  • DefaultDrivers: Implements phone-related actions (calls and texts).
  • RAGMemory: Manages the Agent's memory system.

These components form the foundation of your Agent's capabilities. You can modify or extend them to create a truly unique AI assistant!

Running and Testing

To run and test your Agent, run:

usdk chat <your-agent-directory>

Where <your-agent-directory> is the relative path to the directory containing all your Agent's code. How to create an Agent

This command launches an interactive chat session (REPL-like) with your Agent, where you can input prompts and review responses in real-time.

To exit the chat, type .exit in the chat and press the Enter key. Or, you can use the shortcut CTRL+C twice.

Note: Your AI inferences will not run locally. The Upstreet Agent may consume credits during testing.

Prompt the Agent to perform the specific action you want to test, or use your own testing process to verify its functionality. Additionally, you can write tests using Jest to automate and ensure the reliability of your Agent's features.

Deployment

Ready to unleash your Agent onto the world? Simply run:

usdk deploy <your-agent-directory>

Your Agent will be live and accessible via the provided URL obtained after a successful deployment.

Need Help?

Happy Agent building! 🤖✨