### Install SmythOS CLI Source: https://smythos.com/docs/agent-runtime/quickstart Installs the SmythOS Command Line Interface globally, which is used to scaffold new projects. Ensure Node.js is installed before running this command. ```bash npm i -g @smythos/cli ``` -------------------------------- ### Install SmythOS SDK Source: https://smythos.com/docs/agent-runtime/sdk-guide Installs the SmythOS SDK package using npm. This is the initial step to begin developing with the SDK. ```bash npm install @smythos/sdk ``` -------------------------------- ### Install SRE SDK in Project Source: https://smythos.com/docs/agent-runtime/quickstart Installs the SmythOS SDK into your project's dependencies. This command should be run from within your project's root directory. ```bash npm install @smythos/sdk ``` -------------------------------- ### Install SmythOS SDK for Node.js Projects Source: https://smythos.com/docs/agent-runtime/getting-started Installs the SmythOS SDK directly into an existing Node.js project. This method is suitable for developers needing fine-grained control and direct integration. ```bash npm install @smythos/sdk ``` ```bash pnpm install @smythos/sdk ``` -------------------------------- ### Run SRE project with npm start Source: https://smythos.com/docs/agent-runtime/import-agents This is a command-line example showing how to run an SRE project after setting up the agent and terminal chat. The 'npm start' command initiates the project, and the user is prompted to enter a session ID for the chat. ```bash $ npm start ? Enter session ID: demo-session > Hello Raul < Hello Raul ``` -------------------------------- ### Get Chat - Example Source: https://smythos.com/docs/agent-studio/integrations/microsoft-teams-integration This example retrieves details for a specific chat using its `chat_id`. The output includes the chat's ID, type, web URL, and tenant ID. ```javascript { "chat_id": "SPECIFIC_CHAT_ID" } ``` -------------------------------- ### Install SmythOS CLI Globally Source: https://smythos.com/docs/agent-runtime/getting-started Installs the SmythOS CLI globally using npm. This command is typically used for a guided setup and project creation. ```bash npm install -g @smythos/cli ``` -------------------------------- ### HTTP GET Request Example Source: https://smythos.com/docs/agent-studio/components/advanced/api-call Demonstrates a simple GET request to fetch data from a sample URL. This is a basic example to test connectivity and understand the request structure. ```HTTP GET https://jsonplaceholder.typicode.com/todos/1 ``` -------------------------------- ### Run Agent with ts-node Source: https://smythos.com/docs/agent-runtime/quickstart Executes a TypeScript file containing an SRE SDK agent using `ts-node`. Ensure `ts-node` is installed globally or as a development dependency in your project. ```bash ts-node index.ts ``` -------------------------------- ### Test SRE Agent with npm start Source: https://smythos.com/docs/agent-studio/ui-for-sre This snippet demonstrates how to start your SRE agent project and interact with it via the terminal. It shows the command to run the project and an example interaction, including session ID input and agent response. ```bash $ npm start ? Enter session ID: demo-session > Raul > Hello Raul ``` -------------------------------- ### GitHub Integration Setup Source: https://smythos.com/docs/agent-studio/integrations/github-integration Guide to setting up a GitHub integration in SmythOS, including generating a Personal Access Token (PAT) and configuring it within the SmythOS Vault. ```APIDOC ## Prerequisites * An active **SmythOS account**. * A **GitHub Account** with access to the repositories you plan to integrate with. * A **GitHub Personal Access Token (PAT)** with the appropriate scopes. ## Getting Started With GitHub ### Step 1: Generate a GitHub Personal Access Token 1. **Sign in to GitHub** and navigate to **Settings** > **Developer settings**. 2. Go to **Personal access tokens** > **Tokens (classic)**. 3. Click **Generate new token (classic)**. 4. Give your token a descriptive **Note** (e.g., "SmythOS Integration"). 5. Set an **Expiration** period. 6. **Select scopes:** For broad functionality, check the main **`repo`** scope. 7. Click **Generate token**. ### Step 2: Copy and Store Your Token * **Important:** GitHub will show your new PAT **only once**. Copy the token immediately. * Store this token in the SmythOS **Vault**. Create a new secret named `github_pat` and paste your token as the value. ### Step 3: Configure the GitHub Integration in SmythOS 1. In your agent graph, drag and drop any GitHub component. 2. Click the component to open its **Settings**. 3. In the `Access Token` field, select the secret you saved in the Vault (e.g., `github_pat`). 4. Your connection is now configured for all GitHub components in that agent. ``` -------------------------------- ### Create New SmythOS Project with CLI Source: https://smythos.com/docs/agent-runtime/getting-started Initiates the creation of a new SmythOS project interactively using the CLI. The CLI will prompt for language, project name, and configuration details. ```bash sre create ``` -------------------------------- ### For Each: End-to-End Example Input Source: https://smythos.com/docs/agent-studio/components/advanced/for-each Provides the input array for an end-to-end example of the For Each component, demonstrating its use with a simple list of strings. ```json [ "Ada Lovelace", "Alan Turing" ] ``` -------------------------------- ### Example Memory Write Configuration Source: https://smythos.com/docs/agent-studio/components/memory/memory-write This example demonstrates the basic JSON structure for configuring the Memory Write component, specifying a key and its corresponding value. ```json { "key": "user-id", "value": 12345 } ``` -------------------------------- ### Verify SmythOS Installation Source: https://smythos.com/docs/agent-runtime/getting-started Verifies the installation of the SmythOS Runtime Environment by checking the CLI version. For SDK installations, it's also recommended to check the package.json file. ```bash sre --version ``` -------------------------------- ### Create and Configure Environment File Source: https://smythos.com/docs/agent-studio/self-hosted/docker-community Copies the example environment file and configures essential variables such as database connection, application base URL, session secret, and optional API key. ```bash cp .env.compose.example .env ``` ```env DATABASE_URL="mysql://user:pass@db:3306/smythos" APP_BASE_URL="http://localhost" SESSION_SECRET="long-random-string" OPENAI_API_KEY="sk-your-key" # optional ``` -------------------------------- ### API Call Component - GET Request Example Source: https://smythos.com/docs/agent-studio/components/advanced/api-call This example demonstrates a basic GET request to fetch data from a sample API endpoint. ```APIDOC ## GET /todos/1 ### Description Fetches a specific todo item from the JSONPlaceholder API. ### Method GET ### Endpoint `https://jsonplaceholder.typicode.com/todos/1` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body Not applicable for GET requests. ### Request Example None (GET requests do not typically have a request body). ### Response #### Success Response (200) - **userId** (integer) - The ID of the user who owns the todo item. - **id** (integer) - The ID of the todo item. - **title** (string) - The title of the todo item. - **completed** (boolean) - Indicates whether the todo item is completed. #### Response Example ```json { "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false } ``` ``` -------------------------------- ### Build and Run First Agent with SRE SDK (TypeScript) Source: https://smythos.com/docs/agent-runtime/quickstart Defines a basic AI agent named 'CryptoMarket Assistant' using the SRE SDK in TypeScript. It adds a 'MarketData' skill to fetch cryptocurrency prices and demonstrates how to prompt the agent and call the skill directly. Requires Node.js 18+ and ts-node for execution. ```typescript import { Agent } from '@smythos/sdk'; async function main() { const agent = new Agent({ name: 'CryptoMarket Assistant', behavior: 'Track and report cryptocurrency prices in USD.', model: 'gpt-4o', }); agent.addSkill({ name: 'MarketData', description: 'Fetch market data for a cryptocurrency', process: async ({ coin_id }) => { const url = `https://api.coingecko.com/api/v3/coins/${coin_id}?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false`; const response = await fetch(url); const data = await response.json(); return data.market_data; }, }); // Ask the agent to use its skill const response = await agent.prompt('What are the current prices of Bitcoin and Ethereum?'); console.log('Agent response:', response); // Call the skill directly const direct = await agent.call('MarketData', { coin_id: 'bitcoin' }); console.log('Direct price for Bitcoin:', direct.current_price.usd); } main().catch(console.error); ``` -------------------------------- ### Notion Integration Setup Source: https://smythos.com/docs/agent-studio/integrations/notion-integration Instructions on how to set up the Notion integration with SmythOS, including creating a Notion integration and obtaining your Integration Secret. ```APIDOC ## Prerequisites * An active SmythOS account. * A Notion Account with permission to create integrations. * The Notion pages or databases you want to automate must be shared with your integration. ## Getting Started With Notion ### Step 1: Create a Notion Integration & Get Your Secret 1. Open Notion Settings & members → Connections. 2. Click "Develop or manage integrations". 3. Click "New integration". 4. Enter a name, pick your workspace, set Type to "Internal", optionally add a logo. Click "Save". 5. Click "Configure integration settings". 6. On the "Configuration" tab, click "Show" for "Internal Integration Secret" and copy it. Store it securely. 7. Click "Refresh" to rotate if needed. 8. Open the "Access" tab. 9. Click "Select pages", choose the pages or databases your bot needs, then click "Update access". ``` -------------------------------- ### Install SmythOS CLI Source: https://smythos.com/docs/agent-runtime/cli-guide Installs the SmythOS CLI globally using npm. Requires Node.js v18 or higher. It is recommended to update the CLI regularly. ```bash npm install -g @smythos/cli ``` -------------------------------- ### Prerequisites and Setup Source: https://smythos.com/docs/agent-studio/integrations/klaviyo-integration Information on the necessary accounts and API keys required to integrate Klaviyo with SmythOS, including steps to obtain a Klaviyo Private API Key. ```APIDOC ## Prerequisites Before integrating Klaviyo with SmythOS, ensure you have: * An active **SmythOS account**. * A **Klaviyo account**. * A Klaviyo Private **API Key**. ### Step 1: Get Your Klaviyo API Key 1. Log in to your Klaviyo account. 2. Navigate to **Settings** > **API Keys**. 3. Click **Create Private API Key** if you don't have one. 4. Name the key (e.g., "SmythOS Agent") and grant necessary scopes (Campaigns, Lists, Profiles, etc.). 5. Copy the generated API Key. ``` -------------------------------- ### Get Nearby Places Component Example (SmythOS) Source: https://smythos.com/docs/agent-studio/integrations/google-maps-integration This example shows how to utilize the 'Get Nearby Places' component in SmythOS to find points of interest (POIs) around a specific geographical location. It takes a location (latitude, longitude), a search radius in meters, and a keyword as input, returning an array of nearby places. ```json { "component": "maps.getNearbyPlaces", "location": "37.4220,-122.0841", "radius": 1500, "keyword": "restaurant" } ``` -------------------------------- ### Scaffold New Agent Project Source: https://smythos.com/docs/agent-runtime/cli-guide Initializes a new SmythOS SDK agent project. Prompts guide the user to select a language (TypeScript recommended), name the agent, and set up project files. ```bash sre create ``` -------------------------------- ### Get Message in Chat - Example Source: https://smythos.com/docs/agent-studio/integrations/microsoft-teams-integration This snippet shows how to fetch a specific message from a chat. It requires both the `chat_id` and `message_id`. The output is the message's content, which can include HTML. ```javascript { "chat_id": "CHAT_ID_CONTAINING_MESSAGE", "message_id": "SPECIFIC_MESSAGE_ID" } ``` -------------------------------- ### OneDrive Get Item By Path Source: https://smythos.com/docs/agent-studio/integrations/onedrive-integration Retrieves a file or folder from a user's drive using its relative path from the root. The path must be URL-encoded and start with a '/'. ```APIDOC ## GET /users/{userId}/drive/root:/{item-path} ### Description Retrieves a file or folder from a user's drive using its relative path from the root. The path must be URL-encoded and start with a '/'. ### Method GET ### Endpoint /users/{userId}/drive/root:/{item-path} ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user who owns the item. - **item-path** (string) - Required - The path of the item, e.g., `/Documents/Report.docx`. ### Request Body (Not applicable for GET request) ### Request Example ```json { "component": "onedrive.getItemByPath", "userId": "user-guid-from-entra", "item-path": "/Documents/Q3-Report.docx" } ``` ### Response #### Success Response (200) - **itemId** (string) - The ID of the retrieved item. - **name** (string) - The name of the retrieved item. - **webUrl** (string) - The web URL to access the item. - **response** (object) - The raw JSON response from the OneDrive API. - **headers** (object) - HTTP headers from the API response. #### Response Example ```json { "itemId": "12345abcde", "name": "Q3-Report.docx", "webUrl": "https://onedrive.live.com/redir?page=item&resid=...", "response": { ... }, "headers": { ... } } ``` ### Troubleshooting The path must be URL-encoded and start with a `/`. A `404 Not Found` error indicates the path is incorrect. ``` -------------------------------- ### Automate CLI Commands with npm Scripts Source: https://smythos.com/docs/agent-runtime/cli-guide Example of how to integrate SmythOS CLI commands into npm scripts within a `package.json` file for automation. These scripts can be used in CI/CD pipelines. ```json { "scripts": { "dev": "sre run", "build": "sre build", "export": "sre export" } } ``` -------------------------------- ### Asana OAuth 2.0 Setup Source: https://smythos.com/docs/agent-studio/integrations/asana-integration Instructions for setting up OAuth 2.0 authentication to connect your Asana account with SmythOS, including obtaining credentials and storing them securely. ```APIDOC ## Setting Up Asana Integration with SmythOS To integrate Asana with SmythOS, you need to set up OAuth 2.0 authentication and securely store your credentials. ### Step 1: Obtain OAuth 2.0 Credentials from Asana Developer Console 1. Log in to your Asana account. 2. Navigate to the **Asana Developer Console**. 3. Click on **+ New App**. 4. Fill in the application details: * **Name**: Provide a name for your application (e.g., "SmythOS Workflow Agent"). * **Redirect URL**: Enter the SmythOS callback URL: `https://app.smythos.com/oauth/oauth2/callback`. 5. After creating the app, copy the **Client ID** and **Client Secret** from the app's settings page. ### Step 2: Store Credentials in SmythOS Vault 1. Log in to your SmythOS dashboard. 2. Navigate to the **Vault** section. 3. Create new secrets for your Asana credentials: * Create a secret for your `Client ID` (e.g., name it `asana_client_id`). * Create a secret for your `Client Secret` (e.g., name it `asana_client_secret`). * Refer to the Vault Documentation for detailed instructions on storing secrets. ``` -------------------------------- ### Example Input and Configured Outputs for Debugging (JSON) Source: https://smythos.com/docs/agent-studio/components/base/classifier Illustrates a sample input message and the corresponding configured output categories for debugging the classification model. This helps in verifying how the model routes messages based on the defined outputs. ```json [ { "Name": "support", "Description": "Customer support requests" }, { "Name": "sales", "Description": "Product pricing or upgrade inquiries" }, { "Name": "marketing", "Description": "Messages about promotions or events" } ] ``` -------------------------------- ### Extend and Use an Imported Agent in SDK (JavaScript) Source: https://smythos.com/docs/agent-runtime/hybrid-workflows This JavaScript example illustrates initializing the SRE runtime, loading an agent, adding a custom skill to it, prompting the agent for analysis, and then using the custom skill to process the agent's output into a structured report. ```javascript import { SRE, SDK } from 'smyth-runtime'; async function main() { // 1. Initialize the SRE runtime for a local environment const sre = SRE.init({ Cache: { Connector: 'RAM' }, Storage: { Connector: 'Local' }, Log: { Connector: 'ConsoleLog' }, }); await sre.ready(); // 2. Load the agent from the .smyth file const agent = new SDK.Agent({ name: 'AINewsAnalystAgent', model: 'gpt-4', behavior: 'You are a sharp AI industry analyst. You provide concise, data-driven insights on the latest AI news and its impact on the market.', }); // 3. Extend the agent with a new custom skill agent.addSkill({ name: 'formatAIAnalysis', description: 'Formats a raw text analysis into a structured JSON report.', ai_exposed: false, process: async (rawAnalysisText) => { let sentiment = 'Neutral'; if (rawAnalysisText.toLowerCase().includes('disruptive') || rawAnalysisText.toLowerCase().includes('significant')) { sentiment = 'Positive'; } else if (rawAnalysisText.toLowerCase().includes('challenges') || rawAnalysisText.toLowerCase().includes('concerns')) { sentiment = 'Mixed'; } return { analysis_summary: rawAnalysisText, market_sentiment: sentiment, report_generated_at: new Date().toISOString(), }; }, }); // 4. Prompt the agent for analysis const topic = 'the release of the "Veo-3" AI model'; const analysisText = await agent.prompt(`Analyze the market impact of ${topic}.`); // 5. Use the new skill to process the agent's output const formattingSkill = agent.getSkill('formatAIAnalysis'); const structuredReport = await formattingSkill.process(analysisText); // 6. Display the final result console.log(structuredReport); } main().catch(console.error); ```