### Install Sim Helm Chart (Quick Start) Source: https://github.com/simstudioai/sim/blob/main/helm/sim/README.md Installs the Sim Helm chart from the repository root using the default configuration. This is the simplest way to get started with deploying Sim. ```bash helm install sim ./helm/sim ``` -------------------------------- ### Clone Sim Repository and Install Dependencies Source: https://github.com/simstudioai/sim/blob/main/README.md This sequence of commands clones the Sim project from its GitHub repository and installs the project's dependencies using the Bun package manager. This is a prerequisite for manual setup. ```bash git clone https://github.com/simstudioai/sim.git cd sim bun install ``` -------------------------------- ### Configure Agent Block with System and User Prompts Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/getting-started/index.mdx This snippet details the configuration of an Agent Block within Sim Studio. It specifies the AI model to use (OpenAI GPT-4o), the system prompt for the AI's role, and how to connect the workflow's start block input to the agent's user prompt. ```Sim Studio Configuration Agent Block Configuration: - Model: OpenAI GPT-4o - System Prompt: "You are a people research agent. When given a person's name, use your available search tools to find comprehensive information about them including their location, profession, educational background, and other relevant details." - User Prompt: Connect to this field. ``` -------------------------------- ### Setup Python SDK Development Environment Source: https://github.com/simstudioai/sim/blob/main/packages/python-sdk/README.md Instructions for setting up a local development environment for the SimStudio Python SDK, including cloning the repository, creating a virtual environment, installing dependencies, and running tests. ```bash cd packages/python-sdk python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e ".[dev]" pytest tests/ -v ``` -------------------------------- ### Start Sim with CPU and Setup Profiles (Docker) Source: https://github.com/simstudioai/sim/blob/main/README.md This command starts the Sim application using Docker Compose with specific profiles for CPU-only systems and initial setup. It ensures the necessary services are running in detached mode. ```bash docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d ``` -------------------------------- ### Add Exa and Linkup Tools to Agent Block Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/getting-started/index.mdx This configuration shows how to enhance an AI agent's capabilities by adding external tools. It involves selecting specific tools like Exa and Linkup from the available options and providing the necessary API keys for their functionality. ```Sim Studio Configuration Agent Block Tools Configuration: - Add Tool: Exa - Add Tool: Linkup - API Keys: Provide API keys for Exa and Linkup. ``` -------------------------------- ### Run Development Server (Bash) Source: https://github.com/simstudioai/sim/blob/main/apps/docs/README.md This command starts the development server for the Next.js application. It requires Bun to be installed. ```bash bun run dev ``` -------------------------------- ### Starter Block Example: Manual Start Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/starter.mdx Provides a YAML example of a Starter block configured for a manual workflow trigger. It includes the basic 'type', 'name', and 'connections' properties. ```yaml start: type: starter name: Start inputs: startWorkflow: manual connections: success: next-block ``` -------------------------------- ### Starter Block Example: Manual Start with Input Format Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/starter.mdx Demonstrates a Starter block configured for manual triggering, including a defined 'inputFormat' to specify the expected structure for API call inputs. ```yaml start: type: starter name: Start inputs: startWorkflow: manual inputFormat: - name: query type: string - name: email type: string - name: age type: number - name: isActive type: boolean - name: preferences type: object - name: tags type: array connections: success: agent-1 ``` -------------------------------- ### Import UI Components for Sim Studio AI Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/getting-started/index.mdx Imports various UI components from 'fumadocs-ui' and custom components for building AI workflows in Sim Studio AI. These components include callouts, cards, file explorers, steps, tabs, theme images, and various AI/tool icons. ```TypeScript import { Callout } from 'fumadocs-ui/components/callout' import { Card, Cards } from 'fumadocs-ui/components/card' import { File, Files, Folder } from 'fumadocs-ui/components/files' import { Step, Steps } from 'fumadocs-ui/components/steps' import { Tab, Tabs } from 'fumadocs-ui/components/tabs' import { ThemeImage } from '@/components/ui/theme-image' import { AgentIcon, ApiIcon, ChartBarIcon, CodeIcon, ConditionalIcon, ConnectIcon, ExaAIIcon, FirecrawlIcon, GmailIcon, NotionIcon, PerplexityIcon, SlackIcon, } from '@/components/icons' import { Video } from '@/components/ui/video' ``` -------------------------------- ### Generate JSON Schema for Structured Output Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/getting-started/index.mdx This process demonstrates how to configure an Agent Block to return structured data. It involves using an AI prompt to automatically generate a JSON schema based on specified fields like location, profession, and education. ```Sim Studio Configuration Agent Block Response Format Configuration: - Click the magic wand icon next to the schema field. - Prompt AI: "create a schema named person, that contains location, profession, and education" ``` -------------------------------- ### Install Sim Python SDK Source: https://github.com/simstudioai/sim/blob/main/packages/python-sdk/README.md Installs the Sim Python SDK using pip. This is the first step to using the SDK in your Python projects. ```bash pip install simstudio-sdk ``` -------------------------------- ### Basic Workflow Execution Example Source: https://github.com/simstudioai/sim/blob/main/packages/python-sdk/README.md A comprehensive example demonstrating how to initialize the client, validate a workflow, execute it with input data, and handle the results or errors. ```python import os from simstudio import SimStudioClient client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY")) def run_workflow(): try: # Check if workflow is ready is_ready = client.validate_workflow("my-workflow-id") if not is_ready: raise Exception("Workflow is not deployed or ready") # Execute the workflow result = client.execute_workflow( "my-workflow-id", input_data={ "message": "Process this data", "user_id": "12345" } ) if result.success: print("Output:", result.output) print("Duration:", result.metadata.get("duration") if result.metadata else None) else: print("Workflow failed:", result.error) except Exception as error: print("Error:", error) run_workflow() ``` -------------------------------- ### Run Python SDK Examples Source: https://github.com/simstudioai/sim/blob/main/packages/README.md Instructions to run example scripts for the Python SDK, setting the API key environment variable. ```Bash cd packages/python-sdk SIMSTUDIO_API_KEY=your-key python examples/basic_usage.py ``` -------------------------------- ### Install Sim TypeScript SDK Source: https://github.com/simstudioai/sim/blob/main/packages/ts-sdk/README.md Instructions for installing the Sim TypeScript SDK using npm, yarn, or bun. ```bash npm install simstudio-ts-sdk # or yarn add simstudio-ts-sdk # or bun add simstudio-ts-sdk ``` -------------------------------- ### Run TypeScript SDK Examples Source: https://github.com/simstudioai/sim/blob/main/packages/README.md Instructions to run example scripts for the TypeScript SDK, setting the API key environment variable. ```Bash cd packages/ts-sdk SIMSTUDIO_API_KEY=your-key bun run examples/basic-usage.ts ``` -------------------------------- ### Self-host Sim.ai with Docker Compose Source: https://github.com/simstudioai/sim/blob/main/README.md This set of commands outlines the process for self-hosting Sim.ai using Docker Compose. It involves cloning the Sim.ai repository, navigating into the project directory, and then starting the application in detached mode using a production-specific Docker Compose file. Docker must be installed and running. ```bash # Clone the repository git clone https://github.com/simstudioai/sim.git # Navigate to the project directory cd sim # Start Sim docker compose -f docker-compose.prod.yml up -d ``` -------------------------------- ### Web Search with Structured Output Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/examples.mdx This workflow searches the web using tools and returns structured data. It utilizes an agent with a system prompt to guide the search and specifies a tool (Exa) for web searching. The response format is defined using a JSON schema. ```yaml version: '1.0' blocks: 59eb07c1-1411-4b28-a274-fa78f55daf72: type: starter name: Start inputs: startWorkflow: manual connections: success: d77c2c98-56c4-432d-9338-9bac54a2d42f d77c2c98-56c4-432d-9338-9bac54a2d42f: type: agent name: Agent 1 inputs: systemPrompt: look up the user input. use structured output userPrompt: model: claude-sonnet-4-0 apiKey: '{{ANTHROPIC_API_KEY}}' tools: - type: exa title: Exa params: type: auto apiKey: '{{EXA_API_KEY}}' numResults: '' toolId: exa_search operation: exa_search isExpanded: true usageControl: auto responseFormat: |- { "name": "output_schema", "description": "Defines the structure for an output object.", "strict": true, "schema": { "type": "object", "properties": { "output": { "type": "string", "description": "The output value" } }, "additionalProperties": false, "required": ["output"] } } ``` -------------------------------- ### Install Sim CLI Globally Source: https://github.com/simstudioai/sim/blob/main/packages/cli/README.md Installs the Sim CLI globally using npm. This command makes the 'simstudio' executable available in your system's PATH. ```bash npm install -g simstudio ``` -------------------------------- ### Start Sim Next.js Application Source: https://github.com/simstudioai/sim/blob/main/README.md This command starts only the Next.js application for Sim from the project root. It's an alternative if only the main application needs to be run. ```bash bun run dev ``` -------------------------------- ### Install Sim SDKs (TypeScript/JavaScript & Python) Source: https://github.com/simstudioai/sim/blob/main/packages/README.md Commands to install the Sim Studio SDKs for TypeScript/JavaScript using npm, yarn, or bun, and for Python using pip. ```Bash npm install simstudio-ts-sdk ``` ```Bash yarn add simstudio-ts-sdk ``` ```Bash bun add simstudio-ts-sdk ``` ```Bash pip install simstudio-sdk ``` -------------------------------- ### Basic Workflow Execution Example Source: https://github.com/simstudioai/sim/blob/main/packages/ts-sdk/README.md A comprehensive example demonstrating the workflow execution process, including validating readiness, executing the workflow with input, and handling the results or errors. ```typescript import { SimStudioClient } from 'simstudio-ts-sdk'; const client = new SimStudioClient({ apiKey: process.env.SIMSTUDIO_API_KEY! }); async function runWorkflow() { try { // Check if workflow is ready const isReady = await client.validateWorkflow('my-workflow-id'); if (!isReady) { throw new Error('Workflow is not deployed or ready'); } // Execute the workflow const result = await client.executeWorkflow('my-workflow-id', { input: { message: 'Process this data', userId: '12345' } }); if (result.success) { console.log('Output:', result.output); console.log('Duration:', result.metadata?.duration); } else { console.error('Workflow failed:', result.error); } } catch (error) { console.error('Error:', error); } } runWorkflow(); ``` -------------------------------- ### Start Sim Realtime Socket Server Source: https://github.com/simstudioai/sim/blob/main/README.md This command starts the realtime socket server for Sim. It needs to be executed from the apps/sim directory in a separate terminal, complementing the Next.js application. ```bash cd apps/sim bun run dev:sockets ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/simstudioai/sim/blob/main/packages/ts-sdk/README.md Command to install project dependencies using the Bun package manager. This is a common step after cloning a repository or setting up a new project. ```bash bun install ``` -------------------------------- ### Install Sim for GCP Environment (GKE) Source: https://github.com/simstudioai/sim/blob/main/helm/sim/README.md Deploys Sim optimized for Google Kubernetes Engine (GKE) using the `values-gcp.yaml` configuration. It installs into the `simstudio` namespace. ```bash helm install sim-gcp ./helm/sim \ --values ./helm/sim/examples/values-gcp.yaml \ --namespace simstudio --create-namespace ``` -------------------------------- ### Example: Simple GET Request with Headers Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/api.mdx This example demonstrates a simple GET request to fetch user data. It includes setting an 'Authorization' header with a Bearer token and a 'Content-Type' header. The connections specify the next block for success and error scenarios. ```yaml user-api: type: api name: "Fetch User Data" inputs: url: "https://api.example.com/users/123" method: GET headers: - id: header-1-uuid-here cells: Key: "Authorization" Value: "Bearer {{API_TOKEN}}" - id: header-2-uuid-here cells: Key: "Content-Type" Value: "application/json" connections: success: process-user-data error: handle-api-error ``` -------------------------------- ### Example: Dynamic URL with Query Parameters Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/api.mdx This example illustrates a GET request to search products, utilizing dynamic query parameters for search terms and category. It also includes an 'Authorization' header and sets a fixed limit parameter. The connections specify the next block for displaying results. ```yaml search-api: type: api name: "Search Products" inputs: url: "https://api.store.com/products" method: GET params: - id: search-param-uuid cells: Key: "q" Value: - id: limit-param-uuid cells: Key: "limit" Value: "10" - id: category-param-uuid cells: Key: "category" Value: headers: - id: auth-header-uuid cells: Key: "Authorization" Value: "Bearer {{STORE_API_KEY}}" connections: success: display-results ``` -------------------------------- ### Setup Documentation Generator Dependencies Source: https://github.com/simstudioai/sim/blob/main/scripts/README.md Installs necessary dependencies for the documentation generator, including TypeScript, ts-node, and type definitions. This script resolves common TypeScript and module resolution errors. ```bash #!/bin/bash ./scripts/setup-doc-generator.sh ``` -------------------------------- ### Start Sim Development Servers (Full Stack) Source: https://github.com/simstudioai/sim/blob/main/README.md This command starts both the main Next.js application and the realtime socket server for the Sim project from the project root. It's the recommended approach for a complete development environment. ```bash bun run dev:full ``` -------------------------------- ### Self-host Sim.ai with Docker Compose and Ollama Source: https://github.com/simstudioai/sim/blob/main/README.md This command demonstrates how to self-host Sim.ai using Docker Compose, specifically configured to utilize local AI models through Ollama. It starts the application with GPU support and automatically downloads the 'gemma3:4b' model. Docker and Ollama must be installed and running. ```bash # Start with GPU support (automatically downloads gemma3:4b model) docker compose -f docker-compose.ollama.yml --profile setup up -d ``` -------------------------------- ### Count-Based Parallel Processing Example - YAML Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/parallel.mdx This YAML configuration shows a 'count'-based parallel block named 'Worker Parallel'. It specifies 5 parallel instances with a maximum concurrency of 3, defining the start task ('worker-task') and an optional end task ('collect-worker-results'). ```yaml worker-parallel: type: parallel name: "Worker Parallel" inputs: parallelType: count count: 5 maxConcurrency: 3 connections: parallel: start: worker-task end: collect-worker-results worker-task: type: api name: "Worker Task" parentId: worker-parallel inputs: url: "https://api.worker.com/process" method: POST headers: - key: "Authorization" value: "Bearer {{WORKER_API_KEY}}" body: | { "instanceId": , "timestamp": "{{new Date().toISOString()}}" } connections: success: worker-complete ``` -------------------------------- ### Configure SimStudioClient with Environment Variables in Python Source: https://github.com/simstudioai/sim/blob/main/packages/python-sdk/README.md Illustrates how to initialize the SimStudioClient by reading the API key and base URL from environment variables, providing flexibility in configuration. ```python import os from simstudio import SimStudioClient # Using environment variables client = SimStudioClient( api_key=os.getenv("SIMSTUDIO_API_KEY"), base_url=os.getenv("SIMSTUDIO_BASE_URL", "https://sim.ai") ) ``` -------------------------------- ### Starter API Execution - Manual Mode (Bash) Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/triggers/starter.mdx Provides a cURL command to initiate a workflow via the API in Manual Mode, sending structured parameters. ```bash curl -X POST "https://api.sim.dev/v1/workflows/{id}/start" \ -H "Authorization: Bearer {api-key}" \ -d '{"parameters": {"userId": "123", "action": "process"}}' ``` -------------------------------- ### Initialize SimStudioClient Source: https://github.com/simstudioai/sim/blob/main/packages/python-sdk/README.md Initializes the SimStudioClient with an API key and an optional base URL. The API key can be fetched from environment variables. ```python import os from simstudio import SimStudioClient client = SimStudioClient( api_key=os.getenv("SIMSTUDIO_API_KEY", "your-api-key-here"), base_url="https://sim.ai" # optional, defaults to https://sim.ai ) ``` -------------------------------- ### Multi-Agent Chain Workflow Example Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/examples.mdx Demonstrates a sequential workflow where multiple AI agents process information. Each agent builds upon the output of the previous one, culminating in a final refined output. This example uses the 'agent' block type and specifies prompts, models, and API keys. ```yaml version: '1.0' blocks: start: type: starter name: Start inputs: startWorkflow: manual connections: success: agent-1-initiator agent-1-initiator: type: agent name: Agent 1 Initiator inputs: systemPrompt: You are the first agent in a chain. Your role is to analyze the input and create an initial response that will be passed to the next agent. userPrompt: |- Welcome! I'm the first agent in our chain. Input to process: Please create an initial analysis or greeting that the next agent can build upon. Be creative and set a positive tone for the chain! model: gpt-4o temperature: 0.7 apiKey: '{{OPENAI_API_KEY}}' connections: success: agent-2-enhancer agent-2-enhancer: type: agent name: Agent 2 Enhancer inputs: systemPrompt: You are the second agent in a chain. Take the output from Agent 1 and enhance it with additional insights or improvements. userPrompt: |- I'm the second agent! Here's what Agent 1 provided: Now I'll enhance this with additional details, insights, or improvements. Let me build upon their work! model: gpt-4o temperature: 0.7 apiKey: '{{OPENAI_API_KEY}}' connections: success: agent-3-refiner agent-3-refiner: type: agent name: Agent 3 Refiner inputs: systemPrompt: You are the third agent in a chain. Take the enhanced output from Agent 2 and refine it further, adding structure or organization. userPrompt: |- I'm the third agent in our chain! Here's the enhanced work from Agent 3: My job is to refine and organize this content. I'll add structure, clarity, and polish to make it even better! model: gpt-4o temperature: 0.6 apiKey: '{{OPENAI_API_KEY}}' connections: success: agent-4-finalizer agent-4-finalizer: type: agent name: Agent 4 Finalizer inputs: systemPrompt: You are the final agent in a chain of 4. Create a comprehensive summary and conclusion based on all the previous agents' work. userPrompt: |- I'm the final agent! Here's the refined work from Agent 3: As the last agent in our chain, I'll create a final, polished summary that brings together all the work from our team of 4 agents. Let me conclude this beautifully! model: gpt-4o temperature: 0.5 apiKey: '{{OPENAI_API_KEY}}' ``` -------------------------------- ### Starter Block Example: Weekly Schedule Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/yaml/blocks/starter.mdx Presents a YAML example of a Starter block configured for a weekly schedule. It includes 'scheduleType', 'weeklyDay', 'weeklyTime', and 'timezone' for precise scheduling. ```yaml start: type: starter name: Start inputs: startWorkflow: schedule scheduleType: weekly weeklyDay: MON weeklyTime: "08:30" timezone: UTC connections: success: weekly-report ``` -------------------------------- ### Install Sim for Production Environment Source: https://github.com/simstudioai/sim/blob/main/helm/sim/README.md Deploys Sim in a production environment using the `values-production.yaml` configuration file. It targets the `simstudio-prod` namespace and ensures its creation. ```bash helm install sim-prod ./helm/sim \ --values ./helm/sim/examples/values-production.yaml \ --namespace simstudio-prod --create-namespace ``` -------------------------------- ### Starter API Execution - Chat Mode (Bash) Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/triggers/starter.mdx Provides a cURL command to initiate a workflow via the API in Chat Mode, sending natural language input. ```bash curl -X POST "https://api.sim.dev/v1/workflows/{id}/start" \ -H "Authorization: Bearer {api-key}" \ -d '{"input": "Analyze Q4 sales data"}' ``` -------------------------------- ### Object Variable Example Source: https://github.com/simstudioai/sim/blob/main/apps/docs/content/docs/variables/index.mdx Provides an example of storing structured data with properties and values as an object variable. Uses JSON format. ```json { "name": "John", "age": 30, "city": "New York" } ```