The Upstreet Agents SDK is now in public beta 🎉 Get started →
ConceptsThe Agents SDKAgent Structure

Agent Structure

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

Once you've created an Agent, you may see a folder structure. This guide describes key files and their objectives.

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. The "id" key must never be modified. Manual modifications might break your Agent, so proceed with caution if changes are required.
  • WALLET_MNEMONIC: Customize as needed
  • WORKER_ENV: Defines the Agent's current environment

Never modify AGENT_TOKEN, SUPABASE_URL, or SUPABASE_PUBLIC_API_KEY unless you know exactly what you're doing!

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!