mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 23:17:59 -05:00
Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04f109c1f4 | ||
|
|
48eab7e744 | ||
|
|
701bf2b510 | ||
|
|
ba8acbba07 | ||
|
|
56d04a9558 | ||
|
|
2ca9044bc6 | ||
|
|
b2009fe467 | ||
|
|
eb4821ff30 | ||
|
|
4cceb22f21 | ||
|
|
fd67fd220c | ||
|
|
061c1dff4e | ||
|
|
1a05ef97d6 | ||
|
|
2bc8c7bf39 | ||
|
|
7595e54dfb | ||
|
|
6c9fce5da4 | ||
|
|
b296323716 | ||
|
|
d325fdde6c | ||
|
|
36f2a62f3f | ||
|
|
e83d3a6b9f | ||
|
|
6723adf3c1 | ||
|
|
9efc08a832 | ||
|
|
f345c4d1d8 | ||
|
|
f147eaee1c | ||
|
|
fb0fa1fd21 | ||
|
|
6f3df271fd | ||
|
|
7f82ed381a | ||
|
|
3dd36a8a35 | ||
|
|
09cccd5487 | ||
|
|
1773530325 | ||
|
|
2da7a6755c | ||
|
|
1e81cd6850 | ||
|
|
ec73e2e9ce | ||
|
|
4937d72d70 | ||
|
|
219a065a7c | ||
|
|
8f06aec68b | ||
|
|
1de6f09069 | ||
|
|
b10b2461a5 | ||
|
|
34fc8f84f5 | ||
|
|
ee77dea2d6 | ||
|
|
bba407b507 | ||
|
|
ab63978ce8 | ||
|
|
e697e50d4e | ||
|
|
41ec229431 | ||
|
|
c0f5ba75f1 | ||
|
|
5a943bca32 | ||
|
|
923595f57e | ||
|
|
241d9fd12d | ||
|
|
97a8778449 | ||
|
|
833e700b58 | ||
|
|
2d49892aaa | ||
|
|
8ce5a1b7c0 | ||
|
|
88d2e7b97b | ||
|
|
c04eb01aed | ||
|
|
5d887fdca7 | ||
|
|
1a0fdb32fe | ||
|
|
9d45b8df1e | ||
|
|
ae3a7f0865 | ||
|
|
25f5e31378 | ||
|
|
7bdf0e94d7 | ||
|
|
8e43774b5e | ||
|
|
715f42c1a6 | ||
|
|
8200e9a88f | ||
|
|
c6f6c9e2a5 | ||
|
|
2d7ba91c0e | ||
|
|
872e034312 | ||
|
|
a63a7b0262 | ||
|
|
991a020917 | ||
|
|
f03f395225 | ||
|
|
174f6a48a6 | ||
|
|
c2f0a95802 |
@@ -1,69 +0,0 @@
|
||||
# Sim Development Environment Bashrc
|
||||
# This gets sourced by post-create.sh
|
||||
|
||||
# Enhanced prompt with git branch info
|
||||
parse_git_branch() {
|
||||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
||||
}
|
||||
|
||||
export PS1="\[\033[01;32m\]\u@simstudio\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]\$ "
|
||||
|
||||
# Helpful aliases
|
||||
alias ll="ls -la"
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
# Database aliases
|
||||
alias pgc="PGPASSWORD=postgres psql -h db -U postgres -d simstudio"
|
||||
alias check-db="PGPASSWORD=postgres psql -h db -U postgres -c '\l'"
|
||||
|
||||
# Sim specific aliases
|
||||
alias logs="cd /workspace/apps/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'"
|
||||
alias sim-start="cd /workspace && bun run dev"
|
||||
alias sim-migrate="cd /workspace/apps/sim && bunx drizzle-kit push"
|
||||
alias sim-generate="cd /workspace/apps/sim && bunx drizzle-kit generate"
|
||||
alias sim-rebuild="cd /workspace && bun run build && bun run start"
|
||||
alias docs-dev="cd /workspace/apps/docs && bun run dev"
|
||||
|
||||
# Turbo related commands
|
||||
alias turbo-build="cd /workspace && bunx turbo run build"
|
||||
alias turbo-dev="cd /workspace && bunx turbo run dev"
|
||||
alias turbo-test="cd /workspace && bunx turbo run test"
|
||||
|
||||
# Bun specific commands
|
||||
alias bun-update="cd /workspace && bun update"
|
||||
alias bun-add="cd /workspace && bun add"
|
||||
alias bun-pm="cd /workspace && bun pm"
|
||||
alias bun-canary="bun upgrade --canary"
|
||||
|
||||
# Default to workspace directory
|
||||
cd /workspace 2>/dev/null || true
|
||||
|
||||
# Welcome message - only show once per session
|
||||
if [ -z "$SIM_WELCOME_SHOWN" ]; then
|
||||
export SIM_WELCOME_SHOWN=1
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🚀 Welcome to Sim development environment!"
|
||||
echo ""
|
||||
echo "Available commands:"
|
||||
echo " sim-start - Start all apps in development mode"
|
||||
echo " sim-migrate - Push schema changes to the database for sim app"
|
||||
echo " sim-generate - Generate new migrations for sim app"
|
||||
echo " sim-rebuild - Build and start all apps"
|
||||
echo " docs-dev - Start only the docs app in development mode"
|
||||
echo ""
|
||||
echo "Turbo commands:"
|
||||
echo " turbo-build - Build all apps using Turborepo"
|
||||
echo " turbo-dev - Start development mode for all apps"
|
||||
echo " turbo-test - Run tests for all packages"
|
||||
echo ""
|
||||
echo "Bun commands:"
|
||||
echo " bun-update - Update dependencies"
|
||||
echo " bun-add - Add a new dependency"
|
||||
echo " bun-pm - Manage dependencies"
|
||||
echo " bun-canary - Upgrade to the latest canary version of Bun"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
fi
|
||||
@@ -1,38 +1,43 @@
|
||||
# Use the latest Bun canary image for development
|
||||
FROM oven/bun:canary
|
||||
|
||||
# Avoid warnings by switching to noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
FROM oven/bun:1.2.22-alpine
|
||||
|
||||
# Install necessary packages for development
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
git curl wget jq sudo postgresql-client vim nano \
|
||||
bash-completion ca-certificates lsb-release gnupg \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apk add --no-cache \
|
||||
git \
|
||||
curl \
|
||||
wget \
|
||||
jq \
|
||||
sudo \
|
||||
postgresql-client \
|
||||
vim \
|
||||
nano \
|
||||
bash \
|
||||
bash-completion \
|
||||
zsh \
|
||||
zsh-vcs \
|
||||
ca-certificates \
|
||||
shadow
|
||||
|
||||
# Create a non-root user
|
||||
# Create a non-root user with matching UID/GID
|
||||
ARG USERNAME=bun
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
|
||||
# Create user group if it doesn't exist
|
||||
RUN if ! getent group $USER_GID >/dev/null; then \
|
||||
addgroup -g $USER_GID $USERNAME; \
|
||||
fi
|
||||
|
||||
# Create user if it doesn't exist
|
||||
RUN if ! getent passwd $USER_UID >/dev/null; then \
|
||||
adduser -D -u $USER_UID -G $(getent group $USER_GID | cut -d: -f1) $USERNAME; \
|
||||
fi
|
||||
|
||||
# Add sudo support
|
||||
RUN echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME \
|
||||
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
||||
|
||||
# Install global packages for development
|
||||
RUN bun install -g turbo drizzle-kit typescript @types/node
|
||||
|
||||
# Install bun completions
|
||||
RUN bun completions > /etc/bash_completion.d/bun
|
||||
|
||||
# Set up shell environment
|
||||
RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile
|
||||
RUN echo "source /etc/profile" >> /etc/bash.bashrc
|
||||
|
||||
# Switch back to dialog for any ad-hoc use of apt-get
|
||||
ENV DEBIAN_FRONTEND=dialog
|
||||
RUN echo "export PATH=\$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
||||
@@ -1,78 +1,75 @@
|
||||
# Sim Development Container
|
||||
|
||||
This directory contains configuration files for Visual Studio Code Dev Containers / GitHub Codespaces. Dev containers provide a consistent, isolated development environment for this project.
|
||||
Development container configuration for VS Code Dev Containers and GitHub Codespaces.
|
||||
|
||||
## Contents
|
||||
|
||||
- `devcontainer.json` - The main configuration file that defines the development container settings
|
||||
- `Dockerfile` - Defines the container image and development environment
|
||||
- `docker-compose.yml` - Sets up the application and database containers
|
||||
- `post-create.sh` - Script that runs when the container is created
|
||||
- `.bashrc` - Custom shell configuration with helpful aliases
|
||||
|
||||
## Usage
|
||||
|
||||
### Prerequisites
|
||||
## Prerequisites
|
||||
|
||||
- Visual Studio Code
|
||||
- Docker installation:
|
||||
- Docker Desktop (Windows/macOS)
|
||||
- Docker Engine (Linux)
|
||||
- VS Code Remote - Containers extension
|
||||
- Docker Desktop or Podman Desktop
|
||||
- VS Code Dev Containers extension
|
||||
|
||||
### Getting Started
|
||||
## Getting Started
|
||||
|
||||
1. Open this project in Visual Studio Code
|
||||
2. When prompted, click "Reopen in Container"
|
||||
- Alternatively, press `F1` and select "Remote-Containers: Reopen in Container"
|
||||
1. Open this project in VS Code
|
||||
2. Click "Reopen in Container" when prompted (or press `F1` → "Dev Containers: Reopen in Container")
|
||||
3. Wait for the container to build and initialize
|
||||
4. The post-creation script will automatically:
|
||||
4. Start developing with `sim-start`
|
||||
|
||||
- Install dependencies
|
||||
- Set up environment variables
|
||||
- Run database migrations
|
||||
- Configure helpful aliases
|
||||
The setup script will automatically install dependencies and run migrations.
|
||||
|
||||
5. Start the application with `sim-start` (alias for `bun run dev`)
|
||||
## Development Commands
|
||||
|
||||
### Development Commands
|
||||
### Running Services
|
||||
|
||||
The development environment includes these helpful aliases:
|
||||
You have two options for running the development environment:
|
||||
|
||||
**Option 1: Run everything together (recommended for most development)**
|
||||
```bash
|
||||
sim-start # Runs both app and socket server using concurrently
|
||||
```
|
||||
|
||||
**Option 2: Run services separately (useful for debugging individual services)**
|
||||
- In the **app** container terminal: `sim-app` (starts Next.js app on port 3000)
|
||||
- In the **realtime** container terminal: `sim-sockets` (starts socket server on port 3002)
|
||||
|
||||
### Other Commands
|
||||
|
||||
- `sim-start` - Start the development server
|
||||
- `sim-migrate` - Push schema changes to the database
|
||||
- `sim-generate` - Generate new migrations
|
||||
- `sim-rebuild` - Build and start the production version
|
||||
- `pgc` - Connect to the PostgreSQL database
|
||||
- `check-db` - List all databases
|
||||
|
||||
### Using GitHub Codespaces
|
||||
|
||||
This project is also configured for GitHub Codespaces. To use it:
|
||||
|
||||
1. Go to the GitHub repository
|
||||
2. Click the "Code" button
|
||||
3. Select the "Codespaces" tab
|
||||
4. Click "Create codespace on main"
|
||||
|
||||
This will start a new Codespace with the development environment already set up.
|
||||
|
||||
## Customization
|
||||
|
||||
You can customize the development environment by:
|
||||
|
||||
- Modifying `devcontainer.json` to add VS Code extensions or settings
|
||||
- Updating the `Dockerfile` to install additional packages
|
||||
- Editing `docker-compose.yml` to add services or change configuration
|
||||
- Modifying `.bashrc` to add custom aliases or configurations
|
||||
- `build` - Build the application
|
||||
- `pgc` - Connect to PostgreSQL database
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter issues:
|
||||
**Build errors**: Rebuild the container with `F1` → "Dev Containers: Rebuild Container"
|
||||
|
||||
1. Rebuild the container: `F1` → "Remote-Containers: Rebuild Container"
|
||||
2. Check Docker logs for build errors
|
||||
3. Verify Docker Desktop is running
|
||||
4. Ensure all prerequisites are installed
|
||||
**Port conflicts**: Ensure ports 3000, 3002, and 5432 are available
|
||||
|
||||
For more information, see the [VS Code Remote Development documentation](https://code.visualstudio.com/docs/remote/containers).
|
||||
**Container runtime issues**: Verify Docker Desktop or Podman Desktop is running
|
||||
|
||||
## Technical Details
|
||||
|
||||
Services:
|
||||
- **App container** (8GB memory limit) - Main Next.js application
|
||||
- **Realtime container** (4GB memory limit) - Socket.io server for real-time features
|
||||
- **Database** - PostgreSQL with pgvector extension
|
||||
- **Migrations** - Runs automatically on container creation
|
||||
|
||||
You can develop with services running together or independently.
|
||||
|
||||
### Personalization
|
||||
|
||||
**Project commands** (`sim-start`, `sim-app`, etc.) are automatically available via `/workspace/.devcontainer/sim-commands.sh`.
|
||||
|
||||
**Personal shell customization** (aliases, prompts, etc.) should use VS Code's dotfiles feature:
|
||||
1. Create a dotfiles repository (e.g., `github.com/youruser/dotfiles`)
|
||||
2. Add your `.bashrc`, `.zshrc`, or other configs
|
||||
3. Configure in VS Code Settings:
|
||||
```json
|
||||
{
|
||||
"dotfiles.repository": "youruser/dotfiles",
|
||||
"dotfiles.installCommand": "install.sh"
|
||||
}
|
||||
```
|
||||
|
||||
This separates project-specific commands from personal preferences, following VS Code best practices.
|
||||
|
||||
@@ -13,13 +13,6 @@
|
||||
"source.fixAll.biome": "explicit",
|
||||
"source.organizeImports.biome": "explicit"
|
||||
},
|
||||
"terminal.integrated.defaultProfile.linux": "bash",
|
||||
"terminal.integrated.profiles.linux": {
|
||||
"bash": {
|
||||
"path": "/bin/bash",
|
||||
"args": ["--login"]
|
||||
}
|
||||
},
|
||||
"terminal.integrated.shellIntegration.enabled": true
|
||||
},
|
||||
"extensions": [
|
||||
@@ -36,18 +29,9 @@
|
||||
}
|
||||
},
|
||||
|
||||
"forwardPorts": [3000, 5432],
|
||||
"forwardPorts": [3000, 3002, 5432],
|
||||
|
||||
"postCreateCommand": "bash -c 'bash .devcontainer/post-create.sh || true'",
|
||||
|
||||
"postStartCommand": "bash -c 'if [ ! -f ~/.bashrc ] || ! grep -q \"sim-start\" ~/.bashrc; then cp .devcontainer/.bashrc ~/.bashrc; fi'",
|
||||
|
||||
"remoteUser": "bun",
|
||||
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/prulloac/devcontainer-features/bun:1": {
|
||||
"version": "latest"
|
||||
}
|
||||
}
|
||||
"remoteUser": "bun"
|
||||
}
|
||||
|
||||
@@ -7,52 +7,56 @@ services:
|
||||
- ..:/workspace:cached
|
||||
- bun-cache:/home/bun/.bun/cache:delegated
|
||||
command: sleep infinity
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 8G
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio
|
||||
- BETTER_AUTH_URL=http://localhost:3000
|
||||
- NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your_auth_secret_here}
|
||||
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-your_encryption_key_here}
|
||||
- COPILOT_API_KEY=${COPILOT_API_KEY}
|
||||
- SIM_AGENT_API_URL=${SIM_AGENT_API_URL}
|
||||
- OLLAMA_URL=${OLLAMA_URL:-http://localhost:11434}
|
||||
- NEXT_PUBLIC_SOCKET_URL=${NEXT_PUBLIC_SOCKET_URL:-http://localhost:3002}
|
||||
- BUN_INSTALL_CACHE_DIR=/home/bun/.bun/cache
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
realtime:
|
||||
condition: service_healthy
|
||||
migrations:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
working_dir: /workspace
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
|
||||
interval: 90s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
realtime:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
- bun-cache:/home/bun/.bun/cache:delegated
|
||||
command: sleep infinity
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 4G
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio
|
||||
- BETTER_AUTH_URL=http://localhost:3000
|
||||
- NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your_auth_secret_here}
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "3002:3002"
|
||||
working_dir: /workspace
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3002']
|
||||
interval: 90s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
migrations:
|
||||
build:
|
||||
|
||||
@@ -8,11 +8,43 @@ echo "🔧 Setting up Sim development environment..."
|
||||
# Change to the workspace root directory
|
||||
cd /workspace
|
||||
|
||||
# Setup .bashrc
|
||||
echo "📄 Setting up .bashrc with aliases..."
|
||||
cp /workspace/.devcontainer/.bashrc ~/.bashrc
|
||||
# Add to .profile to ensure .bashrc is sourced in non-interactive shells
|
||||
echo 'if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' >> ~/.profile
|
||||
# Install global packages for development (done at runtime, not build time)
|
||||
echo "📦 Installing global development tools..."
|
||||
bun install -g turbo drizzle-kit typescript @types/node 2>/dev/null || {
|
||||
echo "⚠️ Some global packages may already be installed, continuing..."
|
||||
}
|
||||
|
||||
# Set up bun completions (with proper shell detection)
|
||||
echo "🔧 Setting up shell completions..."
|
||||
if [ -n "$SHELL" ] && [ -f "$SHELL" ]; then
|
||||
SHELL=/bin/bash bun completions 2>/dev/null | sudo tee /etc/bash_completion.d/bun > /dev/null || {
|
||||
echo "⚠️ Could not install bun completions, but continuing..."
|
||||
}
|
||||
fi
|
||||
|
||||
# Add project commands to shell profile
|
||||
echo "📄 Setting up project commands..."
|
||||
# Add sourcing of sim-commands.sh to user's shell config files if they exist
|
||||
for rcfile in ~/.bashrc ~/.zshrc; do
|
||||
if [ -f "$rcfile" ]; then
|
||||
# Check if already added
|
||||
if ! grep -q "sim-commands.sh" "$rcfile"; then
|
||||
echo "" >> "$rcfile"
|
||||
echo "# Sim project commands" >> "$rcfile"
|
||||
echo "if [ -f /workspace/.devcontainer/sim-commands.sh ]; then" >> "$rcfile"
|
||||
echo " source /workspace/.devcontainer/sim-commands.sh" >> "$rcfile"
|
||||
echo "fi" >> "$rcfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# If no rc files exist yet, create a minimal one
|
||||
if [ ! -f ~/.bashrc ] && [ ! -f ~/.zshrc ]; then
|
||||
echo "# Source Sim project commands" > ~/.bashrc
|
||||
echo "if [ -f /workspace/.devcontainer/sim-commands.sh ]; then" >> ~/.bashrc
|
||||
echo " source /workspace/.devcontainer/sim-commands.sh" >> ~/.bashrc
|
||||
echo "fi" >> ~/.bashrc
|
||||
fi
|
||||
|
||||
# Clean and reinstall dependencies to ensure platform compatibility
|
||||
echo "📦 Cleaning and reinstalling dependencies..."
|
||||
@@ -29,18 +61,12 @@ chmod 700 ~/.bun ~/.bun/cache
|
||||
|
||||
# Install dependencies with platform-specific binaries
|
||||
echo "Installing dependencies with Bun..."
|
||||
bun install || {
|
||||
echo "⚠️ bun install had issues but continuing setup..."
|
||||
}
|
||||
bun install
|
||||
|
||||
# Check for native dependencies
|
||||
echo "Checking for native dependencies compatibility..."
|
||||
NATIVE_DEPS=$(grep '"trustedDependencies"' apps/sim/package.json || echo "")
|
||||
if [ ! -z "$NATIVE_DEPS" ]; then
|
||||
echo "⚠️ Native dependencies detected. Ensuring compatibility with Bun..."
|
||||
for pkg in $(echo $NATIVE_DEPS | grep -oP '"[^"]*"' | tr -d '"' | grep -v "trustedDependencies"); do
|
||||
echo "Checking compatibility for $pkg..."
|
||||
done
|
||||
if grep -q '"trustedDependencies"' apps/sim/package.json 2>/dev/null; then
|
||||
echo "⚠️ Native dependencies detected. Bun will handle compatibility during install."
|
||||
fi
|
||||
|
||||
# Set up environment variables if .env doesn't exist for the sim app
|
||||
@@ -82,23 +108,6 @@ echo "Waiting for database to be ready..."
|
||||
fi
|
||||
) || echo "⚠️ Database setup had issues but continuing..."
|
||||
|
||||
# Add additional helpful aliases to .bashrc
|
||||
cat << EOF >> ~/.bashrc
|
||||
|
||||
# Additional Sim Development Aliases
|
||||
alias migrate="cd /workspace/apps/sim && DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio bunx drizzle-kit push"
|
||||
alias generate="cd /workspace/apps/sim && bunx drizzle-kit generate"
|
||||
alias dev="cd /workspace && bun run dev"
|
||||
alias build="cd /workspace && bun run build"
|
||||
alias start="cd /workspace && bun run dev"
|
||||
alias lint="cd /workspace/apps/sim && bun run lint"
|
||||
alias test="cd /workspace && bun run test"
|
||||
alias bun-update="cd /workspace && bun update"
|
||||
EOF
|
||||
|
||||
# Source the .bashrc to make aliases available immediately
|
||||
. ~/.bashrc
|
||||
|
||||
# Clear the welcome message flag to ensure it shows after setup
|
||||
unset SIM_WELCOME_SHOWN
|
||||
|
||||
|
||||
42
.devcontainer/sim-commands.sh
Executable file
42
.devcontainer/sim-commands.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Sim Project Commands
|
||||
# Source this file to add project-specific commands to your shell
|
||||
# Add to your ~/.bashrc or ~/.zshrc: source /workspace/.devcontainer/sim-commands.sh
|
||||
|
||||
# Project-specific aliases for Sim development
|
||||
alias sim-start="cd /workspace && bun run dev:full"
|
||||
alias sim-app="cd /workspace && bun run dev"
|
||||
alias sim-sockets="cd /workspace && bun run dev:sockets"
|
||||
alias sim-migrate="cd /workspace/apps/sim && bunx drizzle-kit push"
|
||||
alias sim-generate="cd /workspace/apps/sim && bunx drizzle-kit generate"
|
||||
alias sim-rebuild="cd /workspace && bun run build && bun run start"
|
||||
alias docs-dev="cd /workspace/apps/docs && bun run dev"
|
||||
|
||||
# Database connection helpers
|
||||
alias pgc="PGPASSWORD=postgres psql -h db -U postgres -d simstudio"
|
||||
alias check-db="PGPASSWORD=postgres psql -h db -U postgres -c '\l'"
|
||||
|
||||
# Default to workspace directory
|
||||
cd /workspace 2>/dev/null || true
|
||||
|
||||
# Welcome message - show once per session
|
||||
if [ -z "$SIM_WELCOME_SHOWN" ]; then
|
||||
export SIM_WELCOME_SHOWN=1
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🚀 Sim Development Environment"
|
||||
echo ""
|
||||
echo "Project commands:"
|
||||
echo " sim-start - Start app + socket server"
|
||||
echo " sim-app - Start only main app"
|
||||
echo " sim-sockets - Start only socket server"
|
||||
echo " sim-migrate - Push schema changes"
|
||||
echo " sim-generate - Generate migrations"
|
||||
echo ""
|
||||
echo "Database:"
|
||||
echo " pgc - Connect to PostgreSQL"
|
||||
echo " check-db - List databases"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
fi
|
||||
2
.github/workflows/docs-embeddings.yml
vendored
2
.github/workflows/docs-embeddings.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
17
.github/workflows/i18n.yml
vendored
17
.github/workflows/i18n.yml
vendored
@@ -1,12 +1,13 @@
|
||||
name: 'Auto-translate Documentation'
|
||||
|
||||
# Temporarily disabled
|
||||
on:
|
||||
push:
|
||||
branches: [ staging ]
|
||||
paths:
|
||||
- 'apps/docs/content/docs/en/**'
|
||||
- 'apps/docs/i18n.json'
|
||||
workflow_dispatch: # Allow manual triggers
|
||||
workflow_dispatch: # Allow manual triggers only
|
||||
# push:
|
||||
# branches: [ staging ]
|
||||
# paths:
|
||||
# - 'apps/docs/content/docs/en/**'
|
||||
# - 'apps/docs/i18n.json'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -27,7 +28,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Run Lingo.dev translations
|
||||
env:
|
||||
@@ -116,7 +117,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
2
.github/workflows/migrations.yml
vendored
2
.github/workflows/migrations.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
2
.github/workflows/publish-cli.yml
vendored
2
.github/workflows/publish-cli.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Setup Node.js for npm publishing
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
2
.github/workflows/publish-python-sdk.yml
vendored
2
.github/workflows/publish-python-sdk.yml
vendored
@@ -84,6 +84,6 @@ jobs:
|
||||
```
|
||||
|
||||
### Documentation
|
||||
See the [README](https://github.com/simstudio/sim/tree/main/packages/python-sdk) for usage instructions.
|
||||
See the [README](https://github.com/simstudioai/sim/tree/main/packages/python-sdk) or the [docs](https://docs.sim.ai/sdks/python) for more information.
|
||||
draft: false
|
||||
prerelease: false
|
||||
7
.github/workflows/publish-ts-sdk.yml
vendored
7
.github/workflows/publish-ts-sdk.yml
vendored
@@ -16,16 +16,15 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Setup Node.js for npm publishing
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: '22'
|
||||
registry-url: 'https://registry.npmjs.org/'
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: packages/ts-sdk
|
||||
run: bun install
|
||||
|
||||
- name: Run tests
|
||||
@@ -80,6 +79,6 @@ jobs:
|
||||
```
|
||||
|
||||
### Documentation
|
||||
See the [README](https://github.com/simstudio/sim/tree/main/packages/ts-sdk) for usage instructions.
|
||||
See the [README](https://github.com/simstudioai/sim/tree/main/packages/ts-sdk) or the [docs](https://docs.sim.ai/sdks/typescript) for more information.
|
||||
draft: false
|
||||
prerelease: false
|
||||
2
.github/workflows/test-build.yml
vendored
2
.github/workflows/test-build.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
2
.github/workflows/trigger-deploy.yml
vendored
2
.github/workflows/trigger-deploy.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
bun-version: 1.2.22
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { getVideoUrl } from '@/lib/utils'
|
||||
import { getAssetUrl } from '@/lib/utils'
|
||||
|
||||
interface LightboxProps {
|
||||
isOpen: boolean
|
||||
@@ -60,7 +60,7 @@ export function Lightbox({ isOpen, onClose, src, alt, type }: LightboxProps) {
|
||||
/>
|
||||
) : (
|
||||
<video
|
||||
src={getVideoUrl(src)}
|
||||
src={getAssetUrl(src)}
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { getVideoUrl } from '@/lib/utils'
|
||||
import { getAssetUrl } from '@/lib/utils'
|
||||
import { Lightbox } from './lightbox'
|
||||
|
||||
interface VideoProps {
|
||||
@@ -39,7 +39,7 @@ export function Video({
|
||||
muted={muted}
|
||||
playsInline={playsInline}
|
||||
className={`${className} ${enableLightbox ? 'cursor-pointer transition-opacity hover:opacity-90' : ''}`}
|
||||
src={getVideoUrl(src)}
|
||||
src={getAssetUrl(src)}
|
||||
onClick={handleVideoClick}
|
||||
/>
|
||||
|
||||
|
||||
251
apps/docs/content/docs/de/blocks/guardrails.mdx
Normal file
251
apps/docs/content/docs/de/blocks/guardrails.mdx
Normal file
@@ -0,0 +1,251 @@
|
||||
---
|
||||
title: Guardrails
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/guardrails.png"
|
||||
alt="Guardrails Block"
|
||||
width={500}
|
||||
height={350}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
The Guardrails block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Validate JSON Structure</strong>: Ensure LLM outputs are valid JSON before parsing
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Match Regex Patterns</strong>: Verify content matches specific formats (emails, phone numbers, URLs, etc.)
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Detect Hallucinations</strong>: Use RAG + LLM scoring to validate AI outputs against knowledge base content
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Detect PII</strong>: Identify and optionally mask personally identifiable information across 40+ entity types
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Validation Types
|
||||
|
||||
### JSON Validation
|
||||
|
||||
Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed.
|
||||
|
||||
**Use Cases:**
|
||||
- Validate JSON responses from Agent blocks before parsing
|
||||
- Ensure API payloads are properly formatted
|
||||
- Check structured data integrity
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if valid JSON, `false` otherwise
|
||||
- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...")
|
||||
|
||||
### Regex Validation
|
||||
|
||||
Checks if content matches a specified regular expression pattern.
|
||||
|
||||
**Use Cases:**
|
||||
- Validate email addresses
|
||||
- Check phone number formats
|
||||
- Verify URLs or custom identifiers
|
||||
- Enforce specific text patterns
|
||||
|
||||
**Configuration:**
|
||||
- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if content matches pattern, `false` otherwise
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
### Hallucination Detection
|
||||
|
||||
Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base.
|
||||
|
||||
**How It Works:**
|
||||
1. Queries your knowledge base for relevant context
|
||||
2. Sends both the AI output and retrieved context to an LLM
|
||||
3. LLM assigns a confidence score (0-10 scale)
|
||||
- **0** = Full hallucination (completely ungrounded)
|
||||
- **10** = Fully grounded (completely supported by knowledge base)
|
||||
4. Validation passes if score ≥ threshold (default: 3)
|
||||
|
||||
**Configuration:**
|
||||
- **Knowledge Base**: Select from your existing knowledge bases
|
||||
- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended)
|
||||
- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models)
|
||||
- **Confidence Threshold**: Minimum score to pass (0-10, default: 3)
|
||||
- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if confidence score ≥ threshold
|
||||
- `score`: Confidence score (0-10)
|
||||
- `reasoning`: LLM's explanation for the score
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
**Use Cases:**
|
||||
- Validate Agent responses against documentation
|
||||
- Ensure customer support answers are factually accurate
|
||||
- Verify generated content matches source material
|
||||
- Quality control for RAG applications
|
||||
|
||||
### PII Detection
|
||||
|
||||
Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages.
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<Video src="guardrails.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
**How It Works:**
|
||||
1. Scans content for PII entities using pattern matching and NLP
|
||||
2. Returns detected entities with locations and confidence scores
|
||||
3. Optionally masks detected PII in the output
|
||||
|
||||
**Configuration:**
|
||||
- **PII Types to Detect**: Select from grouped categories via modal selector
|
||||
- **Common**: Person name, Email, Phone, Credit card, IP address, etc.
|
||||
- **USA**: SSN, Driver's license, Passport, etc.
|
||||
- **UK**: NHS number, National insurance number
|
||||
- **Spain**: NIF, NIE, CIF
|
||||
- **Italy**: Fiscal code, Driver's license, VAT code
|
||||
- **Poland**: PESEL, NIP, REGON
|
||||
- **Singapore**: NRIC/FIN, UEN
|
||||
- **Australia**: ABN, ACN, TFN, Medicare
|
||||
- **India**: Aadhaar, PAN, Passport, Voter number
|
||||
- **Mode**:
|
||||
- **Detect**: Only identify PII (default)
|
||||
- **Mask**: Replace detected PII with masked values
|
||||
- **Language**: Detection language (default: English)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `false` if any selected PII types are detected
|
||||
- `detectedEntities`: Array of detected PII with type, location, and confidence
|
||||
- `maskedText`: Content with PII masked (only if mode = "Mask")
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
**Use Cases:**
|
||||
- Block content containing sensitive personal information
|
||||
- Mask PII before logging or storing data
|
||||
- Compliance with GDPR, HIPAA, and other privacy regulations
|
||||
- Sanitize user inputs before processing
|
||||
|
||||
## Configuration
|
||||
|
||||
### Content to Validate
|
||||
|
||||
The input content to validate. This typically comes from:
|
||||
- Agent block outputs: `<agent.content>`
|
||||
- Function block results: `<function.output>`
|
||||
- API responses: `<api.output>`
|
||||
- Any other block output
|
||||
|
||||
### Validation Type
|
||||
|
||||
Choose from four validation types:
|
||||
- **Valid JSON**: Check if content is properly formatted JSON
|
||||
- **Regex Match**: Verify content matches a regex pattern
|
||||
- **Hallucination Check**: Validate against knowledge base with LLM scoring
|
||||
- **PII Detection**: Detect and optionally mask personally identifiable information
|
||||
|
||||
## Outputs
|
||||
|
||||
All validation types return:
|
||||
|
||||
- **`<guardrails.passed>`**: Boolean indicating if validation passed
|
||||
- **`<guardrails.validationType>`**: The type of validation performed
|
||||
- **`<guardrails.input>`**: The original input that was validated
|
||||
- **`<guardrails.error>`**: Error message if validation failed (optional)
|
||||
|
||||
Additional outputs by type:
|
||||
|
||||
**Hallucination Check:**
|
||||
- **`<guardrails.score>`**: Confidence score (0-10)
|
||||
- **`<guardrails.reasoning>`**: LLM's explanation
|
||||
|
||||
**PII Detection:**
|
||||
- **`<guardrails.detectedEntities>`**: Array of detected PII entities
|
||||
- **`<guardrails.maskedText>`**: Content with PII masked (if mode = "Mask")
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### Validate JSON Before Parsing
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Ensure Agent output is valid JSON</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent generates structured JSON response</li>
|
||||
<li>Guardrails validates JSON format</li>
|
||||
<li>Condition block checks `<guardrails.passed>`</li>
|
||||
<li>If passed → Parse and use data, If failed → Retry or handle error</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Prevent Hallucinations
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Validate customer support responses</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent generates response to customer question</li>
|
||||
<li>Guardrails checks against support documentation knowledge base</li>
|
||||
<li>If confidence score ≥ 3 → Send response</li>
|
||||
<li>If confidence score \< 3 → Flag for human review</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Block PII in User Inputs
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Sanitize user-submitted content</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>User submits form with text content</li>
|
||||
<li>Guardrails detects PII (emails, phone numbers, SSN, etc.)</li>
|
||||
<li>If PII detected → Reject submission or mask sensitive data</li>
|
||||
<li>If no PII → Process normally</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<Video src="guardrails-example.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
### Validate Email Format
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Check email address format</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent extracts email from text</li>
|
||||
<li>Guardrails validates with regex pattern</li>
|
||||
<li>If valid → Use email for notification</li>
|
||||
<li>If invalid → Request correction</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Chain with Condition blocks**: Use `<guardrails.passed>` to branch workflow logic based on validation results
|
||||
- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs
|
||||
- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance
|
||||
- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter)
|
||||
- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring
|
||||
- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII
|
||||
- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production
|
||||
- **Monitor validation failures**: Track `<guardrails.error>` messages to identify common validation issues
|
||||
|
||||
<Callout type="info">
|
||||
Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical.
|
||||
</Callout>
|
||||
|
||||
@@ -183,4 +183,39 @@ Verschiedene Abonnementpläne haben unterschiedliche Nutzungslimits:
|
||||
- Überprüfen Sie Ihre aktuelle Nutzung unter [Einstellungen → Abonnement](https://sim.ai/settings/subscription)
|
||||
- Erfahren Sie mehr über [Logging](/execution/logging), um Ausführungsdetails zu verfolgen
|
||||
- Erkunden Sie die [Externe API](/execution/api) für programmatische Kostenüberwachung
|
||||
- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) an, um Kosten zu reduzieren
|
||||
- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) an, um Kosten zu reduzieren
|
||||
|
||||
**Team-Plan (40 $/Sitz/Monat):**
|
||||
- Gemeinsame Nutzung für alle Teammitglieder
|
||||
- Überschreitung wird anhand der Gesamtnutzung des Teams berechnet
|
||||
- Organisationsinhaber erhält eine Rechnung
|
||||
|
||||
**Enterprise-Pläne:**
|
||||
- Fester monatlicher Preis, keine Überschreitungen
|
||||
- Benutzerdefinierte Nutzungslimits gemäß Vereinbarung
|
||||
|
||||
### Schwellenwertabrechnung
|
||||
|
||||
Wenn die nicht abgerechnete Überschreitung 50 $ erreicht, berechnet Sim automatisch den gesamten nicht abgerechneten Betrag.
|
||||
|
||||
**Beispiel:**
|
||||
- Tag 10: 70 $ Überschreitung → Sofortige Abrechnung von 70 $
|
||||
- Tag 15: Zusätzliche Nutzung von 35 $ (insgesamt 105 $) → Bereits abgerechnet, keine Aktion
|
||||
- Tag 20: Weitere Nutzung von 50 $ (insgesamt 155 $, 85 $ nicht abgerechnet) → Sofortige Abrechnung von 85 $
|
||||
|
||||
Dies verteilt hohe Überschreitungsgebühren über den Monat, anstatt eine große Rechnung am Ende des Abrechnungszeitraums zu stellen.
|
||||
|
||||
## Best Practices für Kostenmanagement
|
||||
|
||||
1. **Regelmäßige Überwachung**: Überprüfen Sie Ihr Nutzungs-Dashboard häufig, um Überraschungen zu vermeiden
|
||||
2. **Budgets festlegen**: Nutzen Sie Planlimits als Leitplanken für Ihre Ausgaben
|
||||
3. **Workflows optimieren**: Überprüfen Sie kostenintensive Ausführungen und optimieren Sie Prompts oder Modellauswahl
|
||||
4. **Geeignete Modelle verwenden**: Passen Sie die Modellkomplexität an die Aufgabenanforderungen an
|
||||
5. **Ähnliche Aufgaben bündeln**: Kombinieren Sie wenn möglich mehrere Anfragen, um den Overhead zu reduzieren
|
||||
|
||||
## Nächste Schritte
|
||||
|
||||
- Überprüfen Sie Ihre aktuelle Nutzung unter [Einstellungen → Abonnement](https://sim.ai/settings/subscription)
|
||||
- Erfahren Sie mehr über [Protokollierung](/execution/logging), um Ausführungsdetails zu verfolgen
|
||||
- Erkunden Sie die [externe API](/execution/api) für programmatische Kostenüberwachung
|
||||
- Sehen Sie sich [Workflow-Optimierungstechniken](/blocks) zur Kostenreduzierung an
|
||||
@@ -10,7 +10,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
Das offizielle Python SDK für Sim ermöglicht es Ihnen, Workflows programmatisch aus Ihren Python-Anwendungen mithilfe des offiziellen Python SDKs auszuführen.
|
||||
|
||||
<Callout type="info">
|
||||
Das Python SDK unterstützt Python 3.8+ und bietet synchrone Workflow-Ausführung. Alle Workflow-Ausführungen sind derzeit synchron.
|
||||
Das Python SDK unterstützt Python 3.8+ mit asynchroner Ausführungsunterstützung, automatischer Ratenbegrenzung mit exponentiellem Backoff und Nutzungsverfolgung.
|
||||
</Callout>
|
||||
|
||||
## Installation
|
||||
@@ -74,12 +74,17 @@ result = client.execute_workflow(
|
||||
- `workflow_id` (str): Die ID des auszuführenden Workflows
|
||||
- `input_data` (dict, optional): Eingabedaten, die an den Workflow übergeben werden
|
||||
- `timeout` (float, optional): Timeout in Sekunden (Standard: 30.0)
|
||||
- `stream` (bool, optional): Streaming-Antworten aktivieren (Standard: False)
|
||||
- `selected_outputs` (list[str], optional): Block-Ausgaben, die im `blockName.attribute`Format gestreamt werden sollen (z.B. `["agent1.content"]`)
|
||||
- `async_execution` (bool, optional): Asynchron ausführen (Standard: False)
|
||||
|
||||
**Rückgabewert:** `WorkflowExecutionResult`
|
||||
**Rückgabe:** `WorkflowExecutionResult | AsyncExecutionResult`
|
||||
|
||||
Wenn `async_execution=True`, wird sofort mit einer Task-ID zum Abfragen zurückgegeben. Andernfalls wird auf den Abschluss gewartet.
|
||||
|
||||
##### get_workflow_status()
|
||||
|
||||
Ruft den Status eines Workflows ab (Deployment-Status usw.).
|
||||
Den Status eines Workflows abrufen (Bereitstellungsstatus usw.).
|
||||
|
||||
```python
|
||||
status = client.get_workflow_status("workflow-id")
|
||||
@@ -93,7 +98,7 @@ print("Is deployed:", status.is_deployed)
|
||||
|
||||
##### validate_workflow()
|
||||
|
||||
Überprüft, ob ein Workflow für die Ausführung bereit ist.
|
||||
Überprüfen, ob ein Workflow für die Ausführung bereit ist.
|
||||
|
||||
```python
|
||||
is_ready = client.validate_workflow("workflow-id")
|
||||
@@ -107,28 +112,118 @@ if is_ready:
|
||||
|
||||
**Rückgabe:** `bool`
|
||||
|
||||
##### execute_workflow_sync()
|
||||
##### get_job_status()
|
||||
|
||||
<Callout type="info">
|
||||
Derzeit ist diese Methode identisch mit `execute_workflow()`, da alle Ausführungen synchron sind. Diese Methode wird für zukünftige Kompatibilität bereitgestellt, wenn asynchrone Ausführung hinzugefügt wird.
|
||||
</Callout>
|
||||
|
||||
Führt einen Workflow aus (derzeit synchron, identisch mit `execute_workflow()`).
|
||||
Den Status einer asynchronen Job-Ausführung abrufen.
|
||||
|
||||
```python
|
||||
result = client.execute_workflow_sync(
|
||||
status = client.get_job_status("task-id-from-async-execution")
|
||||
print("Status:", status["status"]) # 'queued', 'processing', 'completed', 'failed'
|
||||
if status["status"] == "completed":
|
||||
print("Output:", status["output"])
|
||||
```
|
||||
|
||||
**Parameter:**
|
||||
- `task_id` (str): Die Task-ID, die von der asynchronen Ausführung zurückgegeben wurde
|
||||
|
||||
**Rückgabe:** `Dict[str, Any]`
|
||||
|
||||
**Antwortfelder:**
|
||||
- `success` (bool): Ob die Anfrage erfolgreich war
|
||||
- `taskId` (str): Die Task-ID
|
||||
- `status` (str): Einer der Werte `'queued'`, `'processing'`, `'completed'`, `'failed'`, `'cancelled'`
|
||||
- `metadata` (dict): Enthält `startedAt`, `completedAt` und `duration`
|
||||
- `output` (any, optional): Die Workflow-Ausgabe (wenn abgeschlossen)
|
||||
- `error` (any, optional): Fehlerdetails (wenn fehlgeschlagen)
|
||||
- `estimatedDuration` (int, optional): Geschätzte Dauer in Millisekunden (wenn in Bearbeitung/in Warteschlange)
|
||||
|
||||
##### execute_with_retry()
|
||||
|
||||
Einen Workflow mit automatischer Wiederholung bei Ratenbegrenzungsfehlern unter Verwendung von exponentiellem Backoff ausführen.
|
||||
|
||||
```python
|
||||
result = client.execute_with_retry(
|
||||
"workflow-id",
|
||||
input_data={"data": "some input"},
|
||||
timeout=60.0
|
||||
input_data={"message": "Hello"},
|
||||
timeout=30.0,
|
||||
max_retries=3, # Maximum number of retries
|
||||
initial_delay=1.0, # Initial delay in seconds
|
||||
max_delay=30.0, # Maximum delay in seconds
|
||||
backoff_multiplier=2.0 # Exponential backoff multiplier
|
||||
)
|
||||
```
|
||||
|
||||
**Parameter:**
|
||||
- `workflow_id` (str): Die ID des auszuführenden Workflows
|
||||
- `input_data` (dict, optional): Eingabedaten, die an den Workflow übergeben werden
|
||||
- `timeout` (float): Timeout für die initiale Anfrage in Sekunden
|
||||
- `timeout` (float, optional): Timeout in Sekunden
|
||||
- `stream` (bool, optional): Streaming-Antworten aktivieren
|
||||
- `selected_outputs` (list, optional): Block-Ausgaben zum Streamen
|
||||
- `async_execution` (bool, optional): Asynchron ausführen
|
||||
- `max_retries` (int, optional): Maximale Anzahl von Wiederholungen (Standard: 3)
|
||||
- `initial_delay` (float, optional): Anfängliche Verzögerung in Sekunden (Standard: 1.0)
|
||||
- `max_delay` (float, optional): Maximale Verzögerung in Sekunden (Standard: 30.0)
|
||||
- `backoff_multiplier` (float, optional): Backoff-Multiplikator (Standard: 2.0)
|
||||
|
||||
**Rückgabe:** `WorkflowExecutionResult`
|
||||
**Rückgabewert:** `WorkflowExecutionResult | AsyncExecutionResult`
|
||||
|
||||
Die Wiederholungslogik verwendet exponentielles Backoff (1s → 2s → 4s → 8s...) mit ±25% Jitter, um den Thundering-Herd-Effekt zu vermeiden. Wenn die API einen `retry-after` Header bereitstellt, wird dieser stattdessen verwendet.
|
||||
|
||||
##### get_rate_limit_info()
|
||||
|
||||
Ruft die aktuellen Rate-Limit-Informationen aus der letzten API-Antwort ab.
|
||||
|
||||
```python
|
||||
rate_limit_info = client.get_rate_limit_info()
|
||||
if rate_limit_info:
|
||||
print("Limit:", rate_limit_info.limit)
|
||||
print("Remaining:", rate_limit_info.remaining)
|
||||
print("Reset:", datetime.fromtimestamp(rate_limit_info.reset))
|
||||
```
|
||||
|
||||
**Rückgabewert:** `RateLimitInfo | None`
|
||||
|
||||
##### get_usage_limits()
|
||||
|
||||
Ruft aktuelle Nutzungslimits und Kontingentinformationen für dein Konto ab.
|
||||
|
||||
```python
|
||||
limits = client.get_usage_limits()
|
||||
print("Sync requests remaining:", limits.rate_limit["sync"]["remaining"])
|
||||
print("Async requests remaining:", limits.rate_limit["async"]["remaining"])
|
||||
print("Current period cost:", limits.usage["currentPeriodCost"])
|
||||
print("Plan:", limits.usage["plan"])
|
||||
```
|
||||
|
||||
**Rückgabewert:** `UsageLimits`
|
||||
|
||||
**Antwortstruktur:**
|
||||
|
||||
```python
|
||||
{
|
||||
"success": bool,
|
||||
"rateLimit": {
|
||||
"sync": {
|
||||
"isLimited": bool,
|
||||
"limit": int,
|
||||
"remaining": int,
|
||||
"resetAt": str
|
||||
},
|
||||
"async": {
|
||||
"isLimited": bool,
|
||||
"limit": int,
|
||||
"remaining": int,
|
||||
"resetAt": str
|
||||
},
|
||||
"authType": str # 'api' or 'manual'
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": float,
|
||||
"limit": float,
|
||||
"plan": str # e.g., 'free', 'pro'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### set_api_key()
|
||||
|
||||
@@ -170,6 +265,18 @@ class WorkflowExecutionResult:
|
||||
total_duration: Optional[float] = None
|
||||
```
|
||||
|
||||
### AsyncExecutionResult
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class AsyncExecutionResult:
|
||||
success: bool
|
||||
task_id: str
|
||||
status: str # 'queued'
|
||||
created_at: str
|
||||
links: Dict[str, str] # e.g., {"status": "/api/jobs/{taskId}"}
|
||||
```
|
||||
|
||||
### WorkflowStatus
|
||||
|
||||
```python
|
||||
@@ -181,6 +288,27 @@ class WorkflowStatus:
|
||||
needs_redeployment: bool = False
|
||||
```
|
||||
|
||||
### RateLimitInfo
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class RateLimitInfo:
|
||||
limit: int
|
||||
remaining: int
|
||||
reset: int
|
||||
retry_after: Optional[int] = None
|
||||
```
|
||||
|
||||
### UsageLimits
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class UsageLimits:
|
||||
success: bool
|
||||
rate_limit: Dict[str, Any]
|
||||
usage: Dict[str, Any]
|
||||
```
|
||||
|
||||
### SimStudioError
|
||||
|
||||
```python
|
||||
@@ -191,6 +319,13 @@ class SimStudioError(Exception):
|
||||
self.status = status
|
||||
```
|
||||
|
||||
**Häufige Fehlercodes:**
|
||||
- `UNAUTHORIZED`: Ungültiger API-Schlüssel
|
||||
- `TIMEOUT`: Zeitüberschreitung bei der Anfrage
|
||||
- `RATE_LIMIT_EXCEEDED`: Ratengrenze überschritten
|
||||
- `USAGE_LIMIT_EXCEEDED`: Nutzungsgrenze überschritten
|
||||
- `EXECUTION_ERROR`: Workflow-Ausführung fehlgeschlagen
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Grundlegende Workflow-Ausführung
|
||||
@@ -214,7 +349,7 @@ class SimStudioError(Exception):
|
||||
import os
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def run_workflow():
|
||||
try:
|
||||
@@ -252,7 +387,7 @@ Behandeln Sie verschiedene Fehlertypen, die während der Workflow-Ausführung au
|
||||
from simstudio import SimStudioClient, SimStudioError
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_error_handling():
|
||||
try:
|
||||
@@ -279,16 +414,7 @@ def execute_with_error_handling():
|
||||
|
||||
Verwenden Sie den Client als Kontextmanager, um die Ressourcenbereinigung automatisch zu handhaben:
|
||||
|
||||
```python
|
||||
from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
# Using context manager to automatically close the session
|
||||
with SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY")) as client:
|
||||
result = client.execute_workflow("workflow-id")
|
||||
print("Result:", result)
|
||||
# Session is automatically closed here
|
||||
```
|
||||
---CODE-PLACEHOLDER-ef99d3dd509e04865d5b6b0e0e03d3f8---
|
||||
|
||||
### Batch-Workflow-Ausführung
|
||||
|
||||
@@ -298,7 +424,7 @@ Führen Sie mehrere Workflows effizient aus:
|
||||
from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_workflows_batch(workflow_data_pairs):
|
||||
"""Execute multiple workflows with different input data."""
|
||||
@@ -339,9 +465,233 @@ for result in results:
|
||||
print(f"Workflow {result['workflow_id']}: {'Success' if result['success'] else 'Failed'}")
|
||||
```
|
||||
|
||||
### Asynchrone Workflow-Ausführung
|
||||
|
||||
Führen Sie Workflows asynchron für lang laufende Aufgaben aus:
|
||||
|
||||
```python
|
||||
import os
|
||||
import time
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_async():
|
||||
try:
|
||||
# Start async execution
|
||||
result = client.execute_workflow(
|
||||
"workflow-id",
|
||||
input_data={"data": "large dataset"},
|
||||
async_execution=True # Execute asynchronously
|
||||
)
|
||||
|
||||
# Check if result is an async execution
|
||||
if hasattr(result, 'task_id'):
|
||||
print(f"Task ID: {result.task_id}")
|
||||
print(f"Status endpoint: {result.links['status']}")
|
||||
|
||||
# Poll for completion
|
||||
status = client.get_job_status(result.task_id)
|
||||
|
||||
while status["status"] in ["queued", "processing"]:
|
||||
print(f"Current status: {status['status']}")
|
||||
time.sleep(2) # Wait 2 seconds
|
||||
status = client.get_job_status(result.task_id)
|
||||
|
||||
if status["status"] == "completed":
|
||||
print("Workflow completed!")
|
||||
print(f"Output: {status['output']}")
|
||||
print(f"Duration: {status['metadata']['duration']}")
|
||||
else:
|
||||
print(f"Workflow failed: {status['error']}")
|
||||
|
||||
except Exception as error:
|
||||
print(f"Error: {error}")
|
||||
|
||||
execute_async()
|
||||
```
|
||||
|
||||
### Rate-Limiting und Wiederholungsversuche
|
||||
|
||||
Behandle Rate-Limits automatisch mit exponentiellem Backoff:
|
||||
|
||||
```python
|
||||
import os
|
||||
from simstudio import SimStudioClient, SimStudioError
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_retry_handling():
|
||||
try:
|
||||
# Automatically retries on rate limit
|
||||
result = client.execute_with_retry(
|
||||
"workflow-id",
|
||||
input_data={"message": "Process this"},
|
||||
max_retries=5,
|
||||
initial_delay=1.0,
|
||||
max_delay=60.0,
|
||||
backoff_multiplier=2.0
|
||||
)
|
||||
|
||||
print(f"Success: {result}")
|
||||
except SimStudioError as error:
|
||||
if error.code == "RATE_LIMIT_EXCEEDED":
|
||||
print("Rate limit exceeded after all retries")
|
||||
|
||||
# Check rate limit info
|
||||
rate_limit_info = client.get_rate_limit_info()
|
||||
if rate_limit_info:
|
||||
from datetime import datetime
|
||||
reset_time = datetime.fromtimestamp(rate_limit_info.reset)
|
||||
print(f"Rate limit resets at: {reset_time}")
|
||||
|
||||
execute_with_retry_handling()
|
||||
```
|
||||
|
||||
### Nutzungsüberwachung
|
||||
|
||||
Überwache deine Kontonutzung und -limits:
|
||||
|
||||
```python
|
||||
import os
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def check_usage():
|
||||
try:
|
||||
limits = client.get_usage_limits()
|
||||
|
||||
print("=== Rate Limits ===")
|
||||
print("Sync requests:")
|
||||
print(f" Limit: {limits.rate_limit['sync']['limit']}")
|
||||
print(f" Remaining: {limits.rate_limit['sync']['remaining']}")
|
||||
print(f" Resets at: {limits.rate_limit['sync']['resetAt']}")
|
||||
print(f" Is limited: {limits.rate_limit['sync']['isLimited']}")
|
||||
|
||||
print("\nAsync requests:")
|
||||
print(f" Limit: {limits.rate_limit['async']['limit']}")
|
||||
print(f" Remaining: {limits.rate_limit['async']['remaining']}")
|
||||
print(f" Resets at: {limits.rate_limit['async']['resetAt']}")
|
||||
print(f" Is limited: {limits.rate_limit['async']['isLimited']}")
|
||||
|
||||
print("\n=== Usage ===")
|
||||
print(f"Current period cost: ${limits.usage['currentPeriodCost']:.2f}")
|
||||
print(f"Limit: ${limits.usage['limit']:.2f}")
|
||||
print(f"Plan: {limits.usage['plan']}")
|
||||
|
||||
percent_used = (limits.usage['currentPeriodCost'] / limits.usage['limit']) * 100
|
||||
print(f"Usage: {percent_used:.1f}%")
|
||||
|
||||
if percent_used > 80:
|
||||
print("⚠️ Warning: You are approaching your usage limit!")
|
||||
|
||||
except Exception as error:
|
||||
print(f"Error checking usage: {error}")
|
||||
|
||||
check_usage()
|
||||
```
|
||||
|
||||
### Streaming-Workflow-Ausführung
|
||||
|
||||
Führe Workflows mit Echtzeit-Streaming-Antworten aus:
|
||||
|
||||
```python
|
||||
from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_streaming():
|
||||
"""Execute workflow with streaming enabled."""
|
||||
try:
|
||||
# Enable streaming for specific block outputs
|
||||
result = client.execute_workflow(
|
||||
"workflow-id",
|
||||
input_data={"message": "Count to five"},
|
||||
stream=True,
|
||||
selected_outputs=["agent1.content"] # Use blockName.attribute format
|
||||
)
|
||||
|
||||
print("Workflow result:", result)
|
||||
except Exception as error:
|
||||
print("Error:", error)
|
||||
|
||||
execute_with_streaming()
|
||||
```
|
||||
|
||||
Die Streaming-Antwort folgt dem Server-Sent Events (SSE) Format:
|
||||
|
||||
```
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", two"}
|
||||
|
||||
data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}}
|
||||
|
||||
data: [DONE]
|
||||
```
|
||||
|
||||
**Flask-Streaming-Beispiel:**
|
||||
|
||||
```python
|
||||
from flask import Flask, Response, stream_with_context
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/stream-workflow')
|
||||
def stream_workflow():
|
||||
"""Stream workflow execution to the client."""
|
||||
|
||||
def generate():
|
||||
response = requests.post(
|
||||
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
|
||||
headers={
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': os.getenv('SIM_API_KEY')
|
||||
},
|
||||
json={
|
||||
'message': 'Generate a story',
|
||||
'stream': True,
|
||||
'selectedOutputs': ['agent1.content']
|
||||
},
|
||||
stream=True
|
||||
)
|
||||
|
||||
for line in response.iter_lines():
|
||||
if line:
|
||||
decoded_line = line.decode('utf-8')
|
||||
if decoded_line.startswith('data: '):
|
||||
data = decoded_line[6:] # Remove 'data: ' prefix
|
||||
|
||||
if data == '[DONE]':
|
||||
break
|
||||
|
||||
try:
|
||||
parsed = json.loads(data)
|
||||
if 'chunk' in parsed:
|
||||
yield f"data: {json.dumps(parsed)}\n\n"
|
||||
elif parsed.get('event') == 'done':
|
||||
yield f"data: {json.dumps(parsed)}\n\n"
|
||||
print("Execution complete:", parsed.get('metadata'))
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
|
||||
return Response(
|
||||
stream_with_context(generate()),
|
||||
mimetype='text/event-stream'
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
```
|
||||
|
||||
### Umgebungskonfiguration
|
||||
|
||||
Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
Konfiguriere den Client mit Umgebungsvariablen:
|
||||
|
||||
<Tabs items={['Development', 'Production']}>
|
||||
<Tab value="Development">
|
||||
@@ -352,8 +702,8 @@ Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
|
||||
# Development configuration
|
||||
client = SimStudioClient(
|
||||
api_key=os.getenv("SIMSTUDIO_API_KEY"),
|
||||
base_url=os.getenv("SIMSTUDIO_BASE_URL", "https://sim.ai")
|
||||
api_key=os.getenv("SIM_API_KEY")
|
||||
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
|
||||
)
|
||||
```
|
||||
|
||||
@@ -365,13 +715,13 @@ Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
# Production configuration with error handling
|
||||
api_key = os.getenv("SIMSTUDIO_API_KEY")
|
||||
api_key = os.getenv("SIM_API_KEY")
|
||||
if not api_key:
|
||||
raise ValueError("SIMSTUDIO_API_KEY environment variable is required")
|
||||
raise ValueError("SIM_API_KEY environment variable is required")
|
||||
|
||||
client = SimStudioClient(
|
||||
api_key=api_key,
|
||||
base_url=os.getenv("SIMSTUDIO_BASE_URL", "https://sim.ai")
|
||||
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
|
||||
)
|
||||
```
|
||||
|
||||
@@ -382,19 +732,19 @@ Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
|
||||
<Steps>
|
||||
<Step title="Bei Sim anmelden">
|
||||
Navigieren Sie zu [Sim](https://sim.ai) und melden Sie sich bei Ihrem Konto an.
|
||||
Navigiere zu [Sim](https://sim.ai) und melde dich bei deinem Konto an.
|
||||
</Step>
|
||||
<Step title="Ihren Workflow öffnen">
|
||||
Navigieren Sie zu dem Workflow, den Sie programmatisch ausführen möchten.
|
||||
<Step title="Öffne deinen Workflow">
|
||||
Navigiere zu dem Workflow, den du programmatisch ausführen möchtest.
|
||||
</Step>
|
||||
<Step title="Ihren Workflow bereitstellen">
|
||||
Klicken Sie auf "Deploy", um Ihren Workflow bereitzustellen, falls dies noch nicht geschehen ist.
|
||||
<Step title="Deploye deinen Workflow">
|
||||
Klicke auf "Deploy", um deinen Workflow zu deployen, falls dies noch nicht geschehen ist.
|
||||
</Step>
|
||||
<Step title="API-Schlüssel erstellen oder auswählen">
|
||||
Wählen Sie während des Bereitstellungsprozesses einen API-Schlüssel aus oder erstellen Sie einen neuen.
|
||||
<Step title="Erstelle oder wähle einen API-Schlüssel">
|
||||
Wähle während des Deployment-Prozesses einen API-Schlüssel aus oder erstelle einen neuen.
|
||||
</Step>
|
||||
<Step title="API-Schlüssel kopieren">
|
||||
Kopieren Sie den API-Schlüssel zur Verwendung in Ihrer Python-Anwendung.
|
||||
<Step title="Kopiere den API-Schlüssel">
|
||||
Kopiere den API-Schlüssel zur Verwendung in deiner Python-Anwendung.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
|
||||
Das offizielle TypeScript/JavaScript SDK für Sim bietet vollständige Typsicherheit und unterstützt sowohl Node.js- als auch Browser-Umgebungen, sodass Sie Workflows programmatisch aus Ihren Node.js-Anwendungen, Webanwendungen und anderen JavaScript-Umgebungen ausführen können. Alle Workflow-Ausführungen sind derzeit synchron.
|
||||
Das offizielle TypeScript/JavaScript SDK für Sim bietet vollständige Typsicherheit und unterstützt sowohl Node.js- als auch Browser-Umgebungen, sodass Sie Workflows programmatisch aus Ihren Node.js-Anwendungen, Webanwendungen und anderen JavaScript-Umgebungen ausführen können.
|
||||
|
||||
<Callout type="info">
|
||||
Das TypeScript SDK bietet vollständige Typsicherheit und unterstützt sowohl Node.js- als auch Browser-Umgebungen. Alle Workflow-Ausführungen sind derzeit synchron.
|
||||
Das TypeScript SDK bietet vollständige Typsicherheit, Unterstützung für asynchrone Ausführung, automatische Ratenbegrenzung mit exponentiellem Backoff und Nutzungsverfolgung.
|
||||
</Callout>
|
||||
|
||||
## Installation
|
||||
@@ -95,8 +95,13 @@ const result = await client.executeWorkflow('workflow-id', {
|
||||
- `options` (ExecutionOptions, optional):
|
||||
- `input` (any): Eingabedaten, die an den Workflow übergeben werden
|
||||
- `timeout` (number): Timeout in Millisekunden (Standard: 30000)
|
||||
- `stream` (boolean): Streaming-Antworten aktivieren (Standard: false)
|
||||
- `selectedOutputs` (string[]): Block-Ausgaben, die im `blockName.attribute`Format gestreamt werden sollen (z.B. `["agent1.content"]`)
|
||||
- `async` (boolean): Asynchron ausführen (Standard: false)
|
||||
|
||||
**Rückgabewert:** `Promise<WorkflowExecutionResult>`
|
||||
**Rückgabe:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
|
||||
|
||||
Wenn `async: true`, wird sofort mit einer Task-ID zum Abfragen zurückgegeben. Andernfalls wird auf den Abschluss gewartet.
|
||||
|
||||
##### getWorkflowStatus()
|
||||
|
||||
@@ -110,7 +115,7 @@ console.log('Is deployed:', status.isDeployed);
|
||||
**Parameter:**
|
||||
- `workflowId` (string): Die ID des Workflows
|
||||
|
||||
**Rückgabewert:** `Promise<WorkflowStatus>`
|
||||
**Rückgabe:** `Promise<WorkflowStatus>`
|
||||
|
||||
##### validateWorkflow()
|
||||
|
||||
@@ -126,34 +131,123 @@ if (isReady) {
|
||||
**Parameter:**
|
||||
- `workflowId` (string): Die ID des Workflows
|
||||
|
||||
**Rückgabewert:** `Promise<boolean>`
|
||||
**Rückgabe:** `Promise<boolean>`
|
||||
|
||||
##### executeWorkflowSync()
|
||||
##### getJobStatus()
|
||||
|
||||
<Callout type="info">
|
||||
Derzeit ist diese Methode identisch mit `executeWorkflow()`, da alle Ausführungen synchron sind. Diese Methode wird für zukünftige Kompatibilität bereitgestellt, wenn asynchrone Ausführung hinzugefügt wird.
|
||||
</Callout>
|
||||
|
||||
Einen Workflow ausführen (derzeit synchron, identisch mit `executeWorkflow()`).
|
||||
Den Status einer asynchronen Job-Ausführung abrufen.
|
||||
|
||||
```typescript
|
||||
const result = await client.executeWorkflowSync('workflow-id', {
|
||||
input: { data: 'some input' },
|
||||
timeout: 60000
|
||||
const status = await client.getJobStatus('task-id-from-async-execution');
|
||||
console.log('Status:', status.status); // 'queued', 'processing', 'completed', 'failed'
|
||||
if (status.status === 'completed') {
|
||||
console.log('Output:', status.output);
|
||||
}
|
||||
```
|
||||
|
||||
**Parameter:**
|
||||
- `taskId` (string): Die Task-ID, die von der asynchronen Ausführung zurückgegeben wurde
|
||||
|
||||
**Rückgabe:** `Promise<JobStatus>`
|
||||
|
||||
**Antwortfelder:**
|
||||
- `success` (boolean): Ob die Anfrage erfolgreich war
|
||||
- `taskId` (string): Die Task-ID
|
||||
- `status` (string): Einer der Werte `'queued'`, `'processing'`, `'completed'`, `'failed'`, `'cancelled'`
|
||||
- `metadata` (object): Enthält `startedAt`, `completedAt` und `duration`
|
||||
- `output` (any, optional): Die Workflow-Ausgabe (wenn abgeschlossen)
|
||||
- `error` (any, optional): Fehlerdetails (wenn fehlgeschlagen)
|
||||
- `estimatedDuration` (number, optional): Geschätzte Dauer in Millisekunden (wenn in Bearbeitung/in der Warteschlange)
|
||||
|
||||
##### executeWithRetry()
|
||||
|
||||
Führt einen Workflow mit automatischer Wiederholung bei Ratenlimitfehlern unter Verwendung von exponentiellem Backoff aus.
|
||||
|
||||
```typescript
|
||||
const result = await client.executeWithRetry('workflow-id', {
|
||||
input: { message: 'Hello' },
|
||||
timeout: 30000
|
||||
}, {
|
||||
maxRetries: 3, // Maximum number of retries
|
||||
initialDelay: 1000, // Initial delay in ms (1 second)
|
||||
maxDelay: 30000, // Maximum delay in ms (30 seconds)
|
||||
backoffMultiplier: 2 // Exponential backoff multiplier
|
||||
});
|
||||
```
|
||||
|
||||
**Parameter:**
|
||||
- `workflowId` (string): Die ID des auszuführenden Workflows
|
||||
- `options` (ExecutionOptions, optional):
|
||||
- `input` (any): Eingabedaten, die an den Workflow übergeben werden
|
||||
- `timeout` (number): Timeout für die initiale Anfrage in Millisekunden
|
||||
- `options` (ExecutionOptions, optional): Gleich wie `executeWorkflow()`
|
||||
- `retryOptions` (RetryOptions, optional):
|
||||
- `maxRetries` (number): Maximale Anzahl von Wiederholungen (Standard: 3)
|
||||
- `initialDelay` (number): Anfängliche Verzögerung in ms (Standard: 1000)
|
||||
- `maxDelay` (number): Maximale Verzögerung in ms (Standard: 30000)
|
||||
- `backoffMultiplier` (number): Backoff-Multiplikator (Standard: 2)
|
||||
|
||||
**Rückgabewert:** `Promise<WorkflowExecutionResult>`
|
||||
**Rückgabewert:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
|
||||
|
||||
Die Wiederholungslogik verwendet exponentiellen Backoff (1s → 2s → 4s → 8s...) mit ±25% Jitter, um den Thundering-Herd-Effekt zu vermeiden. Wenn die API einen `retry-after`Header bereitstellt, wird dieser stattdessen verwendet.
|
||||
|
||||
##### getRateLimitInfo()
|
||||
|
||||
Ruft die aktuellen Ratenlimit-Informationen aus der letzten API-Antwort ab.
|
||||
|
||||
```typescript
|
||||
const rateLimitInfo = client.getRateLimitInfo();
|
||||
if (rateLimitInfo) {
|
||||
console.log('Limit:', rateLimitInfo.limit);
|
||||
console.log('Remaining:', rateLimitInfo.remaining);
|
||||
console.log('Reset:', new Date(rateLimitInfo.reset * 1000));
|
||||
}
|
||||
```
|
||||
|
||||
**Rückgabewert:** `RateLimitInfo | null`
|
||||
|
||||
##### getUsageLimits()
|
||||
|
||||
Ruft aktuelle Nutzungslimits und Kontingentinformationen für Ihr Konto ab.
|
||||
|
||||
```typescript
|
||||
const limits = await client.getUsageLimits();
|
||||
console.log('Sync requests remaining:', limits.rateLimit.sync.remaining);
|
||||
console.log('Async requests remaining:', limits.rateLimit.async.remaining);
|
||||
console.log('Current period cost:', limits.usage.currentPeriodCost);
|
||||
console.log('Plan:', limits.usage.plan);
|
||||
```
|
||||
|
||||
**Rückgabewert:** `Promise<UsageLimits>`
|
||||
|
||||
**Antwortstruktur:**
|
||||
|
||||
```typescript
|
||||
{
|
||||
success: boolean
|
||||
rateLimit: {
|
||||
sync: {
|
||||
isLimited: boolean
|
||||
limit: number
|
||||
remaining: number
|
||||
resetAt: string
|
||||
}
|
||||
async: {
|
||||
isLimited: boolean
|
||||
limit: number
|
||||
remaining: number
|
||||
resetAt: string
|
||||
}
|
||||
authType: string // 'api' or 'manual'
|
||||
}
|
||||
usage: {
|
||||
currentPeriodCost: number
|
||||
limit: number
|
||||
plan: string // e.g., 'free', 'pro'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### setApiKey()
|
||||
|
||||
Den API-Schlüssel aktualisieren.
|
||||
Aktualisiert den API-Schlüssel.
|
||||
|
||||
```typescript
|
||||
client.setApiKey('new-api-key');
|
||||
@@ -161,7 +255,7 @@ client.setApiKey('new-api-key');
|
||||
|
||||
##### setBaseUrl()
|
||||
|
||||
Die Basis-URL aktualisieren.
|
||||
Aktualisiert die Basis-URL.
|
||||
|
||||
```typescript
|
||||
client.setBaseUrl('https://my-custom-domain.com');
|
||||
@@ -187,6 +281,20 @@ interface WorkflowExecutionResult {
|
||||
}
|
||||
```
|
||||
|
||||
### AsyncExecutionResult
|
||||
|
||||
```typescript
|
||||
interface AsyncExecutionResult {
|
||||
success: boolean;
|
||||
taskId: string;
|
||||
status: 'queued';
|
||||
createdAt: string;
|
||||
links: {
|
||||
status: string; // e.g., "/api/jobs/{taskId}"
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### WorkflowStatus
|
||||
|
||||
```typescript
|
||||
@@ -198,6 +306,45 @@ interface WorkflowStatus {
|
||||
}
|
||||
```
|
||||
|
||||
### RateLimitInfo
|
||||
|
||||
```typescript
|
||||
interface RateLimitInfo {
|
||||
limit: number;
|
||||
remaining: number;
|
||||
reset: number;
|
||||
retryAfter?: number;
|
||||
}
|
||||
```
|
||||
|
||||
### UsageLimits
|
||||
|
||||
```typescript
|
||||
interface UsageLimits {
|
||||
success: boolean;
|
||||
rateLimit: {
|
||||
sync: {
|
||||
isLimited: boolean;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
resetAt: string;
|
||||
};
|
||||
async: {
|
||||
isLimited: boolean;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
resetAt: string;
|
||||
};
|
||||
authType: string;
|
||||
};
|
||||
usage: {
|
||||
currentPeriodCost: number;
|
||||
limit: number;
|
||||
plan: string;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### SimStudioError
|
||||
|
||||
```typescript
|
||||
@@ -207,6 +354,13 @@ class SimStudioError extends Error {
|
||||
}
|
||||
```
|
||||
|
||||
**Häufige Fehlercodes:**
|
||||
- `UNAUTHORIZED`: Ungültiger API-Schlüssel
|
||||
- `TIMEOUT`: Zeitüberschreitung der Anfrage
|
||||
- `RATE_LIMIT_EXCEEDED`: Ratengrenze überschritten
|
||||
- `USAGE_LIMIT_EXCEEDED`: Nutzungsgrenze überschritten
|
||||
- `EXECUTION_ERROR`: Workflow-Ausführung fehlgeschlagen
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Grundlegende Workflow-Ausführung
|
||||
@@ -230,7 +384,7 @@ class SimStudioError extends Error {
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function runWorkflow() {
|
||||
@@ -271,7 +425,7 @@ Behandeln Sie verschiedene Fehlertypen, die während der Workflow-Ausführung au
|
||||
import { SimStudioClient, SimStudioError } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithErrorHandling() {
|
||||
@@ -315,14 +469,14 @@ Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
// Development configuration
|
||||
const apiKey = process.env.SIMSTUDIO_API_KEY;
|
||||
const apiKey = process.env.SIM_API_KEY;
|
||||
if (!apiKey) {
|
||||
throw new Error('SIMSTUDIO_API_KEY environment variable is required');
|
||||
throw new Error('SIM_API_KEY environment variable is required');
|
||||
}
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey,
|
||||
baseUrl: process.env.SIMSTUDIO_BASE_URL // optional
|
||||
baseUrl: process.env.SIM_BASE_URL // optional
|
||||
});
|
||||
```
|
||||
|
||||
@@ -333,14 +487,14 @@ Konfigurieren Sie den Client mit Umgebungsvariablen:
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
// Production configuration with validation
|
||||
const apiKey = process.env.SIMSTUDIO_API_KEY;
|
||||
const apiKey = process.env.SIM_API_KEY;
|
||||
if (!apiKey) {
|
||||
throw new Error('SIMSTUDIO_API_KEY environment variable is required');
|
||||
throw new Error('SIM_API_KEY environment variable is required');
|
||||
}
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey,
|
||||
baseUrl: process.env.SIMSTUDIO_BASE_URL || 'https://sim.ai'
|
||||
baseUrl: process.env.SIM_BASE_URL || 'https://sim.ai'
|
||||
});
|
||||
```
|
||||
|
||||
@@ -357,7 +511,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const app = express();
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
app.use(express.json());
|
||||
@@ -399,7 +553,7 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
export default async function handler(
|
||||
@@ -467,16 +621,16 @@ document.getElementById('executeBtn')?.addEventListener('click', executeClientSi
|
||||
Bei der Verwendung des SDK im Browser sollten Sie darauf achten, keine sensiblen API-Schlüssel offenzulegen. Erwägen Sie die Verwendung eines Backend-Proxys oder öffentlicher API-Schlüssel mit eingeschränkten Berechtigungen.
|
||||
</Callout>
|
||||
|
||||
### React Hook Beispiel
|
||||
### React Hook-Beispiel
|
||||
|
||||
Erstellen Sie einen benutzerdefinierten React Hook für die Workflow-Ausführung:
|
||||
Erstellen eines benutzerdefinierten React-Hooks für die Workflow-Ausführung:
|
||||
|
||||
```typescript
|
||||
import { useState, useCallback } from 'react';
|
||||
import { SimStudioClient, WorkflowExecutionResult } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.NEXT_PUBLIC_SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
interface UseWorkflowResult {
|
||||
@@ -532,7 +686,7 @@ function WorkflowComponent() {
|
||||
<button onClick={handleExecute} disabled={loading}>
|
||||
{loading ? 'Executing...' : 'Execute Workflow'}
|
||||
</button>
|
||||
|
||||
|
||||
{error && <div>Error: {error.message}</div>}
|
||||
{result && (
|
||||
<div>
|
||||
@@ -545,63 +699,264 @@ function WorkflowComponent() {
|
||||
}
|
||||
```
|
||||
|
||||
## Ihren API-Schlüssel erhalten
|
||||
### Asynchrone Workflow-Ausführung
|
||||
|
||||
Führen Sie Workflows asynchron für lang laufende Aufgaben aus:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient, AsyncExecutionResult } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeAsync() {
|
||||
try {
|
||||
// Start async execution
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: { data: 'large dataset' },
|
||||
async: true // Execute asynchronously
|
||||
});
|
||||
|
||||
// Check if result is an async execution
|
||||
if ('taskId' in result) {
|
||||
console.log('Task ID:', result.taskId);
|
||||
console.log('Status endpoint:', result.links.status);
|
||||
|
||||
// Poll for completion
|
||||
let status = await client.getJobStatus(result.taskId);
|
||||
|
||||
while (status.status === 'queued' || status.status === 'processing') {
|
||||
console.log('Current status:', status.status);
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds
|
||||
status = await client.getJobStatus(result.taskId);
|
||||
}
|
||||
|
||||
if (status.status === 'completed') {
|
||||
console.log('Workflow completed!');
|
||||
console.log('Output:', status.output);
|
||||
console.log('Duration:', status.metadata.duration);
|
||||
} else {
|
||||
console.error('Workflow failed:', status.error);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
executeAsync();
|
||||
```
|
||||
|
||||
### Rate-Limiting und Wiederholungsversuche
|
||||
|
||||
Automatische Behandlung von Rate-Limits mit exponentiellem Backoff:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient, SimStudioError } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithRetryHandling() {
|
||||
try {
|
||||
// Automatically retries on rate limit
|
||||
const result = await client.executeWithRetry('workflow-id', {
|
||||
input: { message: 'Process this' }
|
||||
}, {
|
||||
maxRetries: 5,
|
||||
initialDelay: 1000,
|
||||
maxDelay: 60000,
|
||||
backoffMultiplier: 2
|
||||
});
|
||||
|
||||
console.log('Success:', result);
|
||||
} catch (error) {
|
||||
if (error instanceof SimStudioError && error.code === 'RATE_LIMIT_EXCEEDED') {
|
||||
console.error('Rate limit exceeded after all retries');
|
||||
|
||||
// Check rate limit info
|
||||
const rateLimitInfo = client.getRateLimitInfo();
|
||||
if (rateLimitInfo) {
|
||||
console.log('Rate limit resets at:', new Date(rateLimitInfo.reset * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Nutzungsüberwachung
|
||||
|
||||
Überwachen Sie Ihre Kontonutzung und -limits:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function checkUsage() {
|
||||
try {
|
||||
const limits = await client.getUsageLimits();
|
||||
|
||||
console.log('=== Rate Limits ===');
|
||||
console.log('Sync requests:');
|
||||
console.log(' Limit:', limits.rateLimit.sync.limit);
|
||||
console.log(' Remaining:', limits.rateLimit.sync.remaining);
|
||||
console.log(' Resets at:', limits.rateLimit.sync.resetAt);
|
||||
console.log(' Is limited:', limits.rateLimit.sync.isLimited);
|
||||
|
||||
console.log('\nAsync requests:');
|
||||
console.log(' Limit:', limits.rateLimit.async.limit);
|
||||
console.log(' Remaining:', limits.rateLimit.async.remaining);
|
||||
console.log(' Resets at:', limits.rateLimit.async.resetAt);
|
||||
console.log(' Is limited:', limits.rateLimit.async.isLimited);
|
||||
|
||||
console.log('\n=== Usage ===');
|
||||
console.log('Current period cost:
|
||||
|
||||
### Streaming Workflow Execution
|
||||
|
||||
Execute workflows with real-time streaming responses:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithStreaming() {
|
||||
try {
|
||||
// Streaming für bestimmte Block-Ausgaben aktivieren
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: { message: 'Count to five' },
|
||||
stream: true,
|
||||
selectedOutputs: ['agent1.content'] // Format blockName.attribute verwenden
|
||||
});
|
||||
|
||||
console.log('Workflow-Ergebnis:', result);
|
||||
} catch (error) {
|
||||
console.error('Fehler:', error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The streaming response follows the Server-Sent Events (SSE) format:
|
||||
|
||||
```
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", zwei"}
|
||||
|
||||
data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}}
|
||||
|
||||
data: [DONE]
|
||||
```
|
||||
|
||||
**React Streaming Example:**
|
||||
|
||||
```typescript
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
function StreamingWorkflow() {
|
||||
const [output, setOutput] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const executeStreaming = async () => {
|
||||
setLoading(true);
|
||||
setOutput('');
|
||||
|
||||
// WICHTIG: Führen Sie diesen API-Aufruf von Ihrem Backend-Server aus, nicht vom Browser
|
||||
// Setzen Sie niemals Ihren API-Schlüssel im Client-seitigen Code frei
|
||||
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': process.env.SIM_API_KEY! // Nur serverseitige Umgebungsvariable
|
||||
},
|
||||
body: JSON.stringify({
|
||||
message: 'Generate a story',
|
||||
stream: true,
|
||||
selectedOutputs: ['agent1.content']
|
||||
})
|
||||
});
|
||||
|
||||
const reader = response.body?.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
while (reader) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
const chunk = decoder.decode(value);
|
||||
const lines = chunk.split('\n\n');
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('data: ')) {
|
||||
const data = line.slice(6);
|
||||
if (data === '[DONE]') {
|
||||
setLoading(false);
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(data);
|
||||
if (parsed.chunk) {
|
||||
setOutput(prev => prev + parsed.chunk);
|
||||
} else if (parsed.event === 'done') {
|
||||
console.log('Ausführung abgeschlossen:', parsed.metadata);
|
||||
}
|
||||
} catch (e) {
|
||||
// Ungültiges JSON überspringen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button onClick={executeStreaming} disabled={loading}>
|
||||
{loading ? 'Generiere...' : 'Streaming starten'}
|
||||
</button>
|
||||
<div style={{ whiteSpace: 'pre-wrap' }}>{output}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Getting Your API Key
|
||||
|
||||
<Steps>
|
||||
<Step title="Bei Sim anmelden">
|
||||
Navigieren Sie zu [Sim](https://sim.ai) und melden Sie sich bei Ihrem Konto an.
|
||||
<Step title="Log in to Sim">
|
||||
Navigate to [Sim](https://sim.ai) and log in to your account.
|
||||
</Step>
|
||||
<Step title="Öffnen Sie Ihren Workflow">
|
||||
Navigieren Sie zu dem Workflow, den Sie programmatisch ausführen möchten.
|
||||
<Step title="Open your workflow">
|
||||
Navigate to the workflow you want to execute programmatically.
|
||||
</Step>
|
||||
<Step title="Deployen Sie Ihren Workflow">
|
||||
Klicken Sie auf "Deploy", um Ihren Workflow zu deployen, falls dies noch nicht geschehen ist.
|
||||
<Step title="Deploy your workflow">
|
||||
Click on "Deploy" to deploy your workflow if it hasn't been deployed yet.
|
||||
</Step>
|
||||
<Step title="Erstellen oder wählen Sie einen API-Schlüssel">
|
||||
Wählen Sie während des Deployment-Prozesses einen API-Schlüssel aus oder erstellen Sie einen neuen.
|
||||
<Step title="Create or select an API key">
|
||||
During the deployment process, select or create an API key.
|
||||
</Step>
|
||||
<Step title="Kopieren Sie den API-Schlüssel">
|
||||
Kopieren Sie den API-Schlüssel zur Verwendung in Ihrer TypeScript/JavaScript-Anwendung.
|
||||
<Step title="Copy the API key">
|
||||
Copy the API key to use in your TypeScript/JavaScript application.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Callout type="warning">
|
||||
Halten Sie Ihren API-Schlüssel sicher und committen Sie ihn niemals in die Versionskontrolle. Verwenden Sie Umgebungsvariablen oder sicheres Konfigurationsmanagement.
|
||||
Keep your API key secure and never commit it to version control. Use environment variables or secure configuration management.
|
||||
</Callout>
|
||||
|
||||
## Anforderungen
|
||||
## Requirements
|
||||
|
||||
- Node.js 16+
|
||||
- TypeScript 5.0+ (für TypeScript-Projekte)
|
||||
- TypeScript 5.0+ (for TypeScript projects)
|
||||
|
||||
## TypeScript-Unterstützung
|
||||
|
||||
Das SDK ist in TypeScript geschrieben und bietet vollständige Typsicherheit:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
SimStudioClient,
|
||||
WorkflowExecutionResult,
|
||||
WorkflowStatus,
|
||||
SimStudioError
|
||||
} from 'simstudio-ts-sdk';
|
||||
|
||||
// Type-safe client initialization
|
||||
const client: SimStudioClient = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
});
|
||||
|
||||
// Type-safe workflow execution
|
||||
const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', {
|
||||
input: {
|
||||
message: 'Hello, TypeScript!'
|
||||
}
|
||||
});
|
||||
|
||||
// Type-safe status checking
|
||||
const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id');
|
||||
```
|
||||
|
||||
## Lizenz
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
226
apps/docs/content/docs/de/tools/clay.mdx
Normal file
226
apps/docs/content/docs/de/tools/clay.mdx
Normal file
@@ -0,0 +1,226 @@
|
||||
---
|
||||
title: Clay
|
||||
description: Populate Clay workbook
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="clay"
|
||||
color="#E0E0E0"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon" xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'>
|
||||
<path
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='#41B9FD'
|
||||
d=' M225.000000,1.000000 C227.042313,1.000000 229.084641,1.000000 231.903046,1.237045
|
||||
C233.981308,1.648251 235.283447,1.974177 236.585678,1.974532 C276.426849,1.985374 316.268005,1.964254 356.349304,2.036658
|
||||
C356.713806,2.242061 356.838165,2.358902 357.013062,2.696568 C357.361633,3.243123 357.659729,3.568854 358.029053,3.919451
|
||||
C358.100250,3.944317 358.064270,4.090822 358.043335,4.397895 C358.300018,5.454089 358.577637,6.203210 358.919647,7.420082
|
||||
C358.919891,27.877140 358.855774,47.866444 358.406097,67.910400 C355.200592,68.111740 352.380737,68.384270 349.560669,68.386124
|
||||
C311.434967,68.411194 273.308777,68.303810 235.184082,68.495499 C229.321579,68.524979 223.465759,69.888084 217.280884,70.633224
|
||||
C216.309952,70.742836 215.664993,70.853645 214.722351,70.824722 C211.834686,71.349052 209.244675,72.013123 206.377716,72.681381
|
||||
C205.743713,72.776283 205.386673,72.866997 204.740524,72.831818 C198.868668,74.719879 193.285919,76.733833 187.518951,78.776100
|
||||
C187.334747,78.804405 187.002716,78.975388 186.619080,78.955429 C183.339905,80.398605 180.444336,81.861732 177.450043,83.356339
|
||||
C177.351318,83.387817 177.199478,83.528885 176.863098,83.476791 C174.940445,84.544197 173.354172,85.663696 171.490601,86.873726
|
||||
C170.873749,87.151909 170.534180,87.339554 169.900208,87.480209 C169.065109,87.950676 168.524414,88.468132 167.772736,89.059799
|
||||
C167.561722,89.134003 167.180191,89.367592 166.874084,89.344360 C166.036011,89.874809 165.504074,90.428497 164.768677,91.071411
|
||||
C164.565247,91.160652 164.195068,91.406326 163.886719,91.361374 C162.847015,91.962418 162.115631,92.608421 161.328308,93.267891
|
||||
C161.272369,93.281357 161.208405,93.377022 160.867157,93.365463 C158.692642,94.907082 156.859375,96.460266 154.780716,98.176086
|
||||
C154.099411,98.731529 153.663513,99.124352 153.029877,99.558502 C152.562164,99.788048 152.505905,100.026695 152.411484,100.477333
|
||||
C151.745850,101.065102 151.332077,101.491318 150.666687,101.980057 C150.244827,102.329651 150.074554,102.616714 149.702332,103.025635
|
||||
C149.247330,103.342041 149.041901,103.578056 148.626404,103.921570 C148.191071,104.281303 148.013428,104.574989 147.660767,104.971512
|
||||
C147.485733,105.074348 147.185501,105.347694 146.854645,105.346924 C145.509140,106.645203 144.494507,107.944252 143.328308,109.398895
|
||||
C143.176773,109.554497 142.944397,109.921532 142.688324,109.990189 C142.263062,110.355179 142.093887,110.651512 141.672485,111.133896
|
||||
C140.733337,112.108200 140.046402,112.896461 139.056610,113.710732 C138.269180,114.554047 137.784592,115.371346 137.263580,116.208557
|
||||
C137.227158,116.228470 137.222885,116.311386 136.910522,116.418571 C134.917343,118.573212 133.067978,120.505791 131.581848,122.685951
|
||||
C117.236908,143.729858 109.909592,167.062012 108.797867,192.458298 C106.874710,236.390839 120.176277,274.069336 154.210175,303.200592
|
||||
C157.543198,306.053497 161.524918,308.148560 165.395065,310.715118 C165.584625,310.834839 166.004089,310.993286 166.112747,311.305908
|
||||
C169.421280,313.480804 172.621170,315.343109 176.067993,317.436401 C196.154831,328.754059 217.585236,333.047546 240.138840,332.968475
|
||||
C276.608368,332.840607 313.078613,332.912872 349.548553,332.932007 C352.369659,332.933472 355.190643,333.181519 358.042847,333.756317
|
||||
C358.105377,352.504913 358.140625,370.812134 358.166443,389.119385 C358.179047,398.047455 357.157593,399.080383 348.101379,399.081543
|
||||
C309.488556,399.086456 270.875702,399.088837 232.262939,399.034698 C229.118195,399.030304 225.976639,398.454163 222.828934,398.396088
|
||||
C219.876633,398.341614 216.918152,398.621979 213.655640,398.750488 C212.946808,398.674561 212.544739,398.603149 211.932861,398.249359
|
||||
C205.139450,396.920532 198.555878,395.874084 191.660583,394.785370 C190.959366,394.590973 190.569855,394.438812 189.976242,394.044556
|
||||
C188.751892,393.631897 187.731628,393.461365 186.520462,393.271667 C186.329559,393.252502 185.966660,393.127686 185.711517,392.875610
|
||||
C179.817810,390.901337 174.179230,389.179169 168.376038,387.422913 C168.211411,387.388824 167.919205,387.222443 167.713623,386.935791
|
||||
C163.177170,384.926636 158.846298,383.204132 154.354828,381.442505 C154.194229,381.403320 153.913010,381.229431 153.720596,380.940063
|
||||
C150.958603,379.507599 148.389023,378.364502 145.862350,377.112976 C145.905273,377.004486 145.834991,377.222992 145.696899,376.907410
|
||||
C143.278778,375.470276 140.998734,374.348724 138.546249,373.152405 C138.373810,373.077606 138.071228,372.854553 137.964508,372.539856
|
||||
C136.491272,371.591217 135.124771,370.957306 133.835419,370.230103 C133.912552,370.136810 133.731659,370.297668 133.638489,369.968719
|
||||
C130.257477,367.557678 126.969620,365.475616 123.676697,363.365906 C123.671616,363.338226 123.618034,363.355438 123.527176,363.037048
|
||||
C122.530983,362.219849 121.625641,361.721039 120.554291,361.141144 C120.388283,361.060028 120.099663,360.829254 120.012115,360.507904
|
||||
C116.854935,357.864441 113.785301,355.542328 110.448624,353.088013 C109.480820,352.261383 108.780060,351.566956 108.005241,350.545807
|
||||
C106.569366,349.183838 105.207550,348.148560 103.618164,346.953125 C102.887856,346.250793 102.385124,345.708649 101.851944,344.819275
|
||||
C99.227608,341.972198 96.633736,339.472412 93.829559,336.814728 C93.315529,336.231140 93.011803,335.805389 92.626633,335.113678
|
||||
C92.241318,334.653351 91.937447,334.458984 91.470352,334.116333 C91.113121,333.744141 90.954285,333.497589 90.815475,332.884094
|
||||
C89.432999,331.125000 88.065689,329.710205 86.750458,328.261658 C86.802551,328.227905 86.679573,328.244812 86.625587,328.004700
|
||||
C86.408173,327.453064 86.154968,327.258301 85.840820,327.092529 C85.869644,327.004852 85.792236,327.175934 85.788193,326.847412
|
||||
C85.086029,325.775726 84.387909,325.032593 83.748154,324.192444 C83.806519,324.095428 83.656967,324.265442 83.677109,323.924805
|
||||
C82.691200,322.493195 81.685143,321.402222 80.701370,320.271667 C80.723648,320.232025 80.638077,320.262756 80.664627,319.911865
|
||||
C79.348137,317.824493 78.005081,316.088074 76.632942,314.335297 C76.603851,314.318970 76.610863,314.252594 76.569603,314.015747
|
||||
C76.383919,313.466492 76.145622,313.265167 75.849998,313.133301 C75.886536,313.091675 75.786301,313.138794 75.787926,312.843567
|
||||
C75.413757,312.136780 75.037964,311.725281 74.650452,311.296570 C74.638725,311.279388 74.605232,311.254669 74.648026,310.925659
|
||||
C74.042847,309.802277 73.394867,309.007935 72.848984,308.101166 C72.951088,307.988739 72.736649,308.207153 72.749344,307.902405
|
||||
C72.247162,307.034119 71.732277,306.470612 71.116684,305.727478 C71.015976,305.547882 70.879890,305.159210 70.904739,304.782593
|
||||
C66.198082,293.805145 61.429871,283.220459 56.753250,272.595459 C54.901436,268.388306 53.253181,264.091522 51.402115,259.538025
|
||||
C51.225922,258.823547 51.159870,258.406525 51.280235,257.681335 C50.130058,252.530197 48.793461,247.687271 47.372990,242.549011
|
||||
C47.250717,241.846664 47.212318,241.439667 47.345688,240.702484 C46.854862,237.196991 46.192276,234.021698 45.439560,230.551788
|
||||
C45.308647,229.849213 45.267864,229.441223 45.399055,228.679535 C45.646000,226.680176 45.810993,225.032898 45.781715,223.389099
|
||||
C45.543224,209.998566 45.243523,196.609085 45.021889,183.218307 C44.965343,179.801880 45.121227,176.381912 45.183868,172.656006
|
||||
C45.260223,171.945328 45.332214,171.542252 45.692661,170.944855 C46.379547,167.156143 46.777977,163.561768 47.196243,159.658173
|
||||
C47.326954,158.952240 47.437832,158.555511 47.816860,157.951569 C48.405701,156.819183 48.802628,155.912750 49.035774,154.966003
|
||||
C53.321564,137.562775 58.709690,120.561356 67.075592,104.614586 C68.431061,102.030846 69.442665,99.266708 70.700943,96.329689
|
||||
C70.963600,95.758194 71.138519,95.442963 71.626465,95.023987 C72.881813,93.185463 73.824142,91.450684 74.833984,89.540924
|
||||
C74.901497,89.365936 75.115746,89.058022 75.414856,88.950439 C76.055374,88.124435 76.396790,87.406006 76.808441,86.516800
|
||||
C76.878685,86.346008 77.099190,86.049721 77.426208,85.968033 C78.773079,84.202591 79.792938,82.518845 80.906425,80.889481
|
||||
C81.000053,80.943871 80.811523,80.846413 81.112083,80.718071 C81.899254,79.675362 82.385872,78.760994 82.980141,77.647797
|
||||
C83.256111,77.193130 83.468399,76.981361 83.972061,76.695953 C84.379341,76.259384 84.539192,75.940521 84.777573,75.467239
|
||||
C84.856110,75.312813 85.091125,75.058212 85.387177,74.957954 C86.071411,74.171829 86.459602,73.485962 86.959831,72.547165
|
||||
C87.574921,71.763893 88.077972,71.233551 88.917511,70.614960 C90.438446,68.934166 91.622894,67.341637 92.892502,65.577087
|
||||
C92.977646,65.405067 93.223930,65.110596 93.540451,65.035034 C94.925735,63.668842 95.994484,62.378204 97.037460,61.053047
|
||||
C97.011688,61.018532 97.086418,61.061367 97.418701,60.997078 C100.387512,58.135143 103.024048,55.337498 105.840828,52.291214
|
||||
C107.274651,50.972633 108.528229,49.902691 110.120842,48.821507 C111.324287,47.898228 112.188705,46.986183 113.028954,46.039188
|
||||
C113.004784,46.004234 113.069771,46.059036 113.418266,46.038719 C115.379044,44.556744 116.991333,43.095085 118.618896,41.600952
|
||||
C118.634186,41.568470 118.705971,41.569565 118.943619,41.531807 C119.496582,41.345333 119.686287,41.099613 119.875092,40.861622
|
||||
C119.999825,40.966347 119.751175,40.750431 120.085175,40.695145 C121.552383,39.660774 122.685600,38.681686 123.971207,37.539024
|
||||
C124.353516,37.180477 124.609665,37.030270 125.248093,36.934944 C127.105858,35.720867 128.607605,34.496674 130.284821,33.157169
|
||||
C130.460281,33.041859 130.850082,32.885620 131.191956,32.879478 C132.720169,31.979248 133.906525,31.085161 135.242615,30.070633
|
||||
C135.392365,29.950191 135.742935,29.792681 136.116943,29.797058 C144.044449,25.665834 151.597931,21.530237 159.443359,17.267967
|
||||
C160.335373,16.929420 160.935471,16.717543 161.932648,16.610218 C166.284805,15.022083 170.239853,13.329394 174.481018,11.497526
|
||||
C175.179947,11.265512 175.592758,11.172676 176.284058,11.232684 C181.045059,9.931384 185.527557,8.477241 190.283020,6.942632
|
||||
C190.929428,6.798172 191.302902,6.734176 192.106628,6.758037 C200.661499,5.630559 208.799301,4.494970 216.903397,3.155535
|
||||
C219.646088,2.702227 222.303574,1.733297 225.000000,1.000000 z'
|
||||
/>
|
||||
<path
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='#CF207F'
|
||||
d=' M139.359467,113.684723 C140.046402,112.896461 140.733337,112.108200 141.935272,111.074768
|
||||
C142.614975,110.526917 142.779678,110.224220 142.944397,109.921524 C142.944397,109.921532 143.176773,109.554497 143.635193,109.340279
|
||||
C145.124252,107.866608 146.154877,106.607147 147.185501,105.347694 C147.185501,105.347694 147.485733,105.074348 147.925735,104.915680
|
||||
C148.538528,104.456520 148.711319,104.156021 148.884109,103.855530 C149.041901,103.578056 149.247330,103.342041 149.974884,103.098984
|
||||
C150.636948,103.055161 150.824478,103.059845 151.047058,103.134651 C151.082077,103.204781 151.296890,103.193550 151.296890,103.193550
|
||||
C151.296890,103.193550 151.065384,103.011589 151.060242,102.733826 C151.009506,102.276550 150.963913,102.097046 150.918304,101.917534
|
||||
C151.332077,101.491318 151.745850,101.065102 152.635773,100.460251 C153.111908,100.281609 153.497894,100.049179 153.789368,100.038872
|
||||
C154.772659,99.452271 155.464478,98.875984 156.408234,98.117584 C157.490311,97.320854 158.320465,96.706223 159.411987,96.018272
|
||||
C160.091385,95.613731 160.509415,95.282509 161.005707,94.693756 C161.125443,94.083160 161.166931,93.730095 161.208405,93.377022
|
||||
C161.208405,93.377022 161.272369,93.281357 161.637833,93.283844 C162.733887,92.659668 163.464478,92.032997 164.195068,91.406326
|
||||
C164.195068,91.406326 164.565247,91.160652 165.074371,91.083725 C166.115738,90.460403 166.647964,89.913994 167.180191,89.367592
|
||||
C167.180191,89.367592 167.561722,89.134003 168.067535,89.083694 C169.113785,88.531319 169.654205,88.029266 170.194611,87.527206
|
||||
C170.534180,87.339554 170.873749,87.151909 171.836243,86.913345 C174.039276,85.751251 175.619370,84.640068 177.199478,83.528885
|
||||
C177.199478,83.528885 177.351318,83.387817 177.799438,83.385483 C179.820572,82.883362 181.393585,82.383591 183.170273,81.808777
|
||||
C183.633362,81.599014 183.861649,81.423775 184.373871,81.123398 C185.491287,80.703987 186.293686,80.369202 187.361908,79.991440
|
||||
C188.096588,79.696411 188.565445,79.444366 189.280243,79.140625 C189.689667,79.052353 189.853149,79.015762 190.210281,78.900085
|
||||
C190.651642,78.688210 190.867310,78.515427 191.369507,78.235207 C192.110519,78.067825 192.532990,77.967896 193.244263,77.853729
|
||||
C194.045349,77.588539 194.557632,77.337585 195.404114,77.018097 C196.821823,76.607903 197.905350,76.266235 199.266159,75.907867
|
||||
C200.036407,75.656876 200.529373,75.422592 201.364365,75.106812 C202.827423,74.692017 203.948425,74.358734 205.380356,74.019363
|
||||
C206.468277,73.766235 207.245285,73.519203 208.389984,73.226074 C209.493317,73.091133 210.228912,73.002289 211.290283,72.935577
|
||||
C212.412201,72.683113 213.208344,72.408524 214.267502,72.100060 C214.705307,72.039871 214.880112,72.013565 215.424881,71.999588
|
||||
C217.201248,71.734070 218.607666,71.456200 220.413910,71.153488 C221.880417,71.070969 222.947083,71.013298 224.279190,71.170303
|
||||
C226.068039,70.992416 227.591461,70.599854 229.423401,70.196625 C230.143173,70.169228 230.554443,70.152512 231.313034,70.332619
|
||||
C235.115021,70.382599 238.569687,70.235756 242.491425,70.087082 C280.953430,70.102844 318.948334,70.120430 357.053223,70.529343
|
||||
C357.455536,73.045441 357.992554,75.169182 358.001373,77.295113 C358.070374,93.940338 358.043671,110.585976 358.034363,127.231491
|
||||
C358.030548,134.046967 358.016937,134.057816 351.099701,134.059860 C310.817535,134.071823 270.534180,133.934753 230.254730,134.268967
|
||||
C225.246338,134.310516 220.258575,136.842316 215.230850,138.283905 C215.200439,138.347610 215.065262,138.306870 214.806305,138.286804
|
||||
C214.115921,138.505325 213.684479,138.743896 213.009598,139.115082 C212.583405,139.275208 212.400635,139.302734 211.833679,139.280731
|
||||
C208.407166,140.913559 205.364853,142.595886 202.282257,144.308472 C202.241974,144.338730 202.168381,144.269897 201.973877,144.345428
|
||||
C201.529541,144.568588 201.364868,144.781921 201.061798,145.322937 C200.647766,145.713150 200.457306,145.841385 199.948059,145.977448
|
||||
C197.417572,147.954681 195.205872,149.924103 192.993881,151.942596 C192.993607,151.991669 192.895477,151.990555 192.549149,152.015503
|
||||
C187.409988,154.769379 184.238312,158.680161 183.252487,164.111267 C183.188980,163.991821 183.294250,164.239044 182.950150,164.345627
|
||||
C180.427338,169.367905 177.154861,174.103409 176.308884,179.238663 C174.781265,188.511490 174.320831,198.014923 174.115677,207.437317
|
||||
C173.843521,219.937164 178.269516,231.196472 184.901489,241.604797 C185.796005,243.008667 187.567444,243.853790 188.990707,244.966980
|
||||
C189.048599,244.976334 189.032700,245.092545 189.039658,245.443787 C189.760330,247.068161 190.225784,248.594147 191.225662,249.575775
|
||||
C202.884888,261.022064 217.215424,267.483948 233.244598,267.746521 C272.873535,268.395599 312.520477,268.025818 352.159454,267.873199
|
||||
C356.777344,267.855408 358.164368,269.300385 358.106323,273.876007 C357.865570,292.859802 357.967224,311.847900 357.480347,330.882874
|
||||
C338.906525,330.962463 320.795410,331.052429 302.684601,331.010834 C276.765686,330.951324 250.846970,330.795715 224.637268,330.524200
|
||||
C223.236160,330.268494 222.125992,330.169708 220.602966,330.058136 C219.095612,329.927734 218.001114,329.810120 216.705780,329.546783
|
||||
C216.025055,329.282104 215.545151,329.163147 214.711487,329.008087 C213.887634,328.910431 213.417526,328.848877 212.660461,328.610291
|
||||
C211.246506,328.304504 210.119537,328.175751 208.744629,328.011780 C208.333069,327.943604 208.169434,327.910645 207.938263,327.637787
|
||||
C207.248444,327.303284 206.626129,327.208649 205.594803,327.076263 C204.102722,326.877716 203.019669,326.716858 201.800995,326.447266
|
||||
C201.471100,326.205719 201.260620,326.107544 200.685684,325.968201 C199.212677,325.508331 198.087952,325.124298 196.745544,324.584839
|
||||
C196.008286,324.314789 195.488724,324.200195 194.630951,324.040466 C193.850174,323.890259 193.407623,323.785156 192.841400,323.544250
|
||||
C192.535934,323.239014 192.330688,323.105682 192.067078,322.987274 C192.032166,322.966125 191.968018,322.915680 191.729294,322.721558
|
||||
C190.699036,322.352661 189.907501,322.177887 188.818344,321.917145 C188.322571,321.773010 188.124420,321.714844 187.806183,321.529083
|
||||
C187.508530,321.243896 187.309464,321.121094 186.809235,320.966248 C186.343460,320.853546 186.157333,320.807709 185.820770,320.618958
|
||||
C185.449020,320.300232 185.201187,320.178223 184.579239,320.017242 C183.123337,319.463867 182.015015,319.003296 180.807480,318.445465
|
||||
C180.565079,318.228424 180.407501,318.132172 179.911469,317.900696 C178.706055,317.357391 177.824753,316.972839 176.813736,316.472290
|
||||
C176.496887,316.208344 176.292038,316.091339 175.768234,315.863037 C174.296906,315.078705 173.126801,314.436676 171.834732,313.642029
|
||||
C171.530289,313.298096 171.319397,313.146332 170.800644,312.938660 C170.334427,312.781097 170.147659,312.718903 169.839874,312.529358
|
||||
C169.543640,312.242981 169.349289,312.112366 168.837830,311.854187 C167.694580,311.463196 166.849335,311.228241 166.004089,310.993286
|
||||
C166.004089,310.993286 165.584625,310.834839 165.340561,310.390503 C163.548645,308.481201 162.131165,306.841003 160.433350,305.577545
|
||||
C135.450775,286.986084 120.418205,262.047058 113.761909,231.918289 C110.147652,215.558807 109.790779,198.967697 111.782127,182.339249
|
||||
C113.832611,165.216965 118.597160,148.944382 127.160858,133.886154 C130.497955,128.018265 133.867905,122.169083 137.222885,116.311386
|
||||
C137.222885,116.311386 137.227158,116.228470 137.540863,116.214661 C138.211945,116.106445 138.569351,116.012032 139.062988,115.851028
|
||||
C139.427094,115.546883 139.469406,115.275383 139.372986,114.756676 C139.495758,114.250427 139.475632,113.964195 139.359467,113.684723 z'
|
||||
/>
|
||||
<path
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='#FFC947'
|
||||
d=' M200.266830,145.969620 C200.457306,145.841385 200.647766,145.713150 201.270264,145.275589
|
||||
C201.994553,144.826004 202.149918,144.593887 202.168381,144.269897 C202.168381,144.269897 202.241974,144.338730 202.627762,144.274597
|
||||
C206.081650,142.583710 209.149765,140.956970 212.217880,139.330231 C212.400635,139.302734 212.583405,139.275208 213.260132,139.131683
|
||||
C214.191147,138.779388 214.628204,138.543121 215.065262,138.306854 C215.065262,138.306870 215.200439,138.347610 215.615753,138.262543
|
||||
C222.236084,137.117767 228.435684,135.178802 234.646988,135.140549 C276.033936,134.885590 317.423431,135.036758 358.812073,135.055969
|
||||
C358.822845,178.409409 358.833618,221.762833 358.350433,265.618347 C317.222778,266.132172 276.588776,266.228516 235.955917,266.054840
|
||||
C230.533264,266.031647 225.031219,265.015839 219.714111,263.807587 C207.453613,261.021515 197.827393,253.684341 189.032700,245.092545
|
||||
C189.032700,245.092545 189.048599,244.976334 188.932205,244.635071 C178.652054,231.033371 175.024597,215.782471 175.030136,199.385284
|
||||
C175.034317,187.007950 178.389404,175.448639 183.294250,164.239044 C183.294250,164.239044 183.188980,163.991821 183.536774,163.962189
|
||||
C186.888184,159.951889 189.891830,155.971222 192.895477,151.990555 C192.895477,151.990555 192.993607,151.991669 193.307098,151.842606
|
||||
C195.835999,149.785568 198.051407,147.877594 200.266830,145.969620 z'
|
||||
/>
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
[Clay](https://www.clay.com/) is a data enrichment and workflow automation platform that helps teams streamline lead generation, research, and data operations through powerful integrations and flexible inputs.
|
||||
|
||||
Learn how to use the Clay Tool in Sim to seamlessly insert data into a Clay workbook through webhook triggers. This tutorial walks you through setting up a webhook, configuring data mapping, and automating real-time updates to your Clay workbooks. Perfect for streamlining lead generation and data enrichment directly from your workflow!
|
||||
|
||||
<iframe
|
||||
width="100%"
|
||||
height="400"
|
||||
src="https://www.youtube.com/embed/cx_75X5sI_s"
|
||||
title="Clay Integration with Sim"
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
></iframe>
|
||||
|
||||
With Clay, you can:
|
||||
|
||||
- **Enrich agent outputs**: Automatically feed your Sim agent data into Clay tables for structured tracking and analysis
|
||||
- **Trigger workflows via webhooks**: Use Clay’s webhook support to initiate Sim agent tasks from within Clay
|
||||
- **Leverage data loops**: Seamlessly iterate over enriched data rows with agents that operate across dynamic datasets
|
||||
|
||||
In Sim, the Clay integration allows your agents to push structured data into Clay tables via webhooks. This makes it easy to collect, enrich, and manage dynamic outputs such as leads, research summaries, or action items—all in a collaborative, spreadsheet-like interface. Your agents can populate rows in real time, enabling asynchronous workflows where AI-generated insights are captured, reviewed, and used by your team. Whether you're automating research, enriching CRM data, or tracking operational outcomes, Clay becomes a living data layer that interacts intelligently with your agents. By connecting Sim with Clay, you gain a powerful way to operationalize agent results, loop over datasets with precision, and maintain a clean, auditable record of AI-driven work.
|
||||
{/* MANUAL-CONTENT-END */}
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Clay into the workflow. Can populate a table with data.
|
||||
|
||||
## Tools
|
||||
|
||||
### `clay_populate`
|
||||
|
||||
Populate Clay with data from a JSON file. Enables direct communication and notifications with timestamp tracking and channel confirmation.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `webhookURL` | string | Yes | The webhook URL to populate |
|
||||
| `data` | json | Yes | The data to populate |
|
||||
| `authToken` | string | Yes | Auth token for Clay webhook authentication |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `success` | boolean | Operation success status |
|
||||
| `output` | json | Clay populate operation results including response data from Clay webhook |
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `clay`
|
||||
98
apps/docs/content/docs/de/tools/huggingface.mdx
Normal file
98
apps/docs/content/docs/de/tools/huggingface.mdx
Normal file
File diff suppressed because one or more lines are too long
@@ -60,10 +60,10 @@ Suche nach ähnlichen Inhalten in einer Wissensdatenbank mittels Vektorähnlichk
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `knowledgeBaseId` | string | Ja | ID der zu durchsuchenden Wissensdatenbank |
|
||||
| `knowledgeBaseId` | string | Ja | ID der Wissensdatenbank, in der gesucht werden soll |
|
||||
| `query` | string | Nein | Suchanfragentext \(optional bei Verwendung von Tag-Filtern\) |
|
||||
| `topK` | number | Nein | Anzahl der ähnlichsten Ergebnisse, die zurückgegeben werden sollen \(1-100\) |
|
||||
| `tagFilters` | any | Nein | Array von Tag-Filtern mit tagName- und tagValue-Eigenschaften |
|
||||
| `tagFilters` | array | Nein | Array von Tag-Filtern mit tagName- und tagValue-Eigenschaften |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
|
||||
219
apps/docs/content/docs/de/tools/stagehand.mdx
Normal file
219
apps/docs/content/docs/de/tools/stagehand.mdx
Normal file
@@ -0,0 +1,219 @@
|
||||
---
|
||||
title: Stagehand Extract
|
||||
description: Extract data from websites
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="stagehand"
|
||||
color="#FFC83C"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
|
||||
|
||||
viewBox='0 0 108 159'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<path
|
||||
d='M15 26C22.8234 31.822 23.619 41.405 25.3125 50.3867C25.8461 53.1914 26.4211 55.9689 27.0625 58.75C27.7987 61.9868 28.4177 65.2319 29 68.5C29.332 70.3336 29.6653 72.1669 30 74C30.1418 74.7863 30.2836 75.5727 30.4297 76.3828C31.8011 83.2882 33.3851 90.5397 39.4375 94.75C40.3405 95.3069 40.3405 95.3069 41.2617 95.875C43.8517 97.5512 45.826 99.826 48 102C50.6705 102.89 52.3407 103.143 55.0898 103.211C55.8742 103.239 56.6586 103.268 57.4668 103.297C59.1098 103.349 60.7531 103.393 62.3965 103.43C65.8896 103.567 68.4123 103.705 71.5664 105.289C73 107 73 107 73 111C73.66 111 74.32 111 75 111C74.0759 106.912 74.0759 106.912 71.4766 103.828C67.0509 102.348 62.3634 102.64 57.7305 102.609C52.3632 102.449 49.2783 101.537 45 98C41.8212 94.0795 41.5303 90.9791 42 86C44.9846 83.0154 48.2994 83.6556 52.3047 83.6289C53.139 83.6199 53.9734 83.6108 54.833 83.6015C56.6067 83.587 58.3805 83.5782 60.1543 83.5745C62.8304 83.5627 65.5041 83.5137 68.1797 83.4629C81.1788 83.34 91.8042 85.3227 102 94C106.37 100.042 105.483 106.273 104.754 113.406C103.821 119.026 101.968 124.375 100.125 129.75C99.8806 130.471 99.6361 131.193 99.3843 131.936C97.7783 136.447 95.9466 140.206 93 144C92.34 144 91.68 144 91 144C91 144.66 91 145.32 91 146C79.0816 156.115 63.9798 156.979 49 156C36.6394 154.226 26.7567 148.879 19 139C11.0548 125.712 11.6846 105.465 11.3782 90.4719C11.0579 77.4745 8.03411 64.8142 5.4536 52.1135C5.04373 50.0912 4.64233 48.0673 4.24218 46.043C4.00354 44.8573 3.7649 43.6716 3.51903 42.45C2.14425 33.3121 2.14425 33.3121 4.87499 29.125C8.18297 25.817 10.3605 25.4542 15 26Z'
|
||||
fill='#FDFDFD'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.8466 2.96604 96.2332 5.08365 97.6091 9.03564C99.203 14.0664 99.4412 18.7459 99.4414 23.9922C99.4538 24.9285 99.4663 25.8647 99.4791 26.8294C99.5049 28.8198 99.5247 30.8103 99.539 32.8008C99.5785 37.9693 99.6682 43.1369 99.7578 48.3047C99.7747 49.3188 99.7917 50.3328 99.8091 51.3776C99.9603 59.6066 100.323 67.7921 100.937 76C101.012 77.0582 101.087 78.1163 101.164 79.2065C101.646 85.1097 102.203 90.3442 105.602 95.3672C107.492 98.9262 107.45 102.194 107.375 106.125C107.366 106.881 107.356 107.638 107.346 108.417C107.18 114.639 106.185 120.152 104 126C103.636 126.996 103.273 127.993 102.898 129.02C98.2182 141.022 92.6784 149.349 80.7891 155.062C67.479 160.366 49.4234 159.559 36 155C32.4272 153.286 29.2162 151.308 26 149C25.0719 148.361 24.1437 147.721 23.1875 147.062C8.32968 133.054 9.60387 109.231 8.73413 90.3208C8.32766 81.776 7.51814 73.4295 5.99999 65C5.82831 64.0338 5.65662 63.0675 5.47973 62.072C4.98196 59.3363 4.46395 56.6053 3.93749 53.875C3.76412 52.9572 3.59074 52.0394 3.4121 51.0938C2.75101 47.6388 2.11387 44.3416 0.999995 41C0.505898 36.899 0.0476353 32.7768 2.04687 29.0469C4.91881 25.5668 6.78357 24.117 11.25 23.6875C15.8364 24.0697 17.5999 24.9021 21 28C24.7763 34.3881 26.047 41.2626 27.1875 48.5C27.5111 50.4693 27.8377 52.4381 28.168 54.4062C28.3733 55.695 28.3733 55.695 28.5828 57.0098C28.8087 58.991 28.8087 58.991 30 60C30.3171 59.4947 30.6342 58.9894 30.9609 58.4688C33.1122 55.4736 34.7097 53.3284 38.3789 52.3945C44.352 52.203 48.1389 53.6183 53 57C53.0928 56.1338 53.0928 56.1338 53.1875 55.25C54.4089 51.8676 55.9015 50.8075 59 49C63.8651 48.104 66.9348 48.3122 71.1487 51.0332C72.0896 51.6822 73.0305 52.3313 74 53C73.9686 51.2986 73.9686 51.2986 73.9365 49.5627C73.8636 45.3192 73.818 41.0758 73.7803 36.8318C73.7603 35.0016 73.733 33.1715 73.6982 31.3415C73.6492 28.6976 73.6269 26.0545 73.6094 23.4102C73.5887 22.6035 73.5681 21.7969 73.5468 20.9658C73.5441 13.8444 75.5121 7.83341 80.25 2.4375C83.9645 0.495841 86.8954 0.209055 91 0.999996ZM3.99999 30C1.56925 34.8615 3.215 40.9393 4.24218 46.043C4.37061 46.6927 4.49905 47.3424 4.63137 48.0118C5.03968 50.0717 5.45687 52.1296 5.87499 54.1875C11.1768 80.6177 11.1768 80.6177 11.4375 93.375C11.7542 120.78 11.7542 120.78 23.5625 144.375C28.5565 149.002 33.5798 151.815 40 154C40.6922 154.244 41.3844 154.487 42.0977 154.738C55.6463 158.576 72.4909 156.79 84.8086 150.316C87.0103 148.994 89.0458 147.669 91 146C91 145.34 91 144.68 91 144C91.66 144 92.32 144 93 144C97.1202 138.98 99.3206 133.053 101.25 126.937C101.505 126.174 101.76 125.41 102.023 124.623C104.94 115.65 107.293 104.629 103.625 95.625C96.3369 88.3369 86.5231 83.6919 76.1988 83.6088C74.9905 83.6226 74.9905 83.6226 73.7578 83.6367C72.9082 83.6362 72.0586 83.6357 71.1833 83.6352C69.4034 83.6375 67.6235 83.6472 65.8437 83.6638C63.1117 83.6876 60.3806 83.6843 57.6484 83.6777C55.9141 83.6833 54.1797 83.6904 52.4453 83.6992C51.6277 83.6983 50.81 83.6974 49.9676 83.6964C45.5122 83.571 45.5122 83.571 42 86C41.517 90.1855 41.733 92.4858 43.6875 96.25C46.4096 99.4871 48.6807 101.674 53.0105 102.282C55.3425 102.411 57.6645 102.473 60 102.5C69.8847 102.612 69.8847 102.612 74 106C74.8125 108.687 74.8125 108.688 75 111C74.34 111 73.68 111 73 111C72.8969 110.216 72.7937 109.432 72.6875 108.625C72.224 105.67 72.224 105.67 69 104C65.2788 103.745 61.5953 103.634 57.8672 103.609C51.1596 103.409 46.859 101.691 41.875 97C41.2562 96.34 40.6375 95.68 40 95C39.175 94.4637 38.35 93.9275 37.5 93.375C30.9449 87.1477 30.3616 77.9789 29.4922 69.418C29.1557 66.1103 29.1557 66.1103 28.0352 63.625C26.5234 59.7915 26.1286 55.8785 25.5625 51.8125C23.9233 38.3 23.9233 38.3 17 27C11.7018 24.3509 7.9915 26.1225 3.99999 30Z'
|
||||
fill='#1F1F1F'
|
||||
/>
|
||||
<path
|
||||
d='M89.0976 2.53906C91 3 91 3 93.4375 5.3125C96.1586 9.99276 96.178 14.1126 96.2461 19.3828C96.2778 21.1137 96.3098 22.8446 96.342 24.5754C96.3574 25.4822 96.3728 26.3889 96.3887 27.3232C96.6322 41.3036 96.9728 55.2117 98.3396 69.1353C98.9824 75.7746 99.0977 82.3308 99 89C96.5041 88.0049 94.0126 87.0053 91.5351 85.9648C90.3112 85.4563 90.3112 85.4563 89.0625 84.9375C87.8424 84.4251 87.8424 84.4251 86.5976 83.9023C83.7463 82.9119 80.9774 82.4654 78 82C76.7702 65.9379 75.7895 49.8907 75.7004 33.7775C75.6919 32.3138 75.6783 30.8501 75.6594 29.3865C75.5553 20.4082 75.6056 12.1544 80.6875 4.4375C83.6031 2.62508 85.7 2.37456 89.0976 2.53906Z'
|
||||
fill='#FBFBFB'
|
||||
/>
|
||||
<path
|
||||
d='M97 13C97.99 13.495 97.99 13.495 99 14C99.0297 15.8781 99.0297 15.8781 99.0601 17.7942C99.4473 46.9184 99.4473 46.9184 100.937 76C101.012 77.0574 101.087 78.1149 101.164 79.2043C101.646 85.1082 102.203 90.3434 105.602 95.3672C107.492 98.9262 107.45 102.194 107.375 106.125C107.366 106.881 107.356 107.638 107.346 108.417C107.18 114.639 106.185 120.152 104 126C103.636 126.996 103.273 127.993 102.898 129.02C98.2182 141.022 92.6784 149.349 80.7891 155.062C67.479 160.366 49.4234 159.559 36 155C32.4272 153.286 29.2162 151.308 26 149C24.6078 148.041 24.6078 148.041 23.1875 147.062C13.5484 137.974 10.832 124.805 9.99999 112C9.91815 101.992 10.4358 91.9898 11 82C11.33 82 11.66 82 12 82C12.0146 82.6118 12.0292 83.2236 12.0442 83.854C11.5946 115.845 11.5946 115.845 24.0625 143.875C28.854 148.273 33.89 150.868 40 153C40.6935 153.245 41.387 153.49 42.1016 153.742C56.9033 157.914 73.8284 155.325 87 148C88.3301 147.327 89.6624 146.658 91 146C91 145.34 91 144.68 91 144C91.66 144 92.32 144 93 144C100.044 130.286 105.786 114.602 104 99C102.157 94.9722 100.121 93.0631 96.3125 90.875C95.5042 90.398 94.696 89.9211 93.8633 89.4297C85.199 85.1035 78.1558 84.4842 68.5 84.3125C67.2006 84.2783 65.9012 84.2442 64.5625 84.209C61.3751 84.127 58.1879 84.0577 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.8637 87.6094 98.8637 87.6094 98.7246 86.1907C96.96 67.8915 95.697 49.7051 95.75 31.3125C95.751 30.5016 95.7521 29.6908 95.7532 28.8554C95.7901 15.4198 95.7901 15.4198 97 13Z'
|
||||
fill='#262114'
|
||||
/>
|
||||
<path
|
||||
d='M68 51C72.86 54.06 74.644 56.5072 76 62C76.249 65.2763 76.2347 68.5285 76.1875 71.8125C76.1868 72.6833 76.1862 73.554 76.1855 74.4512C76.1406 80.8594 76.1406 80.8594 75 82C73.5113 82.0867 72.0185 82.107 70.5273 82.0976C69.6282 82.0944 68.7291 82.0912 67.8027 82.0879C66.8572 82.0795 65.9117 82.0711 64.9375 82.0625C63.9881 82.058 63.0387 82.0535 62.0605 82.0488C59.707 82.037 57.3535 82.0205 55 82C53.6352 77.2188 53.738 72.5029 53.6875 67.5625C53.6585 66.6208 53.6295 65.6792 53.5996 64.709C53.5591 60.2932 53.5488 57.7378 55.8945 53.9023C59.5767 50.5754 63.1766 50.211 68 51Z'
|
||||
fill='#F8F8F8'
|
||||
/>
|
||||
<path
|
||||
d='M46 55C48.7557 57.1816 50.4359 58.8718 52 62C52.0837 63.5215 52.1073 65.0466 52.0977 66.5703C52.0944 67.4662 52.0912 68.3621 52.0879 69.2852C52.0795 70.2223 52.0711 71.1595 52.0625 72.125C52.058 73.0699 52.0535 74.0148 52.0488 74.9883C52.037 77.3256 52.0206 79.6628 52 82C50.9346 82.1992 50.9346 82.1992 49.8477 82.4023C48.9286 82.5789 48.0094 82.7555 47.0625 82.9375C46.146 83.1115 45.2294 83.2855 44.2852 83.4648C42.0471 83.7771 42.0471 83.7771 41 85C40.7692 86.3475 40.5885 87.7038 40.4375 89.0625C40.2931 90.3619 40.1487 91.6613 40 93C37 92 37 92 35.8672 90.1094C35.5398 89.3308 35.2123 88.5522 34.875 87.75C34.5424 86.9817 34.2098 86.2134 33.8672 85.4219C31.9715 80.1277 31.7884 75.065 31.75 69.5C31.7294 68.7536 31.7087 68.0073 31.6875 67.2383C31.6551 62.6607 32.0474 59.7266 35 56C38.4726 54.2637 42.2119 54.3981 46 55Z'
|
||||
fill='#FAFAFA'
|
||||
/>
|
||||
<path
|
||||
d='M97 13C97.66 13.33 98.32 13.66 99 14C99.0297 15.8781 99.0297 15.8781 99.0601 17.7942C99.4473 46.9184 99.4473 46.9184 100.937 76C101.012 77.0574 101.087 78.1149 101.164 79.2043C101.566 84.1265 102.275 88.3364 104 93C103.625 95.375 103.625 95.375 103 97C102.361 96.2781 101.721 95.5563 101.062 94.8125C94.4402 88.1902 85.5236 84.8401 76.2891 84.5859C75.0451 84.5473 73.8012 84.5086 72.5195 84.4688C71.2343 84.4378 69.9491 84.4069 68.625 84.375C66.6624 84.317 66.6624 84.317 64.6601 84.2578C61.4402 84.1638 58.2203 84.0781 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.9091 88.0729 98.8182 87.1458 98.7246 86.1907C96.96 67.8915 95.697 49.7051 95.75 31.3125C95.751 30.5016 95.7521 29.6908 95.7532 28.8554C95.7901 15.4198 95.7901 15.4198 97 13Z'
|
||||
fill='#423B28'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.3999 3.06951 96.8587 5.11957 98 9C97.625 12.25 97.625 12.25 97 15C95.804 12.6081 94.6146 10.2139 93.4375 7.8125C92.265 5.16236 92.265 5.16236 91 4C88.074 3.7122 85.8483 3.51695 83 4C79.1128 7.37574 78.178 11.0991 77 16C76.8329 18.5621 76.7615 21.1317 76.7695 23.6992C76.77 24.4155 76.7704 25.1318 76.7709 25.8698C76.7739 27.3783 76.7817 28.8868 76.7942 30.3953C76.8123 32.664 76.8147 34.9324 76.8144 37.2012C76.8329 44.6001 77.0765 51.888 77.7795 59.259C78.1413 63.7564 78.1068 68.2413 78.0625 72.75C78.058 73.6498 78.0535 74.5495 78.0488 75.4766C78.0373 77.6511 78.0193 79.8255 78 82C78.99 82.495 78.99 82.495 80 83C68.78 83.33 57.56 83.66 46 84C46.495 83.01 46.495 83.01 47 82C52.9349 80.7196 58.8909 80.8838 64.9375 80.9375C65.9075 80.942 66.8775 80.9465 67.8769 80.9512C70.2514 80.9629 72.6256 80.9793 75 81C75.0544 77.9997 75.0939 75.0005 75.125 72C75.1418 71.1608 75.1585 70.3216 75.1758 69.457C75.2185 63.9475 74.555 59.2895 73 54C73.66 54 74.32 54 75 54C74.9314 53.2211 74.8629 52.4422 74.7922 51.6396C74.1158 43.5036 73.7568 35.4131 73.6875 27.25C73.644 25.5194 73.644 25.5194 73.5996 23.7539C73.5376 15.3866 74.6189 8.85069 80.25 2.4375C83.9433 0.506911 86.9162 0.173322 91 0.999996Z'
|
||||
fill='#131311'
|
||||
/>
|
||||
<path
|
||||
d='M15 24C20.2332 26.3601 22.1726 29.3732 24.1875 34.5195C26.8667 42.6988 27.2651 50.4282 27 59C26.67 59 26.34 59 26 59C25.8945 58.436 25.7891 57.8721 25.6804 57.291C25.1901 54.6926 24.6889 52.0963 24.1875 49.5C24.0218 48.6131 23.8562 47.7262 23.6855 46.8125C21.7568 35.5689 21.7568 35.5689 15 27C12.0431 26.2498 12.0431 26.2498 8.99999 27C5.97965 28.9369 5.97965 28.9369 3.99999 32C3.67226 36.9682 4.31774 41.4911 5.27733 46.3594C5.40814 47.0304 5.53894 47.7015 5.67371 48.3929C5.94892 49.7985 6.22723 51.2035 6.50854 52.6079C6.93887 54.7569 7.35989 56.9075 7.77929 59.0586C9.09359 66.104 9.09359 66.104 11 73C11.0836 75.2109 11.1073 77.4243 11.0976 79.6367C11.0944 80.9354 11.0912 82.2342 11.0879 83.5723C11.0795 84.944 11.0711 86.3158 11.0625 87.6875C11.0575 89.071 11.0529 90.4544 11.0488 91.8379C11.037 95.2253 11.0206 98.6126 11 102C8.54975 99.5498 8.73228 98.8194 8.65624 95.4492C8.62812 94.53 8.60001 93.6108 8.57104 92.6638C8.54759 91.6816 8.52415 90.6994 8.49999 89.6875C8.20265 81.3063 7.58164 73.2485 5.99999 65C5.67135 63.2175 5.34327 61.435 5.01562 59.6523C4.31985 55.9098 3.62013 52.1681 2.90233 48.4297C2.75272 47.6484 2.60311 46.867 2.44897 46.062C1.99909 43.8187 1.99909 43.8187 0.999995 41C0.505898 36.899 0.0476353 32.7768 2.04687 29.0469C6.06003 24.1839 8.81126 23.4843 15 24Z'
|
||||
fill='#2A2311'
|
||||
/>
|
||||
<path
|
||||
d='M11 82C11.33 82 11.66 82 12 82C12.0146 82.6118 12.0292 83.2236 12.0442 83.854C11.5946 115.845 11.5946 115.845 24.0625 143.875C30.0569 149.404 36.9894 152.617 45 154C42 156 42 156 39.4375 156C29.964 153.244 20.8381 146.677 16 138C8.26993 120.062 9.92611 101.014 11 82Z'
|
||||
fill='#272214'
|
||||
/>
|
||||
<path
|
||||
d='M68 49C70.3478 50.1116 71.9703 51.3346 74 53C73.34 53.66 72.68 54.32 72 55C71.505 54.505 71.01 54.01 70.5 53.5C67.6718 51.8031 65.3662 51.5622 62.0976 51.4062C58.4026 52.4521 57.1992 53.8264 55 57C54.3826 61.2861 54.5302 65.4938 54.6875 69.8125C54.7101 70.9823 54.7326 72.1521 54.7559 73.3574C54.8147 76.2396 54.8968 79.1191 55 82C54.01 82 53.02 82 52 82C51.9854 81.4203 51.9708 80.8407 51.9558 80.2434C51.881 77.5991 51.7845 74.9561 51.6875 72.3125C51.6649 71.4005 51.6424 70.4885 51.6191 69.5488C51.4223 64.6292 51.2621 60.9548 48 57C45.6603 55.8302 44.1661 55.8339 41.5625 55.8125C40.78 55.7983 39.9976 55.7841 39.1914 55.7695C36.7079 55.8591 36.7079 55.8591 34 58C32.7955 60.5518 32.7955 60.5518 32 63C31.34 63 30.68 63 30 63C30.2839 59.6879 31.0332 57.9518 32.9375 55.1875C36.7018 52.4987 38.9555 52.3484 43.4844 52.5586C47.3251 53.2325 49.8148 54.7842 53 57C53.0928 56.1338 53.0928 56.1338 53.1875 55.25C55.6091 48.544 61.7788 47.8649 68 49Z'
|
||||
fill='#1F1A0F'
|
||||
/>
|
||||
<path
|
||||
d='M99 60C99.33 60 99.66 60 100 60C100.05 60.7865 100.1 61.573 100.152 62.3833C100.385 65.9645 100.63 69.5447 100.875 73.125C100.954 74.3625 101.032 75.6 101.113 76.875C101.197 78.0738 101.281 79.2727 101.367 80.5078C101.44 81.6075 101.514 82.7073 101.589 83.8403C102.013 87.1 102.94 89.8988 104 93C103.625 95.375 103.625 95.375 103 97C102.361 96.2781 101.721 95.5563 101.062 94.8125C94.4402 88.1902 85.5236 84.8401 76.2891 84.5859C74.4231 84.5279 74.4231 84.5279 72.5195 84.4688C71.2343 84.4378 69.9491 84.4069 68.625 84.375C67.3166 84.3363 66.0082 84.2977 64.6601 84.2578C61.4402 84.1638 58.2203 84.0781 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.9162 87.912 98.8324 86.8241 98.7461 85.7031C98.1266 77.012 97.9127 68.6814 99 60Z'
|
||||
fill='#332E22'
|
||||
/>
|
||||
<path
|
||||
d='M15 24C20.2332 26.3601 22.1726 29.3732 24.1875 34.5195C26.8667 42.6988 27.2651 50.4282 27 59C26.67 59 26.34 59 26 59C25.8945 58.436 25.7891 57.8721 25.6804 57.291C25.1901 54.6926 24.6889 52.0963 24.1875 49.5C24.0218 48.6131 23.8562 47.7262 23.6855 46.8125C21.7568 35.5689 21.7568 35.5689 15 27C12.0431 26.2498 12.0431 26.2498 8.99999 27C5.2818 29.7267 4.15499 31.2727 3.18749 35.8125C3.12562 36.8644 3.06374 37.9163 2.99999 39C2.33999 39 1.67999 39 0.999992 39C0.330349 31.2321 0.330349 31.2321 3.37499 27.5625C7.31431 23.717 9.51597 23.543 15 24Z'
|
||||
fill='#1D180A'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.3999 3.06951 96.8587 5.11957 98 9C97.625 12.25 97.625 12.25 97 15C95.804 12.6081 94.6146 10.2139 93.4375 7.8125C92.265 5.16236 92.265 5.16236 91 4C85.4345 3.33492 85.4345 3.33491 80.6875 5.75C78.5543 9.85841 77.6475 13.9354 76.7109 18.4531C76.4763 19.2936 76.2417 20.1341 76 21C75.34 21.33 74.68 21.66 74 22C73.5207 15.4102 74.5846 10.6998 78 5C81.755 0.723465 85.5463 -0.103998 91 0.999996Z'
|
||||
fill='#16130D'
|
||||
/>
|
||||
<path
|
||||
d='M42 93C42.5569 93.7631 43.1137 94.5263 43.6875 95.3125C46.4238 98.4926 48.7165 100.679 53.0105 101.282C55.3425 101.411 57.6646 101.473 60 101.5C70.6207 101.621 70.6207 101.621 75 106C75.0406 107.666 75.0427 109.334 75 111C74.34 111 73.68 111 73 111C72.7112 110.196 72.4225 109.391 72.125 108.562C71.2674 105.867 71.2674 105.867 69 105C65.3044 104.833 61.615 104.703 57.916 104.658C52.1631 104.454 48.7484 103.292 44 100C41.5625 97.25 41.5625 97.25 40 95C40.66 95 41.32 95 42 95C42 94.34 42 93.68 42 93Z'
|
||||
fill='#2B2B2B'
|
||||
/>
|
||||
<path
|
||||
d='M11 82C11.33 82 11.66 82 12 82C12.1682 86.6079 12.3287 91.216 12.4822 95.8245C12.5354 97.3909 12.5907 98.9574 12.6482 100.524C12.7306 102.78 12.8055 105.036 12.8789 107.293C12.9059 107.989 12.933 108.685 12.9608 109.402C13.0731 113.092 12.9015 116.415 12 120C11.67 120 11.34 120 11 120C9.63778 112.17 10.1119 104.4 10.4375 96.5C10.4908 95.0912 10.5436 93.6823 10.5957 92.2734C10.7247 88.8487 10.8596 85.4243 11 82Z'
|
||||
fill='#4D483B'
|
||||
/>
|
||||
<path
|
||||
d='M43.4844 52.5586C47.3251 53.2325 49.8148 54.7842 53 57C52 59 52 59 50 60C49.5256 59.34 49.0512 58.68 48.5625 58C45.2656 55.4268 43.184 55.5955 39.1211 55.6641C36.7043 55.8955 36.7043 55.8955 34 58C32.7955 60.5518 32.7955 60.5518 32 63C31.34 63 30.68 63 30 63C30.2839 59.6879 31.0332 57.9518 32.9375 55.1875C36.7018 52.4987 38.9555 52.3484 43.4844 52.5586Z'
|
||||
fill='#221F16'
|
||||
/>
|
||||
<path
|
||||
d='M76 73C76.33 73 76.66 73 77 73C77 75.97 77 78.94 77 82C78.485 82.495 78.485 82.495 80 83C68.78 83.33 57.56 83.66 46 84C46.33 83.34 46.66 82.68 47 82C52.9349 80.7196 58.8909 80.8838 64.9375 80.9375C65.9075 80.942 66.8775 80.9465 67.8769 80.9512C70.2514 80.9629 72.6256 80.9793 75 81C75.33 78.36 75.66 75.72 76 73Z'
|
||||
fill='#040404'
|
||||
/>
|
||||
<path
|
||||
d='M27 54C27.33 54 27.66 54 28 54C28.33 56.97 28.66 59.94 29 63C29.99 63 30.98 63 32 63C32 66.96 32 70.92 32 75C31.01 74.67 30.02 74.34 29 74C28.8672 73.2523 28.7344 72.5047 28.5977 71.7344C28.421 70.7495 28.2444 69.7647 28.0625 68.75C27.8885 67.7755 27.7144 66.8009 27.5352 65.7969C27.0533 63.087 27.0533 63.087 26.4062 60.8125C25.8547 58.3515 26.3956 56.4176 27 54Z'
|
||||
fill='#434039'
|
||||
/>
|
||||
<path
|
||||
d='M78 5C78.99 5.33 79.98 5.66 81 6C80.3194 6.92812 80.3194 6.92812 79.625 7.875C77.7233 11.532 77.1555 14.8461 76.5273 18.8906C76.3533 19.5867 76.1793 20.2828 76 21C75.34 21.33 74.68 21.66 74 22C73.5126 15.2987 74.9229 10.9344 78 5Z'
|
||||
fill='#2A2313'
|
||||
/>
|
||||
<path
|
||||
d='M12 115C12.99 115.495 12.99 115.495 14 116C14.5334 118.483 14.9326 120.864 15.25 123.375C15.3531 124.061 15.4562 124.747 15.5625 125.453C16.0763 129.337 16.2441 130.634 14 134C12.6761 127.57 11.752 121.571 12 115Z'
|
||||
fill='#2F2C22'
|
||||
/>
|
||||
<path
|
||||
d='M104 95C107 98 107 98 107.363 101.031C107.347 102.176 107.33 103.321 107.312 104.5C107.309 105.645 107.305 106.789 107.301 107.969C107 111 107 111 105 114C104.67 107.73 104.34 101.46 104 95Z'
|
||||
fill='#120F05'
|
||||
/>
|
||||
<path
|
||||
d='M56 103C58.6048 102.919 61.2071 102.86 63.8125 102.812C64.5505 102.787 65.2885 102.762 66.0488 102.736C71.4975 102.662 71.4975 102.662 74 104.344C75.374 106.619 75.2112 108.396 75 111C74.34 111 73.68 111 73 111C72.7112 110.196 72.4225 109.391 72.125 108.562C71.2674 105.867 71.2674 105.867 69 105C66.7956 104.77 64.5861 104.589 62.375 104.438C61.1865 104.354 59.998 104.27 58.7734 104.184C57.4006 104.093 57.4006 104.093 56 104C56 103.67 56 103.34 56 103Z'
|
||||
fill='#101010'
|
||||
/>
|
||||
<path
|
||||
d='M23 40C23.66 40 24.32 40 25 40C27.3084 46.3482 27.1982 52.2948 27 59C26.67 59 26.34 59 26 59C25.01 52.73 24.02 46.46 23 40Z'
|
||||
fill='#191409'
|
||||
/>
|
||||
<path
|
||||
d='M47 83C46.3606 83.3094 45.7212 83.6187 45.0625 83.9375C41.9023 87.0977 42.181 90.6833 42 95C41.01 94.67 40.02 94.34 39 94C39.3463 85.7409 39.3463 85.7409 41.875 82.875C44 82 44 82 47 83Z'
|
||||
fill='#171717'
|
||||
/>
|
||||
<path
|
||||
d='M53 61C53.33 61 53.66 61 54 61C54.33 67.93 54.66 74.86 55 82C54.01 82 53.02 82 52 82C52.33 75.07 52.66 68.14 53 61Z'
|
||||
fill='#444444'
|
||||
/>
|
||||
<path
|
||||
d='M81 154C78.6696 156.33 77.8129 156.39 74.625 156.75C73.4687 156.897 73.4687 156.897 72.2891 157.047C69.6838 156.994 68.2195 156.317 66 155C67.7478 154.635 69.4984 154.284 71.25 153.938C72.7118 153.642 72.7118 153.642 74.2031 153.34C76.8681 153.016 78.4887 153.145 81 154Z'
|
||||
fill='#332F23'
|
||||
/>
|
||||
<path
|
||||
d='M19 28C19.66 28 20.32 28 21 28C21.6735 29.4343 22.3386 30.8726 23 32.3125C23.5569 33.5133 23.5569 33.5133 24.125 34.7383C25 37 25 37 25 40C22 39 22 39 21.0508 37.2578C20.8071 36.554 20.5635 35.8502 20.3125 35.125C20.0611 34.4263 19.8098 33.7277 19.5508 33.0078C19 31 19 31 19 28Z'
|
||||
fill='#282213'
|
||||
/>
|
||||
<path
|
||||
d='M102 87C104.429 93.2857 104.429 93.2857 103 97C100.437 94.75 100.437 94.75 98 92C98.0625 89.75 98.0625 89.75 99 88C101 87 101 87 102 87Z'
|
||||
fill='#37301F'
|
||||
/>
|
||||
<path
|
||||
d='M53 56C53.33 56 53.66 56 54 56C53.67 62.27 53.34 68.54 53 75C52.67 75 52.34 75 52 75C51.7788 72.2088 51.5726 69.4179 51.375 66.625C51.3105 65.8309 51.2461 65.0369 51.1797 64.2188C51.0394 62.1497 51.0124 60.0737 51 58C51.66 57.34 52.32 56.68 53 56Z'
|
||||
fill='#030303'
|
||||
/>
|
||||
<path
|
||||
d='M100 129C100.33 129 100.66 129 101 129C100.532 133.776 99.7567 137.045 97 141C96.34 140.67 95.68 140.34 95 140C96.65 136.37 98.3 132.74 100 129Z'
|
||||
fill='#1E1A12'
|
||||
/>
|
||||
<path
|
||||
d='M15 131C17.7061 132.353 17.9618 133.81 19.125 136.562C19.4782 137.389 19.8314 138.215 20.1953 139.066C20.4609 139.704 20.7264 140.343 21 141C20.01 141 19.02 141 18 141C15.9656 137.27 15 135.331 15 131Z'
|
||||
fill='#1C1912'
|
||||
/>
|
||||
<path
|
||||
d='M63 49C69.4 49.4923 69.4 49.4923 72.4375 52.0625C73.2109 53.0216 73.2109 53.0216 74 54C70.8039 54 69.5828 53.4533 66.8125 52C66.0971 51.6288 65.3816 51.2575 64.6445 50.875C64.1018 50.5863 63.5591 50.2975 63 50C63 49.67 63 49.34 63 49Z'
|
||||
fill='#13110C'
|
||||
/>
|
||||
<path
|
||||
d='M0.999992 39C1.98999 39 2.97999 39 3.99999 39C5.24999 46.625 5.24999 46.625 2.99999 50C2.33999 46.37 1.67999 42.74 0.999992 39Z'
|
||||
fill='#312C1E'
|
||||
/>
|
||||
<path
|
||||
d='M94 5C94.66 5 95.32 5 96 5C97.8041 7.75924 98.0127 8.88972 97.625 12.25C97.4187 13.1575 97.2125 14.065 97 15C95.1161 11.7345 94.5071 8.71888 94 5Z'
|
||||
fill='#292417'
|
||||
/>
|
||||
<path
|
||||
d='M20 141C23.3672 142.393 24.9859 143.979 27 147C24.625 146.812 24.625 146.812 22 146C20.6875 143.438 20.6875 143.438 20 141Z'
|
||||
fill='#373328'
|
||||
/>
|
||||
<path
|
||||
d='M86 83C86.33 83.99 86.66 84.98 87 86C83.37 85.34 79.74 84.68 76 84C80.3553 81.8223 81.4663 81.9696 86 83Z'
|
||||
fill='#2F2F2F'
|
||||
/>
|
||||
<path
|
||||
d='M42 93C46 97.625 46 97.625 46 101C44.02 99.35 42.04 97.7 40 96C40.66 95.67 41.32 95.34 42 95C42 94.34 42 93.68 42 93Z'
|
||||
fill='#232323'
|
||||
/>
|
||||
<path
|
||||
d='M34 55C34.66 55.33 35.32 55.66 36 56C35.5256 56.7838 35.0512 57.5675 34.5625 58.375C33.661 59.8895 32.7882 61.4236 32 63C31.34 63 30.68 63 30 63C30.4983 59.3125 31.1007 57.3951 34 55Z'
|
||||
fill='#110F0A'
|
||||
/>
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
[Stagehand](https://stagehand.com) is a tool that allows you to extract structured data from webpages using Browserbase and OpenAI.
|
||||
|
||||
With Stagehand, you can:
|
||||
|
||||
- **Extract structured data**: Extract structured data from webpages using Browserbase and OpenAI
|
||||
- **Save data to a database**: Save the extracted data to a database
|
||||
- **Automate workflows**: Automate workflows to extract data from webpages
|
||||
|
||||
In Sim, the Stagehand integration enables your agents to extract structured data from webpages using Browserbase and OpenAI. This allows for powerful automation scenarios such as data extraction, data analysis, and data integration. Your agents can extract structured data from webpages, save the extracted data to a database, and automate workflows to extract data from webpages. This integration bridges the gap between your AI workflows and your data management system, enabling seamless data extraction and integration. By connecting Sim with Stagehand, you can automate data extraction processes, maintain up-to-date information repositories, generate reports, and organize information intelligently - all through your intelligent agents.
|
||||
{/* MANUAL-CONTENT-END */}
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Stagehand into the workflow. Can extract structured data from webpages.
|
||||
|
||||
## Tools
|
||||
|
||||
### `stagehand_extract`
|
||||
|
||||
Extract structured data from a webpage using Stagehand
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `url` | string | Yes | URL of the webpage to extract data from |
|
||||
| `instruction` | string | Yes | Instructions for extraction |
|
||||
| `apiKey` | string | Yes | OpenAI API key for extraction \(required by Stagehand\) |
|
||||
| `schema` | json | Yes | JSON schema defining the structure of the data to extract |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `data` | object | Extracted structured data matching the provided schema |
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `stagehand`
|
||||
225
apps/docs/content/docs/de/tools/stagehand_agent.mdx
Normal file
225
apps/docs/content/docs/de/tools/stagehand_agent.mdx
Normal file
@@ -0,0 +1,225 @@
|
||||
---
|
||||
title: Stagehand Agent
|
||||
description: Autonomous web browsing agent
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="stagehand_agent"
|
||||
color="#FFC83C"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
|
||||
|
||||
viewBox='0 0 108 159'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<path
|
||||
d='M15 26C22.8234 31.822 23.619 41.405 25.3125 50.3867C25.8461 53.1914 26.4211 55.9689 27.0625 58.75C27.7987 61.9868 28.4177 65.2319 29 68.5C29.332 70.3336 29.6653 72.1669 30 74C30.1418 74.7863 30.2836 75.5727 30.4297 76.3828C31.8011 83.2882 33.3851 90.5397 39.4375 94.75C40.3405 95.3069 40.3405 95.3069 41.2617 95.875C43.8517 97.5512 45.826 99.826 48 102C50.6705 102.89 52.3407 103.143 55.0898 103.211C55.8742 103.239 56.6586 103.268 57.4668 103.297C59.1098 103.349 60.7531 103.393 62.3965 103.43C65.8896 103.567 68.4123 103.705 71.5664 105.289C73 107 73 107 73 111C73.66 111 74.32 111 75 111C74.0759 106.912 74.0759 106.912 71.4766 103.828C67.0509 102.348 62.3634 102.64 57.7305 102.609C52.3632 102.449 49.2783 101.537 45 98C41.8212 94.0795 41.5303 90.9791 42 86C44.9846 83.0154 48.2994 83.6556 52.3047 83.6289C53.139 83.6199 53.9734 83.6108 54.833 83.6015C56.6067 83.587 58.3805 83.5782 60.1543 83.5745C62.8304 83.5627 65.5041 83.5137 68.1797 83.4629C81.1788 83.34 91.8042 85.3227 102 94C106.37 100.042 105.483 106.273 104.754 113.406C103.821 119.026 101.968 124.375 100.125 129.75C99.8806 130.471 99.6361 131.193 99.3843 131.936C97.7783 136.447 95.9466 140.206 93 144C92.34 144 91.68 144 91 144C91 144.66 91 145.32 91 146C79.0816 156.115 63.9798 156.979 49 156C36.6394 154.226 26.7567 148.879 19 139C11.0548 125.712 11.6846 105.465 11.3782 90.4719C11.0579 77.4745 8.03411 64.8142 5.4536 52.1135C5.04373 50.0912 4.64233 48.0673 4.24218 46.043C4.00354 44.8573 3.7649 43.6716 3.51903 42.45C2.14425 33.3121 2.14425 33.3121 4.87499 29.125C8.18297 25.817 10.3605 25.4542 15 26Z'
|
||||
fill='#FDFDFD'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.8466 2.96604 96.2332 5.08365 97.6091 9.03564C99.203 14.0664 99.4412 18.7459 99.4414 23.9922C99.4538 24.9285 99.4663 25.8647 99.4791 26.8294C99.5049 28.8198 99.5247 30.8103 99.539 32.8008C99.5785 37.9693 99.6682 43.1369 99.7578 48.3047C99.7747 49.3188 99.7917 50.3328 99.8091 51.3776C99.9603 59.6066 100.323 67.7921 100.937 76C101.012 77.0582 101.087 78.1163 101.164 79.2065C101.646 85.1097 102.203 90.3442 105.602 95.3672C107.492 98.9262 107.45 102.194 107.375 106.125C107.366 106.881 107.356 107.638 107.346 108.417C107.18 114.639 106.185 120.152 104 126C103.636 126.996 103.273 127.993 102.898 129.02C98.2182 141.022 92.6784 149.349 80.7891 155.062C67.479 160.366 49.4234 159.559 36 155C32.4272 153.286 29.2162 151.308 26 149C25.0719 148.361 24.1437 147.721 23.1875 147.062C8.32968 133.054 9.60387 109.231 8.73413 90.3208C8.32766 81.776 7.51814 73.4295 5.99999 65C5.82831 64.0338 5.65662 63.0675 5.47973 62.072C4.98196 59.3363 4.46395 56.6053 3.93749 53.875C3.76412 52.9572 3.59074 52.0394 3.4121 51.0938C2.75101 47.6388 2.11387 44.3416 0.999995 41C0.505898 36.899 0.0476353 32.7768 2.04687 29.0469C4.91881 25.5668 6.78357 24.117 11.25 23.6875C15.8364 24.0697 17.5999 24.9021 21 28C24.7763 34.3881 26.047 41.2626 27.1875 48.5C27.5111 50.4693 27.8377 52.4381 28.168 54.4062C28.3733 55.695 28.3733 55.695 28.5828 57.0098C28.8087 58.991 28.8087 58.991 30 60C30.3171 59.4947 30.6342 58.9894 30.9609 58.4688C33.1122 55.4736 34.7097 53.3284 38.3789 52.3945C44.352 52.203 48.1389 53.6183 53 57C53.0928 56.1338 53.0928 56.1338 53.1875 55.25C54.4089 51.8676 55.9015 50.8075 59 49C63.8651 48.104 66.9348 48.3122 71.1487 51.0332C72.0896 51.6822 73.0305 52.3313 74 53C73.9686 51.2986 73.9686 51.2986 73.9365 49.5627C73.8636 45.3192 73.818 41.0758 73.7803 36.8318C73.7603 35.0016 73.733 33.1715 73.6982 31.3415C73.6492 28.6976 73.6269 26.0545 73.6094 23.4102C73.5887 22.6035 73.5681 21.7969 73.5468 20.9658C73.5441 13.8444 75.5121 7.83341 80.25 2.4375C83.9645 0.495841 86.8954 0.209055 91 0.999996ZM3.99999 30C1.56925 34.8615 3.215 40.9393 4.24218 46.043C4.37061 46.6927 4.49905 47.3424 4.63137 48.0118C5.03968 50.0717 5.45687 52.1296 5.87499 54.1875C11.1768 80.6177 11.1768 80.6177 11.4375 93.375C11.7542 120.78 11.7542 120.78 23.5625 144.375C28.5565 149.002 33.5798 151.815 40 154C40.6922 154.244 41.3844 154.487 42.0977 154.738C55.6463 158.576 72.4909 156.79 84.8086 150.316C87.0103 148.994 89.0458 147.669 91 146C91 145.34 91 144.68 91 144C91.66 144 92.32 144 93 144C97.1202 138.98 99.3206 133.053 101.25 126.937C101.505 126.174 101.76 125.41 102.023 124.623C104.94 115.65 107.293 104.629 103.625 95.625C96.3369 88.3369 86.5231 83.6919 76.1988 83.6088C74.9905 83.6226 74.9905 83.6226 73.7578 83.6367C72.9082 83.6362 72.0586 83.6357 71.1833 83.6352C69.4034 83.6375 67.6235 83.6472 65.8437 83.6638C63.1117 83.6876 60.3806 83.6843 57.6484 83.6777C55.9141 83.6833 54.1797 83.6904 52.4453 83.6992C51.6277 83.6983 50.81 83.6974 49.9676 83.6964C45.5122 83.571 45.5122 83.571 42 86C41.517 90.1855 41.733 92.4858 43.6875 96.25C46.4096 99.4871 48.6807 101.674 53.0105 102.282C55.3425 102.411 57.6645 102.473 60 102.5C69.8847 102.612 69.8847 102.612 74 106C74.8125 108.687 74.8125 108.688 75 111C74.34 111 73.68 111 73 111C72.8969 110.216 72.7937 109.432 72.6875 108.625C72.224 105.67 72.224 105.67 69 104C65.2788 103.745 61.5953 103.634 57.8672 103.609C51.1596 103.409 46.859 101.691 41.875 97C41.2562 96.34 40.6375 95.68 40 95C39.175 94.4637 38.35 93.9275 37.5 93.375C30.9449 87.1477 30.3616 77.9789 29.4922 69.418C29.1557 66.1103 29.1557 66.1103 28.0352 63.625C26.5234 59.7915 26.1286 55.8785 25.5625 51.8125C23.9233 38.3 23.9233 38.3 17 27C11.7018 24.3509 7.9915 26.1225 3.99999 30Z'
|
||||
fill='#1F1F1F'
|
||||
/>
|
||||
<path
|
||||
d='M89.0976 2.53906C91 3 91 3 93.4375 5.3125C96.1586 9.99276 96.178 14.1126 96.2461 19.3828C96.2778 21.1137 96.3098 22.8446 96.342 24.5754C96.3574 25.4822 96.3728 26.3889 96.3887 27.3232C96.6322 41.3036 96.9728 55.2117 98.3396 69.1353C98.9824 75.7746 99.0977 82.3308 99 89C96.5041 88.0049 94.0126 87.0053 91.5351 85.9648C90.3112 85.4563 90.3112 85.4563 89.0625 84.9375C87.8424 84.4251 87.8424 84.4251 86.5976 83.9023C83.7463 82.9119 80.9774 82.4654 78 82C76.7702 65.9379 75.7895 49.8907 75.7004 33.7775C75.6919 32.3138 75.6783 30.8501 75.6594 29.3865C75.5553 20.4082 75.6056 12.1544 80.6875 4.4375C83.6031 2.62508 85.7 2.37456 89.0976 2.53906Z'
|
||||
fill='#FBFBFB'
|
||||
/>
|
||||
<path
|
||||
d='M97 13C97.99 13.495 97.99 13.495 99 14C99.0297 15.8781 99.0297 15.8781 99.0601 17.7942C99.4473 46.9184 99.4473 46.9184 100.937 76C101.012 77.0574 101.087 78.1149 101.164 79.2043C101.646 85.1082 102.203 90.3434 105.602 95.3672C107.492 98.9262 107.45 102.194 107.375 106.125C107.366 106.881 107.356 107.638 107.346 108.417C107.18 114.639 106.185 120.152 104 126C103.636 126.996 103.273 127.993 102.898 129.02C98.2182 141.022 92.6784 149.349 80.7891 155.062C67.479 160.366 49.4234 159.559 36 155C32.4272 153.286 29.2162 151.308 26 149C24.6078 148.041 24.6078 148.041 23.1875 147.062C13.5484 137.974 10.832 124.805 9.99999 112C9.91815 101.992 10.4358 91.9898 11 82C11.33 82 11.66 82 12 82C12.0146 82.6118 12.0292 83.2236 12.0442 83.854C11.5946 115.845 11.5946 115.845 24.0625 143.875C28.854 148.273 33.89 150.868 40 153C40.6935 153.245 41.387 153.49 42.1016 153.742C56.9033 157.914 73.8284 155.325 87 148C88.3301 147.327 89.6624 146.658 91 146C91 145.34 91 144.68 91 144C91.66 144 92.32 144 93 144C100.044 130.286 105.786 114.602 104 99C102.157 94.9722 100.121 93.0631 96.3125 90.875C95.5042 90.398 94.696 89.9211 93.8633 89.4297C85.199 85.1035 78.1558 84.4842 68.5 84.3125C67.2006 84.2783 65.9012 84.2442 64.5625 84.209C61.3751 84.127 58.1879 84.0577 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.8637 87.6094 98.8637 87.6094 98.7246 86.1907C96.96 67.8915 95.697 49.7051 95.75 31.3125C95.751 30.5016 95.7521 29.6908 95.7532 28.8554C95.7901 15.4198 95.7901 15.4198 97 13Z'
|
||||
fill='#262114'
|
||||
/>
|
||||
<path
|
||||
d='M68 51C72.86 54.06 74.644 56.5072 76 62C76.249 65.2763 76.2347 68.5285 76.1875 71.8125C76.1868 72.6833 76.1862 73.554 76.1855 74.4512C76.1406 80.8594 76.1406 80.8594 75 82C73.5113 82.0867 72.0185 82.107 70.5273 82.0976C69.6282 82.0944 68.7291 82.0912 67.8027 82.0879C66.8572 82.0795 65.9117 82.0711 64.9375 82.0625C63.9881 82.058 63.0387 82.0535 62.0605 82.0488C59.707 82.037 57.3535 82.0205 55 82C53.6352 77.2188 53.738 72.5029 53.6875 67.5625C53.6585 66.6208 53.6295 65.6792 53.5996 64.709C53.5591 60.2932 53.5488 57.7378 55.8945 53.9023C59.5767 50.5754 63.1766 50.211 68 51Z'
|
||||
fill='#F8F8F8'
|
||||
/>
|
||||
<path
|
||||
d='M46 55C48.7557 57.1816 50.4359 58.8718 52 62C52.0837 63.5215 52.1073 65.0466 52.0977 66.5703C52.0944 67.4662 52.0912 68.3621 52.0879 69.2852C52.0795 70.2223 52.0711 71.1595 52.0625 72.125C52.058 73.0699 52.0535 74.0148 52.0488 74.9883C52.037 77.3256 52.0206 79.6628 52 82C50.9346 82.1992 50.9346 82.1992 49.8477 82.4023C48.9286 82.5789 48.0094 82.7555 47.0625 82.9375C46.146 83.1115 45.2294 83.2855 44.2852 83.4648C42.0471 83.7771 42.0471 83.7771 41 85C40.7692 86.3475 40.5885 87.7038 40.4375 89.0625C40.2931 90.3619 40.1487 91.6613 40 93C37 92 37 92 35.8672 90.1094C35.5398 89.3308 35.2123 88.5522 34.875 87.75C34.5424 86.9817 34.2098 86.2134 33.8672 85.4219C31.9715 80.1277 31.7884 75.065 31.75 69.5C31.7294 68.7536 31.7087 68.0073 31.6875 67.2383C31.6551 62.6607 32.0474 59.7266 35 56C38.4726 54.2637 42.2119 54.3981 46 55Z'
|
||||
fill='#FAFAFA'
|
||||
/>
|
||||
<path
|
||||
d='M97 13C97.66 13.33 98.32 13.66 99 14C99.0297 15.8781 99.0297 15.8781 99.0601 17.7942C99.4473 46.9184 99.4473 46.9184 100.937 76C101.012 77.0574 101.087 78.1149 101.164 79.2043C101.566 84.1265 102.275 88.3364 104 93C103.625 95.375 103.625 95.375 103 97C102.361 96.2781 101.721 95.5563 101.062 94.8125C94.4402 88.1902 85.5236 84.8401 76.2891 84.5859C75.0451 84.5473 73.8012 84.5086 72.5195 84.4688C71.2343 84.4378 69.9491 84.4069 68.625 84.375C66.6624 84.317 66.6624 84.317 64.6601 84.2578C61.4402 84.1638 58.2203 84.0781 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.9091 88.0729 98.8182 87.1458 98.7246 86.1907C96.96 67.8915 95.697 49.7051 95.75 31.3125C95.751 30.5016 95.7521 29.6908 95.7532 28.8554C95.7901 15.4198 95.7901 15.4198 97 13Z'
|
||||
fill='#423B28'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.3999 3.06951 96.8587 5.11957 98 9C97.625 12.25 97.625 12.25 97 15C95.804 12.6081 94.6146 10.2139 93.4375 7.8125C92.265 5.16236 92.265 5.16236 91 4C88.074 3.7122 85.8483 3.51695 83 4C79.1128 7.37574 78.178 11.0991 77 16C76.8329 18.5621 76.7615 21.1317 76.7695 23.6992C76.77 24.4155 76.7704 25.1318 76.7709 25.8698C76.7739 27.3783 76.7817 28.8868 76.7942 30.3953C76.8123 32.664 76.8147 34.9324 76.8144 37.2012C76.8329 44.6001 77.0765 51.888 77.7795 59.259C78.1413 63.7564 78.1068 68.2413 78.0625 72.75C78.058 73.6498 78.0535 74.5495 78.0488 75.4766C78.0373 77.6511 78.0193 79.8255 78 82C78.99 82.495 78.99 82.495 80 83C68.78 83.33 57.56 83.66 46 84C46.495 83.01 46.495 83.01 47 82C52.9349 80.7196 58.8909 80.8838 64.9375 80.9375C65.9075 80.942 66.8775 80.9465 67.8769 80.9512C70.2514 80.9629 72.6256 80.9793 75 81C75.0544 77.9997 75.0939 75.0005 75.125 72C75.1418 71.1608 75.1585 70.3216 75.1758 69.457C75.2185 63.9475 74.555 59.2895 73 54C73.66 54 74.32 54 75 54C74.9314 53.2211 74.8629 52.4422 74.7922 51.6396C74.1158 43.5036 73.7568 35.4131 73.6875 27.25C73.644 25.5194 73.644 25.5194 73.5996 23.7539C73.5376 15.3866 74.6189 8.85069 80.25 2.4375C83.9433 0.506911 86.9162 0.173322 91 0.999996Z'
|
||||
fill='#131311'
|
||||
/>
|
||||
<path
|
||||
d='M15 24C20.2332 26.3601 22.1726 29.3732 24.1875 34.5195C26.8667 42.6988 27.2651 50.4282 27 59C26.67 59 26.34 59 26 59C25.8945 58.436 25.7891 57.8721 25.6804 57.291C25.1901 54.6926 24.6889 52.0963 24.1875 49.5C24.0218 48.6131 23.8562 47.7262 23.6855 46.8125C21.7568 35.5689 21.7568 35.5689 15 27C12.0431 26.2498 12.0431 26.2498 8.99999 27C5.97965 28.9369 5.97965 28.9369 3.99999 32C3.67226 36.9682 4.31774 41.4911 5.27733 46.3594C5.40814 47.0304 5.53894 47.7015 5.67371 48.3929C5.94892 49.7985 6.22723 51.2035 6.50854 52.6079C6.93887 54.7569 7.35989 56.9075 7.77929 59.0586C9.09359 66.104 9.09359 66.104 11 73C11.0836 75.2109 11.1073 77.4243 11.0976 79.6367C11.0944 80.9354 11.0912 82.2342 11.0879 83.5723C11.0795 84.944 11.0711 86.3158 11.0625 87.6875C11.0575 89.071 11.0529 90.4544 11.0488 91.8379C11.037 95.2253 11.0206 98.6126 11 102C8.54975 99.5498 8.73228 98.8194 8.65624 95.4492C8.62812 94.53 8.60001 93.6108 8.57104 92.6638C8.54759 91.6816 8.52415 90.6994 8.49999 89.6875C8.20265 81.3063 7.58164 73.2485 5.99999 65C5.67135 63.2175 5.34327 61.435 5.01562 59.6523C4.31985 55.9098 3.62013 52.1681 2.90233 48.4297C2.75272 47.6484 2.60311 46.867 2.44897 46.062C1.99909 43.8187 1.99909 43.8187 0.999995 41C0.505898 36.899 0.0476353 32.7768 2.04687 29.0469C6.06003 24.1839 8.81126 23.4843 15 24Z'
|
||||
fill='#2A2311'
|
||||
/>
|
||||
<path
|
||||
d='M11 82C11.33 82 11.66 82 12 82C12.0146 82.6118 12.0292 83.2236 12.0442 83.854C11.5946 115.845 11.5946 115.845 24.0625 143.875C30.0569 149.404 36.9894 152.617 45 154C42 156 42 156 39.4375 156C29.964 153.244 20.8381 146.677 16 138C8.26993 120.062 9.92611 101.014 11 82Z'
|
||||
fill='#272214'
|
||||
/>
|
||||
<path
|
||||
d='M68 49C70.3478 50.1116 71.9703 51.3346 74 53C73.34 53.66 72.68 54.32 72 55C71.505 54.505 71.01 54.01 70.5 53.5C67.6718 51.8031 65.3662 51.5622 62.0976 51.4062C58.4026 52.4521 57.1992 53.8264 55 57C54.3826 61.2861 54.5302 65.4938 54.6875 69.8125C54.7101 70.9823 54.7326 72.1521 54.7559 73.3574C54.8147 76.2396 54.8968 79.1191 55 82C54.01 82 53.02 82 52 82C51.9854 81.4203 51.9708 80.8407 51.9558 80.2434C51.881 77.5991 51.7845 74.9561 51.6875 72.3125C51.6649 71.4005 51.6424 70.4885 51.6191 69.5488C51.4223 64.6292 51.2621 60.9548 48 57C45.6603 55.8302 44.1661 55.8339 41.5625 55.8125C40.78 55.7983 39.9976 55.7841 39.1914 55.7695C36.7079 55.8591 36.7079 55.8591 34 58C32.7955 60.5518 32.7955 60.5518 32 63C31.34 63 30.68 63 30 63C30.2839 59.6879 31.0332 57.9518 32.9375 55.1875C36.7018 52.4987 38.9555 52.3484 43.4844 52.5586C47.3251 53.2325 49.8148 54.7842 53 57C53.0928 56.1338 53.0928 56.1338 53.1875 55.25C55.6091 48.544 61.7788 47.8649 68 49Z'
|
||||
fill='#1F1A0F'
|
||||
/>
|
||||
<path
|
||||
d='M99 60C99.33 60 99.66 60 100 60C100.05 60.7865 100.1 61.573 100.152 62.3833C100.385 65.9645 100.63 69.5447 100.875 73.125C100.954 74.3625 101.032 75.6 101.113 76.875C101.197 78.0738 101.281 79.2727 101.367 80.5078C101.44 81.6075 101.514 82.7073 101.589 83.8403C102.013 87.1 102.94 89.8988 104 93C103.625 95.375 103.625 95.375 103 97C102.361 96.2781 101.721 95.5563 101.062 94.8125C94.4402 88.1902 85.5236 84.8401 76.2891 84.5859C74.4231 84.5279 74.4231 84.5279 72.5195 84.4688C71.2343 84.4378 69.9491 84.4069 68.625 84.375C67.3166 84.3363 66.0082 84.2977 64.6601 84.2578C61.4402 84.1638 58.2203 84.0781 55 84C55 83.67 55 83.34 55 83C58.9087 82.7294 62.8179 82.4974 66.7309 82.2981C68.7007 82.1902 70.6688 82.0535 72.6367 81.916C82.854 81.4233 90.4653 83.3102 99 89C98.9162 87.912 98.8324 86.8241 98.7461 85.7031C98.1266 77.012 97.9127 68.6814 99 60Z'
|
||||
fill='#332E22'
|
||||
/>
|
||||
<path
|
||||
d='M15 24C20.2332 26.3601 22.1726 29.3732 24.1875 34.5195C26.8667 42.6988 27.2651 50.4282 27 59C26.67 59 26.34 59 26 59C25.8945 58.436 25.7891 57.8721 25.6804 57.291C25.1901 54.6926 24.6889 52.0963 24.1875 49.5C24.0218 48.6131 23.8562 47.7262 23.6855 46.8125C21.7568 35.5689 21.7568 35.5689 15 27C12.0431 26.2498 12.0431 26.2498 8.99999 27C5.2818 29.7267 4.15499 31.2727 3.18749 35.8125C3.12562 36.8644 3.06374 37.9163 2.99999 39C2.33999 39 1.67999 39 0.999992 39C0.330349 31.2321 0.330349 31.2321 3.37499 27.5625C7.31431 23.717 9.51597 23.543 15 24Z'
|
||||
fill='#1D180A'
|
||||
/>
|
||||
<path
|
||||
d='M91 0.999996C94.3999 3.06951 96.8587 5.11957 98 9C97.625 12.25 97.625 12.25 97 15C95.804 12.6081 94.6146 10.2139 93.4375 7.8125C92.265 5.16236 92.265 5.16236 91 4C85.4345 3.33492 85.4345 3.33491 80.6875 5.75C78.5543 9.85841 77.6475 13.9354 76.7109 18.4531C76.4763 19.2936 76.2417 20.1341 76 21C75.34 21.33 74.68 21.66 74 22C73.5207 15.4102 74.5846 10.6998 78 5C81.755 0.723465 85.5463 -0.103998 91 0.999996Z'
|
||||
fill='#16130D'
|
||||
/>
|
||||
<path
|
||||
d='M42 93C42.5569 93.7631 43.1137 94.5263 43.6875 95.3125C46.4238 98.4926 48.7165 100.679 53.0105 101.282C55.3425 101.411 57.6646 101.473 60 101.5C70.6207 101.621 70.6207 101.621 75 106C75.0406 107.666 75.0427 109.334 75 111C74.34 111 73.68 111 73 111C72.7112 110.196 72.4225 109.391 72.125 108.562C71.2674 105.867 71.2674 105.867 69 105C65.3044 104.833 61.615 104.703 57.916 104.658C52.1631 104.454 48.7484 103.292 44 100C41.5625 97.25 41.5625 97.25 40 95C40.66 95 41.32 95 42 95C42 94.34 42 93.68 42 93Z'
|
||||
fill='#2B2B2B'
|
||||
/>
|
||||
<path
|
||||
d='M11 82C11.33 82 11.66 82 12 82C12.1682 86.6079 12.3287 91.216 12.4822 95.8245C12.5354 97.3909 12.5907 98.9574 12.6482 100.524C12.7306 102.78 12.8055 105.036 12.8789 107.293C12.9059 107.989 12.933 108.685 12.9608 109.402C13.0731 113.092 12.9015 116.415 12 120C11.67 120 11.34 120 11 120C9.63778 112.17 10.1119 104.4 10.4375 96.5C10.4908 95.0912 10.5436 93.6823 10.5957 92.2734C10.7247 88.8487 10.8596 85.4243 11 82Z'
|
||||
fill='#4D483B'
|
||||
/>
|
||||
<path
|
||||
d='M43.4844 52.5586C47.3251 53.2325 49.8148 54.7842 53 57C52 59 52 59 50 60C49.5256 59.34 49.0512 58.68 48.5625 58C45.2656 55.4268 43.184 55.5955 39.1211 55.6641C36.7043 55.8955 36.7043 55.8955 34 58C32.7955 60.5518 32.7955 60.5518 32 63C31.34 63 30.68 63 30 63C30.2839 59.6879 31.0332 57.9518 32.9375 55.1875C36.7018 52.4987 38.9555 52.3484 43.4844 52.5586Z'
|
||||
fill='#221F16'
|
||||
/>
|
||||
<path
|
||||
d='M76 73C76.33 73 76.66 73 77 73C77 75.97 77 78.94 77 82C78.485 82.495 78.485 82.495 80 83C68.78 83.33 57.56 83.66 46 84C46.33 83.34 46.66 82.68 47 82C52.9349 80.7196 58.8909 80.8838 64.9375 80.9375C65.9075 80.942 66.8775 80.9465 67.8769 80.9512C70.2514 80.9629 72.6256 80.9793 75 81C75.33 78.36 75.66 75.72 76 73Z'
|
||||
fill='#040404'
|
||||
/>
|
||||
<path
|
||||
d='M27 54C27.33 54 27.66 54 28 54C28.33 56.97 28.66 59.94 29 63C29.99 63 30.98 63 32 63C32 66.96 32 70.92 32 75C31.01 74.67 30.02 74.34 29 74C28.8672 73.2523 28.7344 72.5047 28.5977 71.7344C28.421 70.7495 28.2444 69.7647 28.0625 68.75C27.8885 67.7755 27.7144 66.8009 27.5352 65.7969C27.0533 63.087 27.0533 63.087 26.4062 60.8125C25.8547 58.3515 26.3956 56.4176 27 54Z'
|
||||
fill='#434039'
|
||||
/>
|
||||
<path
|
||||
d='M78 5C78.99 5.33 79.98 5.66 81 6C80.3194 6.92812 80.3194 6.92812 79.625 7.875C77.7233 11.532 77.1555 14.8461 76.5273 18.8906C76.3533 19.5867 76.1793 20.2828 76 21C75.34 21.33 74.68 21.66 74 22C73.5126 15.2987 74.9229 10.9344 78 5Z'
|
||||
fill='#2A2313'
|
||||
/>
|
||||
<path
|
||||
d='M12 115C12.99 115.495 12.99 115.495 14 116C14.5334 118.483 14.9326 120.864 15.25 123.375C15.3531 124.061 15.4562 124.747 15.5625 125.453C16.0763 129.337 16.2441 130.634 14 134C12.6761 127.57 11.752 121.571 12 115Z'
|
||||
fill='#2F2C22'
|
||||
/>
|
||||
<path
|
||||
d='M104 95C107 98 107 98 107.363 101.031C107.347 102.176 107.33 103.321 107.312 104.5C107.309 105.645 107.305 106.789 107.301 107.969C107 111 107 111 105 114C104.67 107.73 104.34 101.46 104 95Z'
|
||||
fill='#120F05'
|
||||
/>
|
||||
<path
|
||||
d='M56 103C58.6048 102.919 61.2071 102.86 63.8125 102.812C64.5505 102.787 65.2885 102.762 66.0488 102.736C71.4975 102.662 71.4975 102.662 74 104.344C75.374 106.619 75.2112 108.396 75 111C74.34 111 73.68 111 73 111C72.7112 110.196 72.4225 109.391 72.125 108.562C71.2674 105.867 71.2674 105.867 69 105C66.7956 104.77 64.5861 104.589 62.375 104.438C61.1865 104.354 59.998 104.27 58.7734 104.184C57.4006 104.093 57.4006 104.093 56 104C56 103.67 56 103.34 56 103Z'
|
||||
fill='#101010'
|
||||
/>
|
||||
<path
|
||||
d='M23 40C23.66 40 24.32 40 25 40C27.3084 46.3482 27.1982 52.2948 27 59C26.67 59 26.34 59 26 59C25.01 52.73 24.02 46.46 23 40Z'
|
||||
fill='#191409'
|
||||
/>
|
||||
<path
|
||||
d='M47 83C46.3606 83.3094 45.7212 83.6187 45.0625 83.9375C41.9023 87.0977 42.181 90.6833 42 95C41.01 94.67 40.02 94.34 39 94C39.3463 85.7409 39.3463 85.7409 41.875 82.875C44 82 44 82 47 83Z'
|
||||
fill='#171717'
|
||||
/>
|
||||
<path
|
||||
d='M53 61C53.33 61 53.66 61 54 61C54.33 67.93 54.66 74.86 55 82C54.01 82 53.02 82 52 82C52.33 75.07 52.66 68.14 53 61Z'
|
||||
fill='#444444'
|
||||
/>
|
||||
<path
|
||||
d='M81 154C78.6696 156.33 77.8129 156.39 74.625 156.75C73.4687 156.897 73.4687 156.897 72.2891 157.047C69.6838 156.994 68.2195 156.317 66 155C67.7478 154.635 69.4984 154.284 71.25 153.938C72.7118 153.642 72.7118 153.642 74.2031 153.34C76.8681 153.016 78.4887 153.145 81 154Z'
|
||||
fill='#332F23'
|
||||
/>
|
||||
<path
|
||||
d='M19 28C19.66 28 20.32 28 21 28C21.6735 29.4343 22.3386 30.8726 23 32.3125C23.5569 33.5133 23.5569 33.5133 24.125 34.7383C25 37 25 37 25 40C22 39 22 39 21.0508 37.2578C20.8071 36.554 20.5635 35.8502 20.3125 35.125C20.0611 34.4263 19.8098 33.7277 19.5508 33.0078C19 31 19 31 19 28Z'
|
||||
fill='#282213'
|
||||
/>
|
||||
<path
|
||||
d='M102 87C104.429 93.2857 104.429 93.2857 103 97C100.437 94.75 100.437 94.75 98 92C98.0625 89.75 98.0625 89.75 99 88C101 87 101 87 102 87Z'
|
||||
fill='#37301F'
|
||||
/>
|
||||
<path
|
||||
d='M53 56C53.33 56 53.66 56 54 56C53.67 62.27 53.34 68.54 53 75C52.67 75 52.34 75 52 75C51.7788 72.2088 51.5726 69.4179 51.375 66.625C51.3105 65.8309 51.2461 65.0369 51.1797 64.2188C51.0394 62.1497 51.0124 60.0737 51 58C51.66 57.34 52.32 56.68 53 56Z'
|
||||
fill='#030303'
|
||||
/>
|
||||
<path
|
||||
d='M100 129C100.33 129 100.66 129 101 129C100.532 133.776 99.7567 137.045 97 141C96.34 140.67 95.68 140.34 95 140C96.65 136.37 98.3 132.74 100 129Z'
|
||||
fill='#1E1A12'
|
||||
/>
|
||||
<path
|
||||
d='M15 131C17.7061 132.353 17.9618 133.81 19.125 136.562C19.4782 137.389 19.8314 138.215 20.1953 139.066C20.4609 139.704 20.7264 140.343 21 141C20.01 141 19.02 141 18 141C15.9656 137.27 15 135.331 15 131Z'
|
||||
fill='#1C1912'
|
||||
/>
|
||||
<path
|
||||
d='M63 49C69.4 49.4923 69.4 49.4923 72.4375 52.0625C73.2109 53.0216 73.2109 53.0216 74 54C70.8039 54 69.5828 53.4533 66.8125 52C66.0971 51.6288 65.3816 51.2575 64.6445 50.875C64.1018 50.5863 63.5591 50.2975 63 50C63 49.67 63 49.34 63 49Z'
|
||||
fill='#13110C'
|
||||
/>
|
||||
<path
|
||||
d='M0.999992 39C1.98999 39 2.97999 39 3.99999 39C5.24999 46.625 5.24999 46.625 2.99999 50C2.33999 46.37 1.67999 42.74 0.999992 39Z'
|
||||
fill='#312C1E'
|
||||
/>
|
||||
<path
|
||||
d='M94 5C94.66 5 95.32 5 96 5C97.8041 7.75924 98.0127 8.88972 97.625 12.25C97.4187 13.1575 97.2125 14.065 97 15C95.1161 11.7345 94.5071 8.71888 94 5Z'
|
||||
fill='#292417'
|
||||
/>
|
||||
<path
|
||||
d='M20 141C23.3672 142.393 24.9859 143.979 27 147C24.625 146.812 24.625 146.812 22 146C20.6875 143.438 20.6875 143.438 20 141Z'
|
||||
fill='#373328'
|
||||
/>
|
||||
<path
|
||||
d='M86 83C86.33 83.99 86.66 84.98 87 86C83.37 85.34 79.74 84.68 76 84C80.3553 81.8223 81.4663 81.9696 86 83Z'
|
||||
fill='#2F2F2F'
|
||||
/>
|
||||
<path
|
||||
d='M42 93C46 97.625 46 97.625 46 101C44.02 99.35 42.04 97.7 40 96C40.66 95.67 41.32 95.34 42 95C42 94.34 42 93.68 42 93Z'
|
||||
fill='#232323'
|
||||
/>
|
||||
<path
|
||||
d='M34 55C34.66 55.33 35.32 55.66 36 56C35.5256 56.7838 35.0512 57.5675 34.5625 58.375C33.661 59.8895 32.7882 61.4236 32 63C31.34 63 30.68 63 30 63C30.4983 59.3125 31.1007 57.3951 34 55Z'
|
||||
fill='#110F0A'
|
||||
/>
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
[Stagehand](https://www.stagehand.dev/) is an autonomous web agent platform that enables AI systems to navigate and interact with websites just like a human would. It provides a powerful solution for automating complex web tasks without requiring custom code or browser automation scripts.
|
||||
|
||||
With Stagehand, you can:
|
||||
|
||||
- **Automate web navigation**: Enable AI to browse websites, click links, fill forms, and interact with web elements
|
||||
- **Extract structured data**: Collect specific information from websites in a structured, usable format
|
||||
- **Complete complex workflows**: Perform multi-step tasks across different websites and web applications
|
||||
- **Handle authentication**: Navigate login processes and maintain sessions across websites
|
||||
- **Process dynamic content**: Interact with JavaScript-heavy sites and single-page applications
|
||||
- **Maintain context awareness**: Keep track of the current state and history while navigating
|
||||
- **Generate detailed reports**: Receive comprehensive logs of actions taken and data collected
|
||||
|
||||
In Sim, the Stagehand integration enables your agents to seamlessly interact with web-based systems as part of their workflows. This allows for sophisticated automation scenarios that bridge the gap between your AI agents and the vast information and functionality available on the web. Your agents can search for information, interact with web applications, extract data from websites, and incorporate these capabilities into their decision-making processes. By connecting Sim with Stagehand, you can create agents that extend beyond API-based integrations to navigate the web just as a human would - filling forms, clicking buttons, reading content, and extracting valuable information to complete their tasks more effectively.
|
||||
{/* MANUAL-CONTENT-END */}
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks.
|
||||
|
||||
## Tools
|
||||
|
||||
### `stagehand_agent`
|
||||
|
||||
Run an autonomous web agent to complete tasks and extract structured data
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `startUrl` | string | Yes | URL of the webpage to start the agent on |
|
||||
| `task` | string | Yes | The task to complete or goal to achieve on the website |
|
||||
| `variables` | json | No | Optional variables to substitute in the task \(format: \{key: value\}\). Reference in task using %key% |
|
||||
| `format` | string | No | No description |
|
||||
| `apiKey` | string | Yes | OpenAI API key for agent execution \(required by Stagehand\) |
|
||||
| `outputSchema` | json | No | Optional JSON schema defining the structure of data the agent should return |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `agentResult` | object | Result from the Stagehand agent execution |
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `stagehand_agent`
|
||||
@@ -109,10 +109,10 @@ Daten in eine Supabase-Tabelle einfügen
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Ja | Ihre Supabase-Projekt-ID (z.B. jdrkgepadsdopsntdlom) |
|
||||
| `projectId` | string | Ja | Ihre Supabase-Projekt-ID \(z.B. jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten eingefügt werden sollen |
|
||||
| `data` | any | Ja | Die einzufügenden Daten |
|
||||
| `apiKey` | string | Ja | Ihr Supabase Service-Role-Secret-Key |
|
||||
| `data` | array | Ja | Die einzufügenden Daten \(Array von Objekten oder ein einzelnes Objekt\) |
|
||||
| `apiKey` | string | Ja | Ihr Supabase Service Role Secret Key |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
@@ -191,8 +191,8 @@ Daten in eine Supabase-Tabelle einfügen oder aktualisieren (Upsert-Operation)
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Ja | Ihre Supabase-Projekt-ID \(z.B. jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten eingefügt werden sollen |
|
||||
| `data` | any | Ja | Die Daten, die eingefügt oder aktualisiert werden sollen \(Upsert\) |
|
||||
| `table` | string | Ja | Der Name der Supabase-Tabelle, in die Daten upsertet werden sollen |
|
||||
| `data` | array | Ja | Die zu upsertenden Daten \(einfügen oder aktualisieren\) - Array von Objekten oder ein einzelnes Objekt |
|
||||
| `apiKey` | string | Ja | Ihr Supabase Service Role Secret Key |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
@@ -87,12 +87,108 @@ Sendet Nachrichten an Telegram-Kanäle oder Benutzer über die Telegram Bot API.
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `success` | boolean | Erfolgsstatus der Telegram-Nachrichtensendung |
|
||||
| `messageId` | number | Eindeutige Telegram-Nachrichtenkennung |
|
||||
| `chatId` | string | Ziel-Chat-ID, wohin die Nachricht gesendet wurde |
|
||||
| `text` | string | Textinhalt der gesendeten Nachricht |
|
||||
| `timestamp` | number | Unix-Zeitstempel, wann die Nachricht gesendet wurde |
|
||||
| `from` | object | Informationen über den Bot, der die Nachricht gesendet hat |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Telegram-Nachrichtendaten |
|
||||
|
||||
## Hinweise
|
||||
|
||||
- Kategorie: `tools`
|
||||
- Typ: `telegram`
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Ja | Ihr Telegram Bot API-Token |
|
||||
| `chatId` | string | Ja | Ziel-Telegram-Chat-ID |
|
||||
| `messageId` | string | Ja | Nachrichten-ID zum Löschen |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Ergebnis des Löschvorgangs |
|
||||
|
||||
### `telegram_send_photo`
|
||||
|
||||
Senden Sie Fotos an Telegram-Kanäle oder Benutzer über die Telegram Bot API.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Ja | Ihr Telegram Bot API-Token |
|
||||
| `chatId` | string | Ja | Ziel-Telegram-Chat-ID |
|
||||
| `photo` | string | Ja | Zu sendendes Foto. Übergeben Sie eine file_id oder HTTP-URL |
|
||||
| `caption` | string | Nein | Fotobeschreibung (optional) |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Foto(s) |
|
||||
|
||||
### `telegram_send_video`
|
||||
|
||||
Senden Sie Videos an Telegram-Kanäle oder Benutzer über die Telegram Bot API.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Ja | Ihr Telegram Bot API-Token |
|
||||
| `chatId` | string | Ja | Ziel-Telegram-Chat-ID |
|
||||
| `video` | string | Ja | Zu sendendes Video. Übergeben Sie eine file_id oder HTTP-URL |
|
||||
| `caption` | string | Nein | Videobeschreibung (optional) |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Medien |
|
||||
|
||||
### `telegram_send_audio`
|
||||
|
||||
Senden Sie Audiodateien an Telegram-Kanäle oder Benutzer über die Telegram Bot API.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Ja | Ihr Telegram Bot API-Token |
|
||||
| `chatId` | string | Ja | Ziel-Telegram-Chat-ID |
|
||||
| `audio` | string | Ja | Zu sendende Audiodatei. Übergeben Sie eine file_id oder HTTP-URL |
|
||||
| `caption` | string | Nein | Audio-Beschriftung \(optional\) |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Telegram-Nachrichtendaten einschließlich Sprach-/Audioinformationen |
|
||||
|
||||
### `telegram_send_animation`
|
||||
|
||||
Senden Sie Animationen (GIFs) an Telegram-Kanäle oder Benutzer über die Telegram Bot API.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Ja | Ihr Telegram Bot API-Token |
|
||||
| `chatId` | string | Ja | Ziel-Telegram-Chat-ID |
|
||||
| `animation` | string | Ja | Zu sendende Animation. Übergeben Sie eine file_id oder HTTP-URL |
|
||||
| `caption` | string | Nein | Animations-Beschriftung \(optional\) |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Erfolgs- oder Fehlermeldung |
|
||||
| `data` | object | Telegram-Nachrichtendaten einschließlich optionaler Medien |
|
||||
|
||||
## Hinweise
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: YouTube
|
||||
description: Suche nach Videos auf YouTube
|
||||
description: Interagiere mit YouTube-Videos, Kanälen und Playlists
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
@@ -39,7 +39,7 @@ In Sim ermöglicht die YouTube-Integration Ihren Agenten, YouTube-Inhalte progra
|
||||
|
||||
## Gebrauchsanweisung
|
||||
|
||||
Integriert YouTube in den Workflow. Kann nach Videos suchen. Benötigt API-Schlüssel.
|
||||
Integriere YouTube in den Workflow. Kann nach Videos suchen, Videodetails abrufen, Kanalinformationen abrufen, Playlist-Elemente abrufen und Videokommentare abrufen.
|
||||
|
||||
## Tools
|
||||
|
||||
@@ -61,6 +61,99 @@ Suche nach Videos auf YouTube mit der YouTube Data API.
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array von YouTube-Videos, die der Suchanfrage entsprechen |
|
||||
|
||||
### `youtube_video_details`
|
||||
|
||||
Erhalte detaillierte Informationen über ein bestimmtes YouTube-Video.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `videoId` | string | Ja | YouTube-Video-ID |
|
||||
| `apiKey` | string | Ja | YouTube API-Schlüssel |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `videoId` | string | YouTube-Video-ID |
|
||||
| `title` | string | Videotitel |
|
||||
| `description` | string | Videobeschreibung |
|
||||
| `channelId` | string | Kanal-ID |
|
||||
| `channelTitle` | string | Kanalname |
|
||||
| `publishedAt` | string | Veröffentlichungsdatum und -uhrzeit |
|
||||
| `duration` | string | Videodauer im ISO 8601-Format |
|
||||
| `viewCount` | number | Anzahl der Aufrufe |
|
||||
| `likeCount` | number | Anzahl der Likes |
|
||||
| `commentCount` | number | Anzahl der Kommentare |
|
||||
| `thumbnail` | string | Video-Thumbnail-URL |
|
||||
| `tags` | array | Video-Tags |
|
||||
|
||||
### `youtube_channel_info`
|
||||
|
||||
Erhalte detaillierte Informationen über einen YouTube-Kanal.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `channelId` | string | Nein | YouTube-Kanal-ID \(verwende entweder channelId oder username\) |
|
||||
| `username` | string | Nein | YouTube-Kanalbenutzername \(verwende entweder channelId oder username\) |
|
||||
| `apiKey` | string | Ja | YouTube API-Schlüssel |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `channelId` | string | YouTube-Kanal-ID |
|
||||
| `title` | string | Kanalname |
|
||||
| `description` | string | Kanalbeschreibung |
|
||||
| `subscriberCount` | number | Anzahl der Abonnenten |
|
||||
| `videoCount` | number | Anzahl der Videos |
|
||||
| `viewCount` | number | Gesamtaufrufe des Kanals |
|
||||
| `publishedAt` | string | Erstellungsdatum des Kanals |
|
||||
| `thumbnail` | string | URL des Kanal-Thumbnails |
|
||||
| `customUrl` | string | Benutzerdefinierte Kanal-URL |
|
||||
|
||||
### `youtube_playlist_items`
|
||||
|
||||
Videos aus einer YouTube-Playlist abrufen.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `playlistId` | string | Ja | YouTube-Playlist-ID |
|
||||
| `maxResults` | number | Nein | Maximale Anzahl der zurückzugebenden Videos |
|
||||
| `pageToken` | string | Nein | Page-Token für Paginierung |
|
||||
| `apiKey` | string | Ja | YouTube API-Schlüssel |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array von Videos in der Playlist |
|
||||
|
||||
### `youtube_comments`
|
||||
|
||||
Kommentare von einem YouTube-Video abrufen.
|
||||
|
||||
#### Eingabe
|
||||
|
||||
| Parameter | Typ | Erforderlich | Beschreibung |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `videoId` | string | Ja | YouTube-Video-ID |
|
||||
| `maxResults` | number | Nein | Maximale Anzahl der zurückzugebenden Kommentare |
|
||||
| `order` | string | Nein | Reihenfolge der Kommentare: time oder relevance |
|
||||
| `pageToken` | string | Nein | Page-Token für Paginierung |
|
||||
| `apiKey` | string | Ja | YouTube API-Schlüssel |
|
||||
|
||||
#### Ausgabe
|
||||
|
||||
| Parameter | Typ | Beschreibung |
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array von Kommentaren zum Video |
|
||||
|
||||
## Hinweise
|
||||
|
||||
- Kategorie: `tools`
|
||||
|
||||
@@ -38,14 +38,149 @@ curl -X POST \
|
||||
|
||||
Erfolgreiche Antworten geben das serialisierte Ausführungsergebnis vom Executor zurück. Fehler zeigen Validierungs-, Authentifizierungs- oder Workflow-Fehler an.
|
||||
|
||||
## Ausgabe-Referenz
|
||||
## Streaming-Antworten
|
||||
|
||||
Aktivieren Sie Echtzeit-Streaming, um Workflow-Ausgaben zu erhalten, während sie zeichen-für-zeichen generiert werden. Dies ist nützlich, um KI-Antworten progressiv für Benutzer anzuzeigen.
|
||||
|
||||
### Anfrageparameter
|
||||
|
||||
Fügen Sie diese Parameter hinzu, um Streaming zu aktivieren:
|
||||
|
||||
- `stream` - Auf `true` setzen, um Server-Sent Events (SSE) Streaming zu aktivieren
|
||||
- `selectedOutputs` - Array von Block-Ausgaben zum Streamen (z.B. `["agent1.content"]`)
|
||||
|
||||
### Block-Ausgabeformat
|
||||
|
||||
Verwenden Sie das `blockName.attribute` Format, um anzugeben, welche Block-Ausgaben gestreamt werden sollen:
|
||||
- Format: `"blockName.attribute"` (z.B. Wenn Sie den Inhalt des Agent 1-Blocks streamen möchten, würden Sie `"agent1.content"` verwenden)
|
||||
- Blocknamen sind nicht case-sensitive und Leerzeichen werden ignoriert
|
||||
|
||||
### Beispielanfrage
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
https://sim.ai/api/workflows/WORKFLOW_ID/execute \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'X-API-Key: YOUR_KEY' \
|
||||
-d '{
|
||||
"message": "Count to five",
|
||||
"stream": true,
|
||||
"selectedOutputs": ["agent1.content"]
|
||||
}'
|
||||
```
|
||||
|
||||
### Antwortformat
|
||||
|
||||
Streaming-Antworten verwenden das Server-Sent Events (SSE) Format:
|
||||
|
||||
```
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", two"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", three"}
|
||||
|
||||
data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}}
|
||||
|
||||
data: [DONE]
|
||||
```
|
||||
|
||||
Jedes Ereignis enthält:
|
||||
- **Streaming-Chunks**: `{"blockId": "...", "chunk": "text"}` - Echtzeit-Text während er generiert wird
|
||||
- **Abschlussereignis**: `{"event": "done", ...}` - Ausführungsmetadaten und vollständige Ergebnisse
|
||||
- **Terminator**: `[DONE]` - Signalisiert das Ende des Streams
|
||||
|
||||
### Streaming mehrerer Blöcke
|
||||
|
||||
Wenn `selectedOutputs` mehrere Blöcke enthält, zeigt jeder Chunk an, welcher Block ihn erzeugt hat:
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
https://sim.ai/api/workflows/WORKFLOW_ID/execute \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'X-API-Key: YOUR_KEY' \
|
||||
-d '{
|
||||
"message": "Process this request",
|
||||
"stream": true,
|
||||
"selectedOutputs": ["agent1.content", "agent2.content"]
|
||||
}'
|
||||
```
|
||||
|
||||
Das Feld `blockId` in jedem Chunk ermöglicht es Ihnen, die Ausgabe zum richtigen UI-Element zu leiten:
|
||||
|
||||
```
|
||||
data: {"blockId":"agent1-uuid","chunk":"Processing..."}
|
||||
|
||||
data: {"blockId":"agent2-uuid","chunk":"Analyzing..."}
|
||||
|
||||
data: {"blockId":"agent1-uuid","chunk":" complete"}
|
||||
```
|
||||
|
||||
## Ausgabereferenz
|
||||
|
||||
| Referenz | Beschreibung |
|
||||
|-----------|-------------|
|
||||
| `<api.field>` | Im Eingabeformat definiertes Feld |
|
||||
| `<api.input>` | Gesamter strukturierter Anfragekörper |
|
||||
|
||||
Wenn kein Eingabeformat definiert ist, stellt der Executor das rohe JSON nur unter `<api.input>` bereit.
|
||||
Wenn kein Eingabeformat definiert ist, stellt der Executor das rohe JSON nur unter `<api.input>` zur Verfügung.
|
||||
|
||||
<Callout type="warning">
|
||||
Ein Workflow kann nur einen API-Trigger enthalten. Veröffentlichen Sie nach Änderungen eine neue Bereitstellung, damit der Endpunkt aktuell bleibt.
|
||||
</Callout>
|
||||
|
||||
### Datei-Upload-Format
|
||||
|
||||
Die API akzeptiert Dateien in zwei Formaten:
|
||||
|
||||
**1. Base64-kodierte Dateien** (empfohlen für SDKs):
|
||||
|
||||
```json
|
||||
{
|
||||
"documents": [{
|
||||
"type": "file",
|
||||
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
|
||||
"name": "document.pdf",
|
||||
"mime": "application/pdf"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
- Maximale Dateigröße: 20MB pro Datei
|
||||
- Dateien werden in den Cloud-Speicher hochgeladen und in UserFile-Objekte mit allen Eigenschaften umgewandelt
|
||||
|
||||
**2. Direkte URL-Referenzen**:
|
||||
|
||||
```json
|
||||
{
|
||||
"documents": [{
|
||||
"type": "url",
|
||||
"data": "https://example.com/document.pdf",
|
||||
"name": "document.pdf",
|
||||
"mime": "application/pdf"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
- Die Datei wird nicht hochgeladen, die URL wird direkt weitergegeben
|
||||
- Nützlich für die Referenzierung bestehender Dateien
|
||||
|
||||
### Dateieigenschaften
|
||||
|
||||
Für Dateien können alle Eigenschaften abgerufen werden:
|
||||
|
||||
| Eigenschaft | Beschreibung | Typ |
|
||||
|----------|-------------|------|
|
||||
| `<api.fieldName[0].url>` | Signierte Download-URL | string |
|
||||
| `<api.fieldName[0].name>` | Ursprünglicher Dateiname | string |
|
||||
| `<api.fieldName[0].size>` | Dateigröße in Bytes | number |
|
||||
| `<api.fieldName[0].type>` | MIME-Typ | string |
|
||||
| `<api.fieldName[0].uploadedAt>` | Upload-Zeitstempel (ISO 8601) | string |
|
||||
| `<api.fieldName[0].expiresAt>` | URL-Ablaufzeitstempel (ISO 8601) | string |
|
||||
|
||||
Für URL-referenzierte Dateien sind dieselben Eigenschaften verfügbar, außer `uploadedAt` und `expiresAt`, da die Datei nicht in unseren Speicher hochgeladen wird.
|
||||
|
||||
Wenn kein Eingabeformat definiert ist, stellt der Executor das rohe JSON nur unter `<api.input>` zur Verfügung.
|
||||
|
||||
<Callout type="warning">
|
||||
Ein Workflow kann nur einen API-Trigger enthalten. Veröffentlichen Sie nach Änderungen eine neue Bereitstellung, damit der Endpunkt aktuell bleibt.
|
||||
|
||||
@@ -41,3 +41,11 @@ Dateien enthalten `name`, `mimeType` und einen signierten Download `url`.
|
||||
<Callout type="info">
|
||||
Der Builder blockiert mehrere Chat-Auslöser-Blöcke im selben Workflow.
|
||||
</Callout>
|
||||
|
||||
1. Fügen Sie einen Chat-Trigger-Block pro Workflow hinzu.
|
||||
2. Stellen Sie den Workflow im Chat-Modus bereit.
|
||||
3. Teilen Sie den Bereitstellungslink – jede Antwort verwendet die Konversations-ID wieder, damit der Workflow den Kontext beibehalten kann.
|
||||
|
||||
<Callout type="info">
|
||||
Der Builder blockiert mehrere Chat-Trigger-Blöcke im selben Workflow.
|
||||
</Callout>
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
---
|
||||
title: Block-Referenz-Syntax
|
||||
description: Wie man Daten zwischen Blöcken in YAML-Workflows referenziert
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
|
||||
Block-Referenzen sind die Grundlage des Datenflusses in Sim-Workflows. Das Verständnis, wie man Ausgaben von einem Block korrekt als Eingaben für einen anderen referenziert, ist essenziell für den Aufbau funktionaler Workflows.
|
||||
|
||||
## Grundlegende Referenzregeln
|
||||
|
||||
### 1. Verwende Blocknamen, nicht Block-IDs
|
||||
|
||||
<Tabs items={['Correct', 'Incorrect']}>
|
||||
<Tab>
|
||||
|
||||
```yaml
|
||||
# Block definition
|
||||
email-sender:
|
||||
type: agent
|
||||
name: "Email Generator"
|
||||
# ... configuration
|
||||
|
||||
# Reference the block
|
||||
next-block:
|
||||
inputs:
|
||||
userPrompt: "Process this: <emailgenerator.content>"
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```yaml
|
||||
# Block definition
|
||||
email-sender:
|
||||
type: agent
|
||||
name: "Email Generator"
|
||||
# ... configuration
|
||||
|
||||
# ❌ Don't reference by block ID
|
||||
next-block:
|
||||
inputs:
|
||||
userPrompt: "Process this: <email-sender.content>"
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### 2. Namen in Referenzformat umwandeln
|
||||
|
||||
Um eine Block-Referenz zu erstellen:
|
||||
|
||||
1. **Nimm den Blocknamen**: "Email Generator"
|
||||
2. **Konvertiere zu Kleinbuchstaben**: "email generator"
|
||||
3. **Entferne Leerzeichen und Sonderzeichen**: "emailgenerator"
|
||||
4. **Füge Eigenschaft hinzu**: `<emailgenerator.content>`
|
||||
|
||||
### 3. Verwende die richtigen Eigenschaften
|
||||
|
||||
Verschiedene Blocktypen stellen unterschiedliche Eigenschaften bereit:
|
||||
|
||||
- **Agent-Blöcke**: `.content` (die KI-Antwort)
|
||||
- **Funktionsblöcke**: `.output` (der Rückgabewert)
|
||||
- **API-Blöcke**: `.output` (die Antwortdaten)
|
||||
- **Tool-Blöcke**: `.output` (das Tool-Ergebnis)
|
||||
|
||||
## Referenzbeispiele
|
||||
|
||||
### Häufige Block-Referenzen
|
||||
|
||||
```yaml
|
||||
# Agent block outputs
|
||||
<agentname.content> # Primary AI response
|
||||
<agentname.tokens> # Token usage information
|
||||
<agentname.cost> # Estimated cost
|
||||
<agentname.tool_calls> # Tool execution details
|
||||
|
||||
# Function block outputs
|
||||
<functionname.output> # Function return value
|
||||
<functionname.error> # Error information (if any)
|
||||
|
||||
# API block outputs
|
||||
<apiname.output> # Response data
|
||||
<apiname.status> # HTTP status code
|
||||
<apiname.headers> # Response headers
|
||||
|
||||
# Tool block outputs
|
||||
<toolname.output> # Tool execution result
|
||||
```
|
||||
|
||||
### Blocknamen mit mehreren Wörtern
|
||||
|
||||
```yaml
|
||||
# Block name: "Data Processor 2"
|
||||
<dataprocessor2.output>
|
||||
|
||||
# Block name: "Email Validation Service"
|
||||
<emailvalidationservice.output>
|
||||
|
||||
# Block name: "Customer Info Agent"
|
||||
<customerinfoagent.content>
|
||||
```
|
||||
|
||||
## Spezielle Referenzfälle
|
||||
|
||||
### Starter-Block
|
||||
|
||||
<Callout type="warning">
|
||||
Der Starter-Block wird immer als `<start.input>` referenziert, unabhängig von seinem tatsächlichen Namen.
|
||||
</Callout>
|
||||
|
||||
```yaml
|
||||
# Starter block definition
|
||||
my-custom-start:
|
||||
type: starter
|
||||
name: "Custom Workflow Start"
|
||||
# ... configuration
|
||||
|
||||
# Always reference as 'start'
|
||||
agent-1:
|
||||
inputs:
|
||||
userPrompt: <start.input> # ✅ Correct
|
||||
# userPrompt: <customworkflowstart.input> # ❌ Wrong
|
||||
```
|
||||
|
||||
### Schleifenvariablen
|
||||
|
||||
Innerhalb von Schleifenblöcken sind spezielle Variablen verfügbar:
|
||||
|
||||
```yaml
|
||||
# Available in loop child blocks
|
||||
<loop.index> # Current iteration (0-based)
|
||||
<loop.currentItem> # Current item being processed (forEach loops)
|
||||
<loop.items> # Full collection (forEach loops)
|
||||
```
|
||||
|
||||
### Parallele Variablen
|
||||
|
||||
Innerhalb von parallelen Blöcken sind spezielle Variablen verfügbar:
|
||||
|
||||
```yaml
|
||||
# Available in parallel child blocks
|
||||
<parallel.index> # Instance number (0-based)
|
||||
<parallel.currentItem> # Item for this instance
|
||||
<parallel.items> # Full collection
|
||||
```
|
||||
|
||||
## Komplexe Referenzbeispiele
|
||||
|
||||
### Zugriff auf verschachtelte Daten
|
||||
|
||||
Bei der Referenzierung komplexer Objekte wird die Punktnotation verwendet:
|
||||
|
||||
```yaml
|
||||
# If an agent returns structured data
|
||||
data-analyzer:
|
||||
type: agent
|
||||
name: "Data Analyzer"
|
||||
inputs:
|
||||
responseFormat: |
|
||||
{
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"analysis": {"type": "object"},
|
||||
"summary": {"type": "string"},
|
||||
"metrics": {"type": "object"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Reference nested properties
|
||||
next-step:
|
||||
inputs:
|
||||
userPrompt: |
|
||||
Summary: <dataanalyzer.analysis.summary>
|
||||
Score: <dataanalyzer.metrics.score>
|
||||
Full data: <dataanalyzer.content>
|
||||
```
|
||||
|
||||
### Mehrere Referenzen im Text
|
||||
|
||||
```yaml
|
||||
email-composer:
|
||||
type: agent
|
||||
inputs:
|
||||
userPrompt: |
|
||||
Create an email with the following information:
|
||||
|
||||
Customer: <customeragent.content>
|
||||
Order Details: <orderprocessor.output>
|
||||
Support Ticket: <ticketanalyzer.content>
|
||||
|
||||
Original request: <start.input>
|
||||
```
|
||||
|
||||
### Referenzen in Codeblöcken
|
||||
|
||||
Bei der Verwendung von Referenzen in Funktionsblöcken werden diese als JavaScript-Werte ersetzt:
|
||||
|
||||
```yaml
|
||||
data-processor:
|
||||
type: function
|
||||
inputs:
|
||||
code: |
|
||||
// References are replaced with actual values
|
||||
const customerData = <customeragent.content>;
|
||||
const orderInfo = <orderprocessor.output>;
|
||||
const originalInput = <start.input>;
|
||||
|
||||
// Process the data
|
||||
return {
|
||||
customer: customerData.name,
|
||||
orderId: orderInfo.id,
|
||||
processed: true
|
||||
};
|
||||
```
|
||||
|
||||
## Referenzvalidierung
|
||||
|
||||
Sim validiert alle Referenzen beim Importieren von YAML:
|
||||
|
||||
### Gültige Referenzen
|
||||
- Block existiert im Workflow
|
||||
- Eigenschaft ist für den Blocktyp geeignet
|
||||
- Keine zirkulären Abhängigkeiten
|
||||
- Korrekte Syntaxformatierung
|
||||
|
||||
### Häufige Fehler
|
||||
- **Block nicht gefunden**: Referenzierter Block existiert nicht
|
||||
- **Falsche Eigenschaft**: Verwendung von `.content` in einem Funktionsblock
|
||||
- **Tippfehler**: Falsch geschriebene Blocknamen oder Eigenschaften
|
||||
- **Zirkuläre Referenzen**: Block referenziert sich direkt oder indirekt selbst
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Verwende beschreibende Blocknamen**: Macht Referenzen lesbarer
|
||||
2. **Sei konsistent**: Verwende die gleiche Namenskonvention durchgängig
|
||||
3. **Überprüfe Referenzen**: Stelle sicher, dass alle referenzierten Blöcke existieren
|
||||
4. **Vermeide tiefe Verschachtelungen**: Halte Referenzketten überschaubar
|
||||
5. **Dokumentiere komplexe Abläufe**: Füge Kommentare hinzu, um Referenzbeziehungen zu erklären
|
||||
@@ -1,218 +0,0 @@
|
||||
---
|
||||
title: Agent Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für Agent-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [agent]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this agent block
|
||||
inputs:
|
||||
type: object
|
||||
properties:
|
||||
systemPrompt:
|
||||
type: string
|
||||
description: Instructions that define the agent's role and behavior
|
||||
userPrompt:
|
||||
type: string
|
||||
description: Input content to process (can reference other blocks)
|
||||
model:
|
||||
type: string
|
||||
description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat)
|
||||
temperature:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
description: Response creativity level (varies by model)
|
||||
apiKey:
|
||||
type: string
|
||||
description: API key for the model provider (use {{ENV_VAR}} format)
|
||||
azureEndpoint:
|
||||
type: string
|
||||
description: Azure OpenAI endpoint URL (required for Azure models)
|
||||
azureApiVersion:
|
||||
type: string
|
||||
description: Azure API version (required for Azure models)
|
||||
memories:
|
||||
type: string
|
||||
description: Memory context from memory blocks
|
||||
tools:
|
||||
type: array
|
||||
description: List of external tools the agent can use
|
||||
items:
|
||||
type: object
|
||||
required: [type, title, toolId, operation, usageControl]
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
description: Tool type identifier
|
||||
title:
|
||||
type: string
|
||||
description: Human-readable display name
|
||||
toolId:
|
||||
type: string
|
||||
description: Internal tool identifier
|
||||
operation:
|
||||
type: string
|
||||
description: Tool operation/method name
|
||||
usageControl:
|
||||
type: string
|
||||
enum: [auto, required, none]
|
||||
description: When AI can use the tool
|
||||
params:
|
||||
type: object
|
||||
description: Tool-specific configuration parameters
|
||||
isExpanded:
|
||||
type: boolean
|
||||
description: UI state
|
||||
default: false
|
||||
responseFormat:
|
||||
type: object
|
||||
description: JSON Schema to enforce structured output
|
||||
required:
|
||||
- model
|
||||
- apiKey
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful execution
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Tool-Konfiguration
|
||||
|
||||
Tools werden als Array definiert, wobei jedes Tool diese Struktur hat:
|
||||
|
||||
```yaml
|
||||
tools:
|
||||
- type: <string> # Tool type identifier (exa, gmail, slack, etc.)
|
||||
title: <string> # Human-readable display name
|
||||
toolId: <string> # Internal tool identifier
|
||||
operation: <string> # Tool operation/method name
|
||||
usageControl: <string> # When AI can use it (auto | required | none)
|
||||
params: <object> # Tool-specific configuration parameters
|
||||
isExpanded: <boolean> # UI state (optional, default: false)
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf Ausführungsergebnissen geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful execution
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfacher Agent
|
||||
|
||||
```yaml
|
||||
content-agent:
|
||||
type: agent
|
||||
name: "Content Analyzer 1"
|
||||
inputs:
|
||||
systemPrompt: "You are a helpful content analyzer. Be concise and clear."
|
||||
userPrompt: <start.input>
|
||||
model: gpt-4o
|
||||
temperature: 0.3
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: summary-block
|
||||
|
||||
summary-block:
|
||||
type: agent
|
||||
name: "Summary Generator"
|
||||
inputs:
|
||||
systemPrompt: "Create a brief summary of the analysis."
|
||||
userPrompt: "Analyze this: <contentanalyzer1.content>"
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: final-step
|
||||
```
|
||||
|
||||
### Agent mit Tools
|
||||
|
||||
```yaml
|
||||
research-agent:
|
||||
type: agent
|
||||
name: "Research Assistant"
|
||||
inputs:
|
||||
systemPrompt: "Research the topic and provide detailed information."
|
||||
userPrompt: <start.input>
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
tools:
|
||||
- type: exa
|
||||
title: "Web Search"
|
||||
toolId: exa_search
|
||||
operation: exa_search
|
||||
usageControl: auto
|
||||
params:
|
||||
apiKey: '{{EXA_API_KEY}}'
|
||||
connections:
|
||||
success: summary-block
|
||||
```
|
||||
|
||||
### Strukturierte Ausgabe
|
||||
|
||||
```yaml
|
||||
data-extractor:
|
||||
type: agent
|
||||
name: "Extract Contact Info"
|
||||
inputs:
|
||||
systemPrompt: "Extract contact information from the text."
|
||||
userPrompt: <start.input>
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
responseFormat: |
|
||||
{
|
||||
"name": "contact_extraction",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"type": "string"},
|
||||
"email": {"type": "string"},
|
||||
"phone": {"type": "string"}
|
||||
},
|
||||
"required": ["name"]
|
||||
},
|
||||
"strict": true
|
||||
}
|
||||
connections:
|
||||
success: save-contact
|
||||
```
|
||||
|
||||
### Azure OpenAI
|
||||
|
||||
```yaml
|
||||
azure-agent:
|
||||
type: agent
|
||||
name: "Azure AI Assistant"
|
||||
inputs:
|
||||
systemPrompt: "You are a helpful assistant."
|
||||
userPrompt: <start.input>
|
||||
model: gpt-4o
|
||||
apiKey: '{{AZURE_OPENAI_API_KEY}}'
|
||||
azureEndpoint: '{{AZURE_OPENAI_ENDPOINT}}'
|
||||
azureApiVersion: "2024-07-01-preview"
|
||||
connections:
|
||||
success: response-block
|
||||
```
|
||||
@@ -1,429 +0,0 @@
|
||||
---
|
||||
title: API Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für API-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [api]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this API block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- url
|
||||
- method
|
||||
properties:
|
||||
url:
|
||||
type: string
|
||||
description: The endpoint URL to send the request to
|
||||
method:
|
||||
type: string
|
||||
enum: [GET, POST, PUT, DELETE, PATCH]
|
||||
description: HTTP method for the request
|
||||
default: GET
|
||||
params:
|
||||
type: array
|
||||
description: Query parameters as table entries
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- cells
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Unique identifier for the parameter entry
|
||||
cells:
|
||||
type: object
|
||||
required:
|
||||
- Key
|
||||
- Value
|
||||
properties:
|
||||
Key:
|
||||
type: string
|
||||
description: Parameter name
|
||||
Value:
|
||||
type: string
|
||||
description: Parameter value
|
||||
headers:
|
||||
type: array
|
||||
description: HTTP headers as table entries
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- cells
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Unique identifier for the header entry
|
||||
cells:
|
||||
type: object
|
||||
required:
|
||||
- Key
|
||||
- Value
|
||||
properties:
|
||||
Key:
|
||||
type: string
|
||||
description: Header name
|
||||
Value:
|
||||
type: string
|
||||
description: Header value
|
||||
body:
|
||||
type: string
|
||||
description: Request body for POST/PUT/PATCH methods
|
||||
timeout:
|
||||
type: number
|
||||
description: Request timeout in milliseconds
|
||||
default: 30000
|
||||
minimum: 1000
|
||||
maximum: 300000
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful requests
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf Anfrageergebnissen geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful requests
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfache GET-Anfrage
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### POST-Anfrage mit Body
|
||||
|
||||
```yaml
|
||||
create-ticket:
|
||||
type: api
|
||||
name: "Create Support Ticket"
|
||||
inputs:
|
||||
url: "https://api.support.com/tickets"
|
||||
method: POST
|
||||
headers:
|
||||
- id: auth-header-uuid
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{SUPPORT_API_KEY}}"
|
||||
- id: content-type-uuid
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
body: |
|
||||
{
|
||||
"title": "<agent.title>",
|
||||
"description": "<agent.description>",
|
||||
"priority": "high"
|
||||
}
|
||||
connections:
|
||||
success: ticket-created
|
||||
error: ticket-error
|
||||
```
|
||||
|
||||
### Dynamische URL mit Abfrageparametern
|
||||
|
||||
```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: <start.searchTerm>
|
||||
- id: limit-param-uuid
|
||||
cells:
|
||||
Key: "limit"
|
||||
Value: "10"
|
||||
- id: category-param-uuid
|
||||
cells:
|
||||
Key: "category"
|
||||
Value: <filter.category>
|
||||
headers:
|
||||
- id: auth-header-uuid
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{STORE_API_KEY}}"
|
||||
connections:
|
||||
success: display-results
|
||||
```
|
||||
|
||||
## Parameterformat
|
||||
|
||||
Header und Parameter (Abfrageparameter) verwenden das Tabellenformat mit folgender Struktur:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- id: unique-identifier-here
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
- id: another-unique-identifier
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{API_TOKEN}}"
|
||||
|
||||
params:
|
||||
- id: param-identifier-here
|
||||
cells:
|
||||
Key: "limit"
|
||||
Value: "10"
|
||||
```
|
||||
|
||||
**Strukturdetails:**
|
||||
- `id`: Eindeutige Kennung zur Verfolgung der Tabellenzeile
|
||||
- `cells.Key`: Der Parameter-/Header-Name
|
||||
- `cells.Value`: Der Parameter-/Header-Wert
|
||||
- Dieses Format ermöglicht eine ordnungsgemäße Tabellenverwaltung und Beibehaltung des UI-Status
|
||||
|
||||
## Ausgabereferenzen
|
||||
|
||||
Nach der Ausführung eines API-Blocks können Sie auf seine Ausgaben in nachfolgenden Blöcken verweisen. Der API-Block bietet drei Hauptausgaben:
|
||||
|
||||
### Verfügbare Ausgaben
|
||||
|
||||
| Ausgabe | Typ | Beschreibung |
|
||||
|--------|------|-------------|
|
||||
| `data` | any | Der Antworttext/die Nutzlast von der API |
|
||||
| `status` | number | HTTP-Statuscode (200, 404, 500, usw.) |
|
||||
| `headers` | object | Vom Server zurückgegebene Antwort-Header |
|
||||
|
||||
### Verwendungsbeispiele
|
||||
|
||||
```yaml
|
||||
# Reference API response data
|
||||
process-data:
|
||||
type: function
|
||||
name: "Process API Data"
|
||||
inputs:
|
||||
code: |
|
||||
const responseData = <fetchuserdata.data>;
|
||||
const statusCode = <fetchuserdata.status>;
|
||||
const responseHeaders = <fetchuserdata.headers>;
|
||||
|
||||
if (statusCode === 200) {
|
||||
return {
|
||||
success: true,
|
||||
user: responseData,
|
||||
contentType: responseHeaders['content-type']
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
success: false,
|
||||
error: `API call failed with status ${statusCode}`
|
||||
};
|
||||
}
|
||||
|
||||
# Use API data in an agent block
|
||||
analyze-response:
|
||||
type: agent
|
||||
name: "Analyze Response"
|
||||
inputs:
|
||||
userPrompt: |
|
||||
Analyze this API response:
|
||||
|
||||
Status: <fetchuserdata.status>
|
||||
Data: <fetchuserdata.data>
|
||||
|
||||
Provide insights about the response.
|
||||
|
||||
# Conditional logic based on status
|
||||
check-status:
|
||||
type: condition
|
||||
name: "Check API Status"
|
||||
inputs:
|
||||
condition: <fetchuserdata.status> === 200
|
||||
connections:
|
||||
true: success-handler
|
||||
false: error-handler
|
||||
```
|
||||
|
||||
### Praktisches Beispiel
|
||||
|
||||
```yaml
|
||||
user-api:
|
||||
type: api
|
||||
name: "Fetch User Data"
|
||||
inputs:
|
||||
url: "https://api.example.com/users/123"
|
||||
method: GET
|
||||
connections:
|
||||
success: process-response
|
||||
|
||||
process-response:
|
||||
type: function
|
||||
name: "Process Response"
|
||||
inputs:
|
||||
code: |
|
||||
const user = <fetchuserdata.data>;
|
||||
const status = <fetchuserdata.status>;
|
||||
|
||||
console.log(`API returned status: ${status}`);
|
||||
console.log(`User data:`, user);
|
||||
|
||||
return {
|
||||
userId: user.id,
|
||||
email: user.email,
|
||||
isActive: status === 200
|
||||
};
|
||||
```
|
||||
|
||||
### Fehlerbehandlung
|
||||
|
||||
```yaml
|
||||
api-with-error-handling:
|
||||
type: api
|
||||
name: "API Call"
|
||||
inputs:
|
||||
url: "https://api.example.com/data"
|
||||
method: GET
|
||||
connections:
|
||||
success: check-response
|
||||
error: handle-error
|
||||
|
||||
check-response:
|
||||
type: condition
|
||||
name: "Check Response Status"
|
||||
inputs:
|
||||
condition: <apicall.status> >= 200 && <apicall.status> < 300
|
||||
connections:
|
||||
true: process-success
|
||||
false: handle-api-error
|
||||
|
||||
process-success:
|
||||
type: function
|
||||
name: "Process Success"
|
||||
inputs:
|
||||
code: |
|
||||
return {
|
||||
success: true,
|
||||
data: <apicall.data>,
|
||||
message: "API call successful"
|
||||
};
|
||||
|
||||
handle-api-error:
|
||||
type: function
|
||||
name: "Handle API Error"
|
||||
inputs:
|
||||
code: |
|
||||
return {
|
||||
success: false,
|
||||
status: <apicall.status>,
|
||||
error: "API call failed",
|
||||
data: <apicall.data>
|
||||
};
|
||||
```
|
||||
|
||||
## YAML-String-Escaping
|
||||
|
||||
Beim Schreiben von YAML müssen bestimmte Strings in Anführungszeichen gesetzt werden, um korrekt geparst zu werden:
|
||||
|
||||
### Strings, die in Anführungszeichen gesetzt werden müssen
|
||||
|
||||
```yaml
|
||||
# URLs with hyphens, colons, special characters
|
||||
url: "https://api.example.com/users/123"
|
||||
url: "https://my-api.example.com/data"
|
||||
|
||||
# Header values with hyphens or special characters
|
||||
headers:
|
||||
- id: header-uuid
|
||||
cells:
|
||||
Key: "User-Agent"
|
||||
Value: "My-Application/1.0"
|
||||
- id: auth-uuid
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer my-token-123"
|
||||
|
||||
# Parameter values with hyphens
|
||||
params:
|
||||
- id: param-uuid
|
||||
cells:
|
||||
Key: "sort-by"
|
||||
Value: "created-at"
|
||||
```
|
||||
|
||||
### Wann Anführungszeichen verwendet werden sollten
|
||||
|
||||
- ✅ **Immer in Anführungszeichen setzen**: URLs, Tokens, Werte mit Bindestrichen, Doppelpunkten oder Sonderzeichen
|
||||
- ✅ **Immer in Anführungszeichen setzen**: Werte, die mit Zahlen beginnen, aber Strings sein sollen
|
||||
- ✅ **Immer in Anführungszeichen setzen**: Boolean-ähnliche Strings, die als Strings erhalten bleiben sollen
|
||||
- ❌ **Nicht in Anführungszeichen setzen**: Einfache alphanumerische Strings ohne Sonderzeichen
|
||||
|
||||
### Beispiele
|
||||
|
||||
```yaml
|
||||
# ✅ Correct
|
||||
url: "https://api.stripe.com/v1/charges"
|
||||
headers:
|
||||
- id: auth-header
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer sk-test-123456789"
|
||||
|
||||
# ❌ Incorrect (may cause parsing errors)
|
||||
url: https://api.stripe.com/v1/charges
|
||||
headers:
|
||||
- id: auth-header
|
||||
cells:
|
||||
Key: Authorization
|
||||
Value: Bearer sk-test-123456789
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Umgebungsvariablen für API-Schlüssel verwenden: `{{API_KEY_NAME}}`
|
||||
- Fehlerbehandlung mit Fehlerverbindungen einbeziehen
|
||||
- Angemessene Timeouts für deinen Anwendungsfall festlegen
|
||||
- Statuscode der Antwort in nachfolgenden Blöcken validieren
|
||||
- Aussagekräftige Blocknamen für einfachere Referenzierung verwenden
|
||||
- **Strings mit Sonderzeichen, URLs und Tokens immer in Anführungszeichen setzen**
|
||||
@@ -1,165 +0,0 @@
|
||||
---
|
||||
title: Bedingungsblock YAML-Schema
|
||||
description: YAML-Konfigurationsreferenz für Bedingungsblöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
- connections
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [condition]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this condition block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- conditions
|
||||
properties:
|
||||
conditions:
|
||||
type: object
|
||||
description: Conditional expressions and their logic
|
||||
properties:
|
||||
if:
|
||||
type: string
|
||||
description: Primary condition expression (boolean)
|
||||
else-if:
|
||||
type: string
|
||||
description: Secondary condition expression (optional)
|
||||
else-if-2:
|
||||
type: string
|
||||
description: Third condition expression (optional)
|
||||
else-if-3:
|
||||
type: string
|
||||
description: Fourth condition expression (optional)
|
||||
# Additional else-if-N conditions can be added as needed
|
||||
else:
|
||||
type: boolean
|
||||
description: Default fallback condition (optional)
|
||||
default: true
|
||||
connections:
|
||||
type: object
|
||||
required:
|
||||
- conditions
|
||||
properties:
|
||||
conditions:
|
||||
type: object
|
||||
description: Target blocks for each condition outcome
|
||||
properties:
|
||||
if:
|
||||
type: string
|
||||
description: Target block ID when 'if' condition is true
|
||||
else-if:
|
||||
type: string
|
||||
description: Target block ID when 'else-if' condition is true
|
||||
else-if-2:
|
||||
type: string
|
||||
description: Target block ID when 'else-if-2' condition is true
|
||||
else-if-3:
|
||||
type: string
|
||||
description: Target block ID when 'else-if-3' condition is true
|
||||
# Additional else-if-N connections can be added as needed
|
||||
else:
|
||||
type: string
|
||||
description: Target block ID when no conditions match
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Im Gegensatz zu anderen Blöcken verwenden Bedingungen verzweigte Verbindungen basierend auf Bedingungsergebnissen:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
conditions:
|
||||
if: <string> # Target block ID when primary condition is true
|
||||
else-if: <string> # Target block ID when secondary condition is true (optional)
|
||||
else-if-2: <string> # Target block ID when third condition is true (optional)
|
||||
else-if-3: <string> # Target block ID when fourth condition is true (optional)
|
||||
# Additional else-if-N connections can be added as needed
|
||||
else: <string> # Target block ID when no conditions match (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfaches If-Else
|
||||
|
||||
```yaml
|
||||
status-check:
|
||||
type: condition
|
||||
name: "Status Check"
|
||||
inputs:
|
||||
conditions:
|
||||
if: <start.status> === "approved"
|
||||
else: true
|
||||
connections:
|
||||
conditions:
|
||||
if: send-approval-email
|
||||
else: send-rejection-email
|
||||
```
|
||||
|
||||
### Mehrere Bedingungen
|
||||
|
||||
```yaml
|
||||
user-routing:
|
||||
type: condition
|
||||
name: "User Type Router"
|
||||
inputs:
|
||||
conditions:
|
||||
if: <start.user_type> === "admin"
|
||||
else-if: <start.user_type> === "premium"
|
||||
else-if-2: <start.user_type> === "basic"
|
||||
else: true
|
||||
connections:
|
||||
conditions:
|
||||
if: admin-dashboard
|
||||
else-if: premium-features
|
||||
else-if-2: basic-features
|
||||
else: registration-flow
|
||||
```
|
||||
|
||||
### Numerische Vergleiche
|
||||
|
||||
```yaml
|
||||
score-evaluation:
|
||||
type: condition
|
||||
name: "Score Evaluation"
|
||||
inputs:
|
||||
conditions:
|
||||
if: <agent.score> >= 90
|
||||
else-if: <agent.score> >= 70
|
||||
else-if-2: <agent.score> >= 50
|
||||
else: true
|
||||
connections:
|
||||
conditions:
|
||||
if: excellent-response
|
||||
else-if: good-response
|
||||
else-if-2: average-response
|
||||
else: poor-response
|
||||
```
|
||||
|
||||
### Komplexe Logik
|
||||
|
||||
```yaml
|
||||
eligibility-check:
|
||||
type: condition
|
||||
name: "Eligibility Check"
|
||||
inputs:
|
||||
conditions:
|
||||
if: <start.age> >= 18 && <start.verified> === true
|
||||
else-if: <start.age> >= 16 && <start.parent_consent> === true
|
||||
else: true
|
||||
connections:
|
||||
conditions:
|
||||
if: full-access
|
||||
else-if: limited-access
|
||||
else: access-denied
|
||||
```
|
||||
@@ -1,255 +0,0 @@
|
||||
---
|
||||
title: Evaluator Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für Evaluator-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [evaluator]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this evaluator block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- content
|
||||
- metrics
|
||||
- model
|
||||
- apiKey
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
description: Content to evaluate (can reference other blocks)
|
||||
metrics:
|
||||
type: array
|
||||
description: Evaluation criteria and scoring ranges
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: Metric identifier
|
||||
description:
|
||||
type: string
|
||||
description: Detailed explanation of what the metric measures
|
||||
range:
|
||||
type: object
|
||||
properties:
|
||||
min:
|
||||
type: number
|
||||
description: Minimum score value
|
||||
max:
|
||||
type: number
|
||||
description: Maximum score value
|
||||
required: [min, max]
|
||||
description: Scoring range with numeric bounds
|
||||
model:
|
||||
type: string
|
||||
description: AI model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022)
|
||||
apiKey:
|
||||
type: string
|
||||
description: API key for the model provider (use {{ENV_VAR}} format)
|
||||
temperature:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
description: Model temperature for evaluation
|
||||
default: 0.3
|
||||
azureEndpoint:
|
||||
type: string
|
||||
description: Azure OpenAI endpoint URL (required for Azure models)
|
||||
azureApiVersion:
|
||||
type: string
|
||||
description: Azure API version (required for Azure models)
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful evaluation
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf den Evaluierungsergebnissen geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful evaluation
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Bewertung der Inhaltsqualität
|
||||
|
||||
```yaml
|
||||
content-evaluator:
|
||||
type: evaluator
|
||||
name: "Content Quality Evaluator"
|
||||
inputs:
|
||||
content: <content-generator.content>
|
||||
metrics:
|
||||
- name: "accuracy"
|
||||
description: "How factually accurate is the content?"
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
- name: "clarity"
|
||||
description: "How clear and understandable is the content?"
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
- name: "relevance"
|
||||
description: "How relevant is the content to the original query?"
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
- name: "completeness"
|
||||
description: "How complete and comprehensive is the content?"
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
model: gpt-4o
|
||||
temperature: 0.2
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: quality-report
|
||||
error: evaluation-error
|
||||
```
|
||||
|
||||
### Bewertung der Kundenantwort
|
||||
|
||||
```yaml
|
||||
response-evaluator:
|
||||
type: evaluator
|
||||
name: "Customer Response Evaluator"
|
||||
inputs:
|
||||
content: <customer-agent.content>
|
||||
metrics:
|
||||
- name: "helpfulness"
|
||||
description: "How helpful is the response in addressing the customer's needs?"
|
||||
range:
|
||||
min: 1
|
||||
max: 10
|
||||
- name: "tone"
|
||||
description: "How appropriate and professional is the tone?"
|
||||
range:
|
||||
min: 1
|
||||
max: 10
|
||||
- name: "completeness"
|
||||
description: "Does the response fully address all aspects of the inquiry?"
|
||||
range:
|
||||
min: 1
|
||||
max: 10
|
||||
model: claude-3-5-sonnet-20241022
|
||||
apiKey: '{{ANTHROPIC_API_KEY}}'
|
||||
connections:
|
||||
success: response-processor
|
||||
```
|
||||
|
||||
### A/B-Test-Evaluierung
|
||||
|
||||
```yaml
|
||||
ab-test-evaluator:
|
||||
type: evaluator
|
||||
name: "A/B Test Evaluator"
|
||||
inputs:
|
||||
content: |
|
||||
Version A: <version-a.content>
|
||||
Version B: <version-b.content>
|
||||
|
||||
Compare these two versions for the following criteria.
|
||||
metrics:
|
||||
- name: "engagement"
|
||||
description: "Which version is more likely to engage users?"
|
||||
range: "A, B, or Tie"
|
||||
- name: "clarity"
|
||||
description: "Which version communicates more clearly?"
|
||||
range: "A, B, or Tie"
|
||||
- name: "persuasiveness"
|
||||
description: "Which version is more persuasive?"
|
||||
range: "A, B, or Tie"
|
||||
model: gpt-4o
|
||||
temperature: 0.1
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: test-results
|
||||
```
|
||||
|
||||
### Mehrdimensionale Inhaltsbewertung
|
||||
|
||||
```yaml
|
||||
comprehensive-evaluator:
|
||||
type: evaluator
|
||||
name: "Comprehensive Content Evaluator"
|
||||
inputs:
|
||||
content: <ai-writer.content>
|
||||
metrics:
|
||||
- name: "technical_accuracy"
|
||||
description: "How technically accurate and correct is the information?"
|
||||
range:
|
||||
min: 0
|
||||
max: 100
|
||||
- name: "readability"
|
||||
description: "How easy is the content to read and understand?"
|
||||
range:
|
||||
min: 0
|
||||
max: 100
|
||||
- name: "seo_optimization"
|
||||
description: "How well optimized is the content for search engines?"
|
||||
range:
|
||||
min: 0
|
||||
max: 100
|
||||
- name: "user_engagement"
|
||||
description: "How likely is this content to engage and retain readers?"
|
||||
range:
|
||||
min: 0
|
||||
max: 100
|
||||
- name: "brand_alignment"
|
||||
description: "How well does the content align with brand voice and values?"
|
||||
range:
|
||||
min: 0
|
||||
max: 100
|
||||
model: gpt-4o
|
||||
temperature: 0.3
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: content-optimization
|
||||
```
|
||||
|
||||
## Output-Referenzen
|
||||
|
||||
Nach der Ausführung eines Evaluator-Blocks können Sie auf seine Ausgaben verweisen:
|
||||
|
||||
```yaml
|
||||
# In subsequent blocks
|
||||
next-block:
|
||||
inputs:
|
||||
evaluation: <evaluator-name.content> # Evaluation summary
|
||||
scores: <evaluator-name.scores> # Individual metric scores
|
||||
overall: <evaluator-name.overall> # Overall assessment
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Definieren Sie klare, spezifische Bewertungskriterien
|
||||
- Verwenden Sie angemessene Bewertungsbereiche für Ihren Anwendungsfall
|
||||
- Wählen Sie Modelle mit starken Argumentationsfähigkeiten
|
||||
- Verwenden Sie niedrigere Temperaturwerte für konsistente Bewertungen
|
||||
- Fügen Sie detaillierte Metrikbeschreibungen hinzu
|
||||
- Testen Sie mit verschiedenen Inhaltstypen
|
||||
- Erwägen Sie mehrere Evaluatoren für komplexe Bewertungen
|
||||
@@ -1,162 +0,0 @@
|
||||
---
|
||||
title: Funktionsblock YAML-Schema
|
||||
description: YAML-Konfigurationsreferenz für Funktionsblöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [function]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this function block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- code
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: JavaScript/TypeScript code to execute (multiline string)
|
||||
timeout:
|
||||
type: number
|
||||
description: Maximum execution time in milliseconds
|
||||
default: 30000
|
||||
minimum: 1000
|
||||
maximum: 300000
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful execution
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf den Ausführungsergebnissen geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful execution
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfache Validierung
|
||||
|
||||
```yaml
|
||||
input-validator:
|
||||
type: function
|
||||
name: "Input Validator"
|
||||
inputs:
|
||||
code: |-
|
||||
// Check if input number is greater than 5
|
||||
const inputValue = parseInt(<start.input>, 10);
|
||||
|
||||
if (inputValue > 5) {
|
||||
return {
|
||||
valid: true,
|
||||
value: inputValue,
|
||||
message: "Input is valid"
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
valid: false,
|
||||
value: inputValue,
|
||||
message: "Input must be greater than 5"
|
||||
};
|
||||
}
|
||||
connections:
|
||||
success: next-step
|
||||
error: handle-error
|
||||
```
|
||||
|
||||
### Datenverarbeitung
|
||||
|
||||
```yaml
|
||||
data-processor:
|
||||
type: function
|
||||
name: "Data Transformer"
|
||||
inputs:
|
||||
code: |
|
||||
// Transform the input data
|
||||
const rawData = <start.input>;
|
||||
|
||||
// Process and clean the data
|
||||
const processed = rawData
|
||||
.filter(item => item.status === 'active')
|
||||
.map(item => ({
|
||||
id: item.id,
|
||||
name: item.name.trim(),
|
||||
date: new Date(item.created).toISOString()
|
||||
}));
|
||||
|
||||
return processed;
|
||||
connections:
|
||||
success: api-save
|
||||
error: error-handler
|
||||
```
|
||||
|
||||
### API-Integration
|
||||
|
||||
```yaml
|
||||
api-formatter:
|
||||
type: function
|
||||
name: "Format API Request"
|
||||
inputs:
|
||||
code: |
|
||||
// Prepare data for API submission
|
||||
const userData = <agent.response>;
|
||||
|
||||
const apiPayload = {
|
||||
timestamp: new Date().toISOString(),
|
||||
data: userData,
|
||||
source: "workflow-automation",
|
||||
version: "1.0"
|
||||
};
|
||||
|
||||
return apiPayload;
|
||||
connections:
|
||||
success: api-call
|
||||
```
|
||||
|
||||
### Berechnungen
|
||||
|
||||
```yaml
|
||||
calculator:
|
||||
type: function
|
||||
name: "Calculate Results"
|
||||
inputs:
|
||||
code: |
|
||||
// Perform calculations on input data
|
||||
const numbers = <start.input>;
|
||||
|
||||
const sum = numbers.reduce((a, b) => a + b, 0);
|
||||
const average = sum / numbers.length;
|
||||
const max = Math.max(...numbers);
|
||||
const min = Math.min(...numbers);
|
||||
|
||||
return {
|
||||
sum,
|
||||
average,
|
||||
max,
|
||||
min,
|
||||
count: numbers.length
|
||||
};
|
||||
connections:
|
||||
success: results-display
|
||||
```
|
||||
@@ -1,151 +0,0 @@
|
||||
---
|
||||
title: Block-Schemas
|
||||
description: Vollständige YAML-Schema-Referenz für alle Sim-Blöcke
|
||||
---
|
||||
|
||||
import { Card, Cards } from "fumadocs-ui/components/card";
|
||||
|
||||
Dieser Abschnitt enthält die vollständigen YAML-Schema-Definitionen für alle verfügbaren Blocktypen in Sim. Jeder Blocktyp hat spezifische Konfigurationsanforderungen und Ausgabeformate.
|
||||
|
||||
## Kernblöcke
|
||||
|
||||
Dies sind die wesentlichen Bausteine für die Erstellung von Workflows:
|
||||
|
||||
<Cards>
|
||||
<Card title="Starter-Block" href="/yaml/blocks/starter">
|
||||
Workflow-Einstiegspunkt mit Unterstützung für manuelle Auslöser, Webhooks und Zeitpläne
|
||||
</Card>
|
||||
<Card title="Agent-Block" href="/yaml/blocks/agent">
|
||||
KI-gestützte Verarbeitung mit LLM-Integration und Tool-Unterstützung
|
||||
</Card>
|
||||
<Card title="Funktions-Block" href="/yaml/blocks/function">
|
||||
Ausführungsumgebung für benutzerdefinierten JavaScript/TypeScript-Code
|
||||
</Card>
|
||||
<Card title="Antwort-Block" href="/yaml/blocks/response">
|
||||
Formatierung und Rückgabe der endgültigen Workflow-Ergebnisse
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Logik & Kontrollfluss
|
||||
|
||||
Blöcke zur Implementierung von bedingter Logik und Kontrollfluss:
|
||||
|
||||
<Cards>
|
||||
<Card title="Bedingungsblock" href="/yaml/blocks/condition">
|
||||
Bedingte Verzweigung basierend auf booleschen Ausdrücken
|
||||
</Card>
|
||||
<Card title="Router-Block" href="/yaml/blocks/router">
|
||||
KI-gestützte intelligente Weiterleitung zu mehreren Pfaden
|
||||
</Card>
|
||||
<Card title="Schleifenblock" href="/yaml/blocks/loop">
|
||||
Iterative Verarbeitung mit for- und forEach-Schleifen
|
||||
</Card>
|
||||
<Card title="Parallel-Block" href="/yaml/blocks/parallel">
|
||||
Gleichzeitige Ausführung über mehrere Instanzen
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Integrationsblöcke
|
||||
|
||||
Blöcke zur Verbindung mit externen Diensten und Systemen:
|
||||
|
||||
<Cards>
|
||||
<Card title="API-Block" href="/yaml/blocks/api">
|
||||
HTTP-Anfragen an externe REST-APIs
|
||||
</Card>
|
||||
<Card title="Webhook-Block" href="/yaml/blocks/webhook">
|
||||
Webhook-Auslöser für externe Integrationen
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Erweiterte Blöcke
|
||||
|
||||
Spezialisierte Blöcke für komplexe Workflow-Muster:
|
||||
|
||||
<Cards>
|
||||
<Card title="Evaluator-Block" href="/yaml/blocks/evaluator">
|
||||
Validierung von Ausgaben anhand definierter Kriterien und Metriken
|
||||
</Card>
|
||||
<Card title="Workflow-Block" href="/yaml/blocks/workflow">
|
||||
Ausführung anderer Workflows als wiederverwendbare Komponenten
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Gemeinsame Schema-Elemente
|
||||
|
||||
Alle Blöcke teilen diese gemeinsamen Elemente:
|
||||
|
||||
### Grundstruktur
|
||||
|
||||
```yaml
|
||||
block-id:
|
||||
type: <block-type>
|
||||
name: <display-name>
|
||||
inputs:
|
||||
# Block-specific configuration
|
||||
connections:
|
||||
# Connection definitions
|
||||
```
|
||||
|
||||
### Verbindungstypen
|
||||
|
||||
- **success**: Zielblock für erfolgreiche Ausführung
|
||||
- **error**: Zielblock für Fehlerbehandlung (optional)
|
||||
- **conditions**: Mehrere Pfade für bedingte Blöcke
|
||||
|
||||
### Umgebungsvariablen
|
||||
|
||||
Verwende doppelte geschweifte Klammern für Umgebungsvariablen:
|
||||
|
||||
```yaml
|
||||
inputs:
|
||||
apiKey: '{{API_KEY_NAME}}'
|
||||
endpoint: '{{SERVICE_ENDPOINT}}'
|
||||
```
|
||||
|
||||
### Blockreferenzen
|
||||
|
||||
Referenziere andere Blockausgaben mit dem Blocknamen in Kleinbuchstaben:
|
||||
|
||||
```yaml
|
||||
inputs:
|
||||
userPrompt: <blockname.content>
|
||||
data: <functionblock.output>
|
||||
originalInput: <start.input>
|
||||
```
|
||||
|
||||
## Validierungsregeln
|
||||
|
||||
Alle YAML-Blöcke werden anhand ihrer Schemas validiert:
|
||||
|
||||
1. **Pflichtfelder**: Müssen vorhanden sein
|
||||
2. **Typvalidierung**: Werte müssen den erwarteten Typen entsprechen
|
||||
3. **Enum-Validierung**: Zeichenkettenwerte müssen aus erlaubten Listen stammen
|
||||
4. **Bereichsvalidierung**: Zahlen müssen innerhalb festgelegter Bereiche liegen
|
||||
5. **Mustervalidierung**: Zeichenketten müssen Regex-Mustern entsprechen (wo anwendbar)
|
||||
|
||||
## Kurzreferenz
|
||||
|
||||
### Blocktypen und Eigenschaften
|
||||
|
||||
| Blocktyp | Primäre Ausgabe | Häufige Anwendungsfälle |
|
||||
|------------|----------------|------------------|
|
||||
| starter | `.input` | Workflow-Einstiegspunkt |
|
||||
| agent | `.content` | KI-Verarbeitung, Texterstellung |
|
||||
| function | `.output` | Datentransformation, Berechnungen |
|
||||
| api | `.output` | Integration externer Dienste |
|
||||
| condition | N/A (Verzweigung) | Bedingte Logik |
|
||||
| router | N/A (Verzweigung) | Intelligentes Routing |
|
||||
| response | N/A (Terminal) | Formatierung der Endausgabe |
|
||||
| loop | `.results` | Iterative Verarbeitung |
|
||||
| parallel | `.results` | Gleichzeitige Verarbeitung |
|
||||
| webhook | `.payload` | Externe Auslöser |
|
||||
| evaluator | `.score` | Ausgabevalidierung, Qualitätsbewertung |
|
||||
| workflow | `.output` | Ausführung von Unterworkflows, Modularität |
|
||||
|
||||
### Erforderlich vs. Optional
|
||||
|
||||
- **Immer erforderlich**: `type`, `name`
|
||||
- **Normalerweise erforderlich**: `inputs`, `connections`
|
||||
- **Kontextabhängig**: Spezifische Eingabefelder variieren je nach Blocktyp
|
||||
- **Immer optional**: `error`Verbindungen, UI-spezifische Felder
|
||||
@@ -1,312 +0,0 @@
|
||||
---
|
||||
title: Parallel Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für Parallel-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
- connections
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [parallel]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this parallel block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- parallelType
|
||||
properties:
|
||||
parallelType:
|
||||
type: string
|
||||
enum: [count, collection]
|
||||
description: Type of parallel execution
|
||||
count:
|
||||
type: number
|
||||
description: Number of parallel instances (for 'count' type)
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
collection:
|
||||
type: string
|
||||
description: Collection to distribute across instances (for 'collection' type)
|
||||
maxConcurrency:
|
||||
type: number
|
||||
description: Maximum concurrent executions
|
||||
default: 10
|
||||
minimum: 1
|
||||
maximum: 50
|
||||
connections:
|
||||
type: object
|
||||
required:
|
||||
- parallel
|
||||
properties:
|
||||
parallel:
|
||||
type: object
|
||||
required:
|
||||
- start
|
||||
properties:
|
||||
start:
|
||||
type: string
|
||||
description: Target block ID to execute inside each parallel instance
|
||||
end:
|
||||
type: string
|
||||
description: Target block ID after all parallel instances complete (optional)
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Parallel-Blöcke verwenden ein spezielles Verbindungsformat mit einem `parallel` Abschnitt:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
parallel:
|
||||
start: <string> # Target block ID to execute inside each parallel instance
|
||||
end: <string> # Target block ID after all instances complete (optional)
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Konfiguration von untergeordneten Blöcken
|
||||
|
||||
Blöcke innerhalb eines Parallel-Blocks müssen ihre `parentId` auf die Parallel-Block-ID setzen:
|
||||
|
||||
```yaml
|
||||
parallel-1:
|
||||
type: parallel
|
||||
name: "Process Items"
|
||||
inputs:
|
||||
parallelType: collection
|
||||
collection: <start.items>
|
||||
connections:
|
||||
parallel:
|
||||
start: process-item
|
||||
end: aggregate-results
|
||||
|
||||
# Child block inside the parallel
|
||||
process-item:
|
||||
type: agent
|
||||
name: "Process Item"
|
||||
parentId: parallel-1 # References the parallel block
|
||||
inputs:
|
||||
systemPrompt: "Process this item"
|
||||
userPrompt: <parallel.currentItem>
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Anzahlbasierte Parallelverarbeitung
|
||||
|
||||
```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": <parallel.index>,
|
||||
"timestamp": "{{new Date().toISOString()}}"
|
||||
}
|
||||
connections:
|
||||
success: worker-complete
|
||||
```
|
||||
|
||||
### Sammlungsbasierte Parallelverarbeitung
|
||||
|
||||
```yaml
|
||||
api-parallel:
|
||||
type: parallel
|
||||
name: "API Parallel"
|
||||
inputs:
|
||||
parallelType: collection
|
||||
collection: <start.apiEndpoints>
|
||||
maxConcurrency: 10
|
||||
connections:
|
||||
parallel:
|
||||
start: call-api
|
||||
end: merge-api-results
|
||||
|
||||
call-api:
|
||||
type: api
|
||||
name: "Call API"
|
||||
parentId: api-parallel
|
||||
inputs:
|
||||
url: <parallel.currentItem.endpoint>
|
||||
method: <parallel.currentItem.method>
|
||||
headers:
|
||||
- key: "Authorization"
|
||||
value: "Bearer {{API_TOKEN}}"
|
||||
connections:
|
||||
success: api-complete
|
||||
```
|
||||
|
||||
### Komplexe parallele Verarbeitungspipeline
|
||||
|
||||
```yaml
|
||||
data-processing-parallel:
|
||||
type: parallel
|
||||
name: "Data Processing Parallel"
|
||||
inputs:
|
||||
parallelType: collection
|
||||
collection: <data-loader.records>
|
||||
maxConcurrency: 8
|
||||
connections:
|
||||
parallel:
|
||||
start: validate-data
|
||||
end: final-aggregation
|
||||
error: parallel-error-handler
|
||||
|
||||
validate-data:
|
||||
type: function
|
||||
name: "Validate Data"
|
||||
parentId: data-processing-parallel
|
||||
inputs:
|
||||
code: |
|
||||
const record = <parallel.currentItem>;
|
||||
const index = <parallel.index>;
|
||||
|
||||
// Validate record structure
|
||||
if (!record.id || !record.content) {
|
||||
throw new Error(`Invalid record at index ${index}`);
|
||||
}
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
recordId: record.id,
|
||||
validatedAt: new Date().toISOString()
|
||||
};
|
||||
connections:
|
||||
success: process-data
|
||||
error: validation-error
|
||||
|
||||
process-data:
|
||||
type: agent
|
||||
name: "Process Data"
|
||||
parentId: data-processing-parallel
|
||||
inputs:
|
||||
systemPrompt: "Process and analyze this data record"
|
||||
userPrompt: |
|
||||
Record ID: <validatedata.recordId>
|
||||
Content: <parallel.currentItem.content>
|
||||
Instance: <parallel.index>
|
||||
model: gpt-4o
|
||||
temperature: 0.3
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: store-result
|
||||
|
||||
store-result:
|
||||
type: function
|
||||
name: "Store Result"
|
||||
parentId: data-processing-parallel
|
||||
inputs:
|
||||
code: |
|
||||
const processed = <processdata.content>;
|
||||
const recordId = <validatedata.recordId>;
|
||||
|
||||
return {
|
||||
recordId,
|
||||
processed,
|
||||
completedAt: new Date().toISOString(),
|
||||
instanceIndex: <parallel.index>
|
||||
};
|
||||
```
|
||||
|
||||
### Gleichzeitige KI-Analyse
|
||||
|
||||
```yaml
|
||||
multi-model-parallel:
|
||||
type: parallel
|
||||
name: "Multi-Model Analysis"
|
||||
inputs:
|
||||
parallelType: collection
|
||||
collection: |
|
||||
[
|
||||
{"model": "gpt-4o", "focus": "technical accuracy"},
|
||||
{"model": "claude-3-5-sonnet-20241022", "focus": "creative quality"},
|
||||
{"model": "gemini-2.0-flash-exp", "focus": "factual verification"}
|
||||
]
|
||||
maxConcurrency: 3
|
||||
connections:
|
||||
parallel:
|
||||
start: analyze-content
|
||||
end: combine-analyses
|
||||
|
||||
analyze-content:
|
||||
type: agent
|
||||
name: "Analyze Content"
|
||||
parentId: multi-model-parallel
|
||||
inputs:
|
||||
systemPrompt: |
|
||||
You are analyzing content with a focus on <parallel.currentItem.focus>.
|
||||
Provide detailed analysis from this perspective.
|
||||
userPrompt: |
|
||||
Content to analyze: <start.content>
|
||||
Analysis focus: <parallel.currentItem.focus>
|
||||
model: <parallel.currentItem.model>
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: analysis-complete
|
||||
```
|
||||
|
||||
## Parallele Variablen
|
||||
|
||||
Innerhalb von untergeordneten Parallel-Blöcken sind diese speziellen Variablen verfügbar:
|
||||
|
||||
```yaml
|
||||
# Available in all child blocks of the parallel
|
||||
<parallel.index> # Instance number (0-based)
|
||||
<parallel.currentItem> # Item for this instance (collection type)
|
||||
<parallel.items> # Full collection (collection type)
|
||||
```
|
||||
|
||||
## Ausgabereferenzen
|
||||
|
||||
Nach Abschluss eines Parallel-Blocks können Sie auf seine aggregierten Ergebnisse verweisen:
|
||||
|
||||
```yaml
|
||||
# In blocks after the parallel
|
||||
final-processor:
|
||||
inputs:
|
||||
all-results: <parallel-name.results> # Array of all instance results
|
||||
total-count: <parallel-name.count> # Number of instances completed
|
||||
```
|
||||
|
||||
## Bewährte Praktiken
|
||||
|
||||
- Verwenden Sie angemessene maxConcurrency, um APIs nicht zu überlasten
|
||||
- Stellen Sie sicher, dass Operationen unabhängig sind und nicht voneinander abhängen
|
||||
- Implementieren Sie Fehlerbehandlung für robuste parallele Ausführung
|
||||
- Testen Sie zuerst mit kleinen Sammlungen
|
||||
- Überwachen Sie Ratenbegrenzungen für externe APIs
|
||||
- Verwenden Sie den Collection-Typ zur Verteilung von Arbeit, den Count-Typ für feste Instanzen
|
||||
- Berücksichtigen Sie den Speicherverbrauch bei großen Sammlungen
|
||||
@@ -1,239 +0,0 @@
|
||||
---
|
||||
title: Response Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für Response-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [response]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this response block
|
||||
inputs:
|
||||
type: object
|
||||
properties:
|
||||
dataMode:
|
||||
type: string
|
||||
enum: [structured, json]
|
||||
description: Mode for defining response data structure
|
||||
default: structured
|
||||
builderData:
|
||||
type: object
|
||||
description: Structured response data (when dataMode is 'structured')
|
||||
data:
|
||||
type: object
|
||||
description: JSON response data (when dataMode is 'json')
|
||||
status:
|
||||
type: number
|
||||
description: HTTP status code
|
||||
default: 200
|
||||
minimum: 100
|
||||
maximum: 599
|
||||
headers:
|
||||
type: array
|
||||
description: Response headers as table entries
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Unique identifier for the header entry
|
||||
key:
|
||||
type: string
|
||||
description: Header name
|
||||
value:
|
||||
type: string
|
||||
description: Header value
|
||||
cells:
|
||||
type: object
|
||||
description: Cell display values for the table interface
|
||||
properties:
|
||||
Key:
|
||||
type: string
|
||||
description: Display value for the key column
|
||||
Value:
|
||||
type: string
|
||||
description: Display value for the value column
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Response-Blöcke sind Endblöcke (keine ausgehenden Verbindungen) und definieren die endgültige Ausgabe:
|
||||
|
||||
```yaml
|
||||
# No connections object needed - Response blocks are always terminal
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfache Antwort
|
||||
|
||||
```yaml
|
||||
simple-response:
|
||||
type: response
|
||||
name: "Simple Response"
|
||||
inputs:
|
||||
data:
|
||||
message: "Hello World"
|
||||
timestamp: <function.timestamp>
|
||||
status: 200
|
||||
```
|
||||
|
||||
### Erfolgreiche Antwort
|
||||
|
||||
```yaml
|
||||
success-response:
|
||||
type: response
|
||||
name: "Success Response"
|
||||
inputs:
|
||||
data:
|
||||
success: true
|
||||
user:
|
||||
id: <agent.user_id>
|
||||
name: <agent.user_name>
|
||||
email: <agent.user_email>
|
||||
created_at: <function.timestamp>
|
||||
status: 201
|
||||
headers:
|
||||
- key: "Location"
|
||||
value: "/api/users/<agent.user_id>"
|
||||
- key: "X-Created-By"
|
||||
value: "workflow-engine"
|
||||
```
|
||||
|
||||
### Antwort mit vollständigem Tabellenkopfformat
|
||||
|
||||
Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten:
|
||||
|
||||
```yaml
|
||||
api-response:
|
||||
type: response
|
||||
name: "API Response"
|
||||
inputs:
|
||||
data:
|
||||
message: "Request processed successfully"
|
||||
id: <agent.request_id>
|
||||
status: 200
|
||||
headers:
|
||||
- id: header-1-uuid-here
|
||||
key: "Content-Type"
|
||||
value: "application/json"
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
- id: header-2-uuid-here
|
||||
key: "Cache-Control"
|
||||
value: "no-cache"
|
||||
cells:
|
||||
Key: "Cache-Control"
|
||||
Value: "no-cache"
|
||||
- id: header-3-uuid-here
|
||||
key: "X-API-Version"
|
||||
value: "2.1"
|
||||
cells:
|
||||
Key: "X-API-Version"
|
||||
Value: "2.1"
|
||||
```
|
||||
|
||||
### Fehlerantwort
|
||||
|
||||
```yaml
|
||||
error-response:
|
||||
type: response
|
||||
name: "Error Response"
|
||||
inputs:
|
||||
data:
|
||||
error: true
|
||||
message: <agent.error_message>
|
||||
code: "VALIDATION_FAILED"
|
||||
details: <function.validation_errors>
|
||||
status: 400
|
||||
headers:
|
||||
- key: "X-Error-Code"
|
||||
value: "VALIDATION_FAILED"
|
||||
```
|
||||
|
||||
### Paginierte Antwort
|
||||
|
||||
```yaml
|
||||
paginated-response:
|
||||
type: response
|
||||
name: "Paginated Response"
|
||||
inputs:
|
||||
data:
|
||||
data: <agent.results>
|
||||
pagination:
|
||||
page: <start.page>
|
||||
per_page: <start.per_page>
|
||||
total: <function.total_count>
|
||||
total_pages: <function.total_pages>
|
||||
status: 200
|
||||
headers:
|
||||
- key: "X-Total-Count"
|
||||
value: <function.total_count>
|
||||
- key: "Cache-Control"
|
||||
value: "public, max-age=300"
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
```
|
||||
|
||||
## Tabellenparameterformate
|
||||
|
||||
Der Response-Block unterstützt zwei Formate für Header:
|
||||
|
||||
### Vereinfachtes Format (manuelles YAML)
|
||||
|
||||
Beim manuellen Schreiben von YAML können Sie das vereinfachte Format verwenden:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
- key: "Cache-Control"
|
||||
value: "no-cache"
|
||||
```
|
||||
|
||||
### Vollständiges Tabellenformat (UI-generiert)
|
||||
|
||||
Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- id: unique-identifier-here
|
||||
key: "Content-Type"
|
||||
value: "application/json"
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
```
|
||||
|
||||
**Wesentliche Unterschiede:**
|
||||
- `id`: Eindeutiger Identifikator zur Verfolgung der Tabellenzeile
|
||||
- `cells`: Anzeigewerte, die von der UI-Tabellenschnittstelle verwendet werden
|
||||
- Beide Formate sind für die Workflow-Ausführung funktional gleichwertig
|
||||
- Das vollständige Format bewahrt den UI-Status beim Importieren/Exportieren von Workflows
|
||||
|
||||
**Wichtig:** Setzen Sie Header-Namen und Werte, die Sonderzeichen enthalten, immer in Anführungszeichen:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- id: content-type-uuid
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
- id: cache-control-uuid
|
||||
cells:
|
||||
Key: "Cache-Control"
|
||||
Value: "no-cache"
|
||||
```
|
||||
|
||||
```
|
||||
@@ -1,200 +0,0 @@
|
||||
---
|
||||
title: Router Block YAML Schema
|
||||
description: YAML-Konfigurationsreferenz für Router-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [router]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this router block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- prompt
|
||||
- model
|
||||
- apiKey
|
||||
properties:
|
||||
prompt:
|
||||
type: string
|
||||
description: Instructions for routing decisions and criteria
|
||||
model:
|
||||
type: string
|
||||
description: AI model identifier (e.g., gpt-4o, gemini-2.5-pro, deepseek-chat)
|
||||
apiKey:
|
||||
type: string
|
||||
description: API key for the model provider (use {{ENV_VAR}} format)
|
||||
temperature:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 2
|
||||
description: Model temperature for routing decisions
|
||||
default: 0.3
|
||||
azureEndpoint:
|
||||
type: string
|
||||
description: Azure OpenAI endpoint URL (required for Azure models)
|
||||
azureApiVersion:
|
||||
type: string
|
||||
description: Azure API version (required for Azure models)
|
||||
connections:
|
||||
type: object
|
||||
description: Multiple connection paths for different routing outcomes
|
||||
properties:
|
||||
success:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Array of target block IDs for routing destinations
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Router-Blöcke verwenden ein success-Array, das alle möglichen Routing-Ziele enthält:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success:
|
||||
- <string> # Target block ID option 1
|
||||
- <string> # Target block ID option 2
|
||||
- <string> # Target block ID option 3
|
||||
# Additional target block IDs as needed
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Content-Type-Router
|
||||
|
||||
```yaml
|
||||
content-router:
|
||||
type: router
|
||||
name: "Content Type Router"
|
||||
inputs:
|
||||
prompt: |
|
||||
Route this content based on its type:
|
||||
- If it's a question, route to question-handler
|
||||
- If it's a complaint, route to complaint-handler
|
||||
- If it's feedback, route to feedback-handler
|
||||
- If it's a request, route to request-handler
|
||||
|
||||
Content: <start.input>
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success:
|
||||
- question-handler
|
||||
- complaint-handler
|
||||
- feedback-handler
|
||||
- request-handler
|
||||
```
|
||||
|
||||
### Prioritäts-Router
|
||||
|
||||
```yaml
|
||||
priority-router:
|
||||
type: router
|
||||
name: "Priority Router"
|
||||
inputs:
|
||||
prompt: |
|
||||
Analyze the urgency and route accordingly:
|
||||
- urgent-queue: High priority, needs immediate attention
|
||||
- standard-queue: Normal priority, standard processing
|
||||
- low-queue: Low priority, can be delayed
|
||||
|
||||
Email content: <email-analyzer.content>
|
||||
|
||||
Route based on urgency indicators, deadlines, and tone.
|
||||
model: gpt-4o
|
||||
temperature: 0.2
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success:
|
||||
- urgent-queue
|
||||
- standard-queue
|
||||
- low-queue
|
||||
```
|
||||
|
||||
### Abteilungs-Router
|
||||
|
||||
```yaml
|
||||
department-router:
|
||||
type: router
|
||||
name: "Department Router"
|
||||
inputs:
|
||||
prompt: |
|
||||
Route this customer inquiry to the appropriate department:
|
||||
|
||||
- sales-team: Sales questions, pricing, demos
|
||||
- support-team: Technical issues, bug reports, how-to questions
|
||||
- billing-team: Payment issues, subscription changes, invoices
|
||||
- general-team: General inquiries, feedback, other topics
|
||||
|
||||
Customer message: <start.input>
|
||||
Customer type: <customer-analyzer.type>
|
||||
model: claude-3-5-sonnet-20241022
|
||||
apiKey: '{{ANTHROPIC_API_KEY}}'
|
||||
connections:
|
||||
success:
|
||||
- sales-team
|
||||
- support-team
|
||||
- billing-team
|
||||
- general-team
|
||||
```
|
||||
|
||||
## Erweiterte Konfiguration
|
||||
|
||||
### Multi-Modell-Router
|
||||
|
||||
```yaml
|
||||
model-selector-router:
|
||||
type: router
|
||||
name: "Model Selection Router"
|
||||
inputs:
|
||||
prompt: |
|
||||
Based on the task complexity, route to the appropriate model:
|
||||
- simple-gpt35: Simple questions, basic tasks
|
||||
- advanced-gpt4: Complex analysis, detailed reasoning
|
||||
- specialized-claude: Creative writing, nuanced analysis
|
||||
|
||||
Task: <start.task>
|
||||
Complexity indicators: <analyzer.complexity>
|
||||
model: gpt-4o-mini
|
||||
temperature: 0.1
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success:
|
||||
- simple-gpt35
|
||||
- advanced-gpt4
|
||||
- specialized-claude
|
||||
```
|
||||
|
||||
## Output-Referenzen
|
||||
|
||||
Router-Blöcke erzeugen keine direkten Outputs, sondern steuern den Workflow-Pfad:
|
||||
|
||||
```yaml
|
||||
# Router decisions affect which subsequent blocks execute
|
||||
# Access the routed block's outputs normally:
|
||||
final-step:
|
||||
inputs:
|
||||
routed-result: <routed-block-name.content>
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Klare Routing-Kriterien im Prompt angeben
|
||||
- Spezifische, beschreibende Namen für Zielblöcke verwenden
|
||||
- Beispiele für Inhalte für jeden Routing-Pfad einschließen
|
||||
- Niedrigere Temperaturwerte für konsistentes Routing verwenden
|
||||
- Mit verschiedenen Eingabetypen testen, um genaues Routing sicherzustellen
|
||||
- Fallback-Pfade für Sonderfälle berücksichtigen
|
||||
@@ -1,183 +0,0 @@
|
||||
---
|
||||
title: YAML-Schema für Starter-Block
|
||||
description: YAML-Konfigurationsreferenz für Starter-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [starter]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this starter block
|
||||
inputs:
|
||||
type: object
|
||||
properties:
|
||||
startWorkflow:
|
||||
type: string
|
||||
enum: [manual, webhook, schedule]
|
||||
description: How the workflow should be triggered
|
||||
default: manual
|
||||
inputFormat:
|
||||
type: array
|
||||
description: Expected input structure for API calls (manual workflows)
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: Field name
|
||||
type:
|
||||
type: string
|
||||
enum: [string, number, boolean, object, array]
|
||||
description: Field type
|
||||
scheduleType:
|
||||
type: string
|
||||
enum: [hourly, daily, weekly, monthly]
|
||||
description: Schedule frequency (schedule workflows only)
|
||||
hourlyMinute:
|
||||
type: number
|
||||
minimum: 0
|
||||
maximum: 59
|
||||
description: Minute of the hour to run (hourly schedules)
|
||||
dailyTime:
|
||||
type: string
|
||||
pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"
|
||||
description: Time of day to run in HH:MM format (daily schedules)
|
||||
weeklyDay:
|
||||
type: string
|
||||
enum: [MON, TUE, WED, THU, FRI, SAT, SUN]
|
||||
description: Day of week to run (weekly schedules)
|
||||
weeklyTime:
|
||||
type: string
|
||||
pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"
|
||||
description: Time of day to run in HH:MM format (weekly schedules)
|
||||
monthlyDay:
|
||||
type: number
|
||||
minimum: 1
|
||||
maximum: 28
|
||||
description: Day of month to run (monthly schedules)
|
||||
monthlyTime:
|
||||
type: string
|
||||
pattern: "^([01]?[0-9]|2[0-3]):[0-5][0-9]$"
|
||||
description: Time of day to run in HH:MM format (monthly schedules)
|
||||
timezone:
|
||||
type: string
|
||||
description: Timezone for scheduled workflows
|
||||
default: UTC
|
||||
webhookProvider:
|
||||
type: string
|
||||
enum: [slack, gmail, airtable, telegram, generic, whatsapp, github, discord, stripe]
|
||||
description: Provider for webhook integration (webhook workflows only)
|
||||
webhookConfig:
|
||||
type: object
|
||||
description: Provider-specific webhook configuration
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID to execute when workflow starts
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Der Starter-Block hat nur eine Erfolgsverbindung, da er der Einstiegspunkt ist:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID to execute when workflow starts
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Manueller Start
|
||||
|
||||
```yaml
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: manual
|
||||
connections:
|
||||
success: next-block
|
||||
```
|
||||
|
||||
### Manueller Start mit Eingabeformat
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### Täglicher Zeitplan
|
||||
|
||||
```yaml
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: schedule
|
||||
scheduleType: daily
|
||||
dailyTime: "09:00"
|
||||
timezone: "America/New_York"
|
||||
connections:
|
||||
success: daily-task
|
||||
```
|
||||
|
||||
### Wöchentlicher Zeitplan
|
||||
|
||||
```yaml
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: schedule
|
||||
scheduleType: weekly
|
||||
weeklyDay: MON
|
||||
weeklyTime: "08:30"
|
||||
timezone: UTC
|
||||
connections:
|
||||
success: weekly-report
|
||||
```
|
||||
|
||||
### Webhook-Auslöser
|
||||
|
||||
```yaml
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: webhook
|
||||
webhookProvider: slack
|
||||
webhookConfig:
|
||||
# Provider-specific configuration
|
||||
connections:
|
||||
success: process-webhook
|
||||
```
|
||||
@@ -1,403 +0,0 @@
|
||||
---
|
||||
title: Webhook-Block YAML-Schema
|
||||
description: YAML-Konfigurationsreferenz für Webhook-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [webhook]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this webhook block
|
||||
inputs:
|
||||
type: object
|
||||
properties:
|
||||
webhookConfig:
|
||||
type: object
|
||||
description: Webhook configuration settings
|
||||
properties:
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Whether the webhook is active
|
||||
default: true
|
||||
secret:
|
||||
type: string
|
||||
description: Secret key for webhook verification
|
||||
headers:
|
||||
type: array
|
||||
description: Expected headers for validation as table entries
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Unique identifier for the header entry
|
||||
key:
|
||||
type: string
|
||||
description: Header name
|
||||
value:
|
||||
type: string
|
||||
description: Expected header value
|
||||
cells:
|
||||
type: object
|
||||
description: Cell display values for the table interface
|
||||
properties:
|
||||
Key:
|
||||
type: string
|
||||
description: Display value for the key column
|
||||
Value:
|
||||
type: string
|
||||
description: Display value for the value column
|
||||
methods:
|
||||
type: array
|
||||
description: Allowed HTTP methods
|
||||
items:
|
||||
type: string
|
||||
enum: [GET, POST, PUT, DELETE, PATCH]
|
||||
default: [POST]
|
||||
responseConfig:
|
||||
type: object
|
||||
description: Response configuration for the webhook
|
||||
properties:
|
||||
status:
|
||||
type: number
|
||||
description: HTTP status code to return
|
||||
default: 200
|
||||
minimum: 100
|
||||
maximum: 599
|
||||
headers:
|
||||
type: array
|
||||
description: Response headers as table entries
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Unique identifier for the header entry
|
||||
key:
|
||||
type: string
|
||||
description: Header name
|
||||
value:
|
||||
type: string
|
||||
description: Header value
|
||||
cells:
|
||||
type: object
|
||||
description: Cell display values for the table interface
|
||||
properties:
|
||||
Key:
|
||||
type: string
|
||||
description: Display value for the key column
|
||||
Value:
|
||||
type: string
|
||||
description: Display value for the value column
|
||||
body:
|
||||
type: string
|
||||
description: Response body content
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful webhook processing
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf der Webhook-Verarbeitung geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful processing
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfacher Webhook-Auslöser
|
||||
|
||||
```yaml
|
||||
github-webhook:
|
||||
type: webhook
|
||||
name: "GitHub Webhook"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
secret: "{{GITHUB_WEBHOOK_SECRET}}"
|
||||
methods: [POST]
|
||||
headers:
|
||||
- key: "X-GitHub-Event"
|
||||
value: "push"
|
||||
responseConfig:
|
||||
status: 200
|
||||
body: |
|
||||
{
|
||||
"message": "Webhook received successfully",
|
||||
"timestamp": "{{new Date().toISOString()}}"
|
||||
}
|
||||
connections:
|
||||
success: process-github-event
|
||||
error: webhook-error-handler
|
||||
```
|
||||
|
||||
### Slack-Event-Webhook
|
||||
|
||||
```yaml
|
||||
slack-events:
|
||||
type: webhook
|
||||
name: "Slack Events"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
secret: "{{SLACK_SIGNING_SECRET}}"
|
||||
methods: [POST]
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
responseConfig:
|
||||
status: 200
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
body: |
|
||||
{
|
||||
"challenge": "<webhook.challenge>"
|
||||
}
|
||||
connections:
|
||||
success: handle-slack-event
|
||||
```
|
||||
|
||||
### Zahlungs-Webhook (Stripe)
|
||||
|
||||
```yaml
|
||||
stripe-webhook:
|
||||
type: webhook
|
||||
name: "Stripe Payment Webhook"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
secret: "{{STRIPE_WEBHOOK_SECRET}}"
|
||||
methods: [POST]
|
||||
headers:
|
||||
- key: "Stripe-Signature"
|
||||
value: "*"
|
||||
responseConfig:
|
||||
status: 200
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
body: |
|
||||
{
|
||||
"received": true
|
||||
}
|
||||
connections:
|
||||
success: process-payment-event
|
||||
error: payment-webhook-error
|
||||
```
|
||||
|
||||
### Webhook mit vollständigem Tabellenkopfformat
|
||||
|
||||
Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten:
|
||||
|
||||
```yaml
|
||||
api-webhook-complete:
|
||||
type: webhook
|
||||
name: "API Webhook with Table Headers"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
methods: [POST]
|
||||
headers:
|
||||
- id: header-1-uuid-here
|
||||
key: "Authorization"
|
||||
value: "Bearer {{WEBHOOK_API_KEY}}"
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{WEBHOOK_API_KEY}}"
|
||||
- id: header-2-uuid-here
|
||||
key: "Content-Type"
|
||||
value: "application/json"
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
responseConfig:
|
||||
status: 200
|
||||
headers:
|
||||
- id: response-header-1-uuid
|
||||
key: "Content-Type"
|
||||
value: "application/json"
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
- id: response-header-2-uuid
|
||||
key: "X-Webhook-Response"
|
||||
value: "processed"
|
||||
cells:
|
||||
Key: "X-Webhook-Response"
|
||||
Value: "processed"
|
||||
body: |
|
||||
{
|
||||
"status": "received",
|
||||
"timestamp": "{{new Date().toISOString()}}"
|
||||
}
|
||||
connections:
|
||||
success: process-webhook-complete
|
||||
```
|
||||
|
||||
### Generischer API-Webhook
|
||||
|
||||
```yaml
|
||||
api-webhook:
|
||||
type: webhook
|
||||
name: "API Webhook"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
methods: [POST, PUT]
|
||||
headers:
|
||||
- key: "Authorization"
|
||||
value: "Bearer {{WEBHOOK_API_KEY}}"
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
responseConfig:
|
||||
status: 202
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
- key: "X-Processed-By"
|
||||
value: "Sim"
|
||||
body: |
|
||||
{
|
||||
"status": "accepted",
|
||||
"id": "{{Math.random().toString(36).substr(2, 9)}}",
|
||||
"received_at": "{{new Date().toISOString()}}"
|
||||
}
|
||||
connections:
|
||||
success: process-webhook-data
|
||||
```
|
||||
|
||||
### Multi-Methoden-Webhook
|
||||
|
||||
```yaml
|
||||
crud-webhook:
|
||||
type: webhook
|
||||
name: "CRUD Webhook"
|
||||
inputs:
|
||||
webhookConfig:
|
||||
enabled: true
|
||||
methods: [GET, POST, PUT, DELETE]
|
||||
headers:
|
||||
- key: "X-API-Key"
|
||||
value: "{{CRUD_API_KEY}}"
|
||||
responseConfig:
|
||||
status: 200
|
||||
headers:
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
body: |
|
||||
{
|
||||
"method": "<webhook.method>",
|
||||
"processed": true,
|
||||
"timestamp": "{{new Date().toISOString()}}"
|
||||
}
|
||||
connections:
|
||||
success: route-by-method
|
||||
```
|
||||
|
||||
## Tabellenparameterformate
|
||||
|
||||
Der Webhook-Block unterstützt zwei Formate für Header (sowohl Validierungs-Header als auch Antwort-Header):
|
||||
|
||||
### Vereinfachtes Format (manuelles YAML)
|
||||
|
||||
Beim manuellen Schreiben von YAML können Sie das vereinfachte Format verwenden:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- key: "Authorization"
|
||||
value: "Bearer {{API_TOKEN}}"
|
||||
- key: "Content-Type"
|
||||
value: "application/json"
|
||||
```
|
||||
|
||||
### Vollständiges Tabellenformat (UI-generiert)
|
||||
|
||||
Wenn Header über die UI-Tabellenschnittstelle erstellt werden, enthält das YAML zusätzliche Metadaten:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- id: unique-identifier-here
|
||||
key: "Authorization"
|
||||
value: "Bearer {{API_TOKEN}}"
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{API_TOKEN}}"
|
||||
```
|
||||
|
||||
**Wesentliche Unterschiede:**
|
||||
- `id`: Eindeutige Kennung zur Verfolgung der Tabellenzeile
|
||||
- `cells`: Anzeigewerte, die von der UI-Tabellenschnittstelle verwendet werden
|
||||
- Beide Formate sind für die Webhook-Verarbeitung funktional gleichwertig
|
||||
- Das vollständige Format bewahrt den UI-Status beim Importieren/Exportieren von Workflows
|
||||
|
||||
**Wichtig:** Setzen Sie Headernamen und Werte, die Sonderzeichen enthalten, immer in Anführungszeichen:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
- id: auth-header-uuid
|
||||
cells:
|
||||
Key: "Authorization"
|
||||
Value: "Bearer {{WEBHOOK_API_KEY}}"
|
||||
- id: content-type-uuid
|
||||
cells:
|
||||
Key: "Content-Type"
|
||||
Value: "application/json"
|
||||
```
|
||||
|
||||
## Webhook-Variablen
|
||||
|
||||
In Webhook-ausgelösten Workflows sind diese speziellen Variablen verfügbar:
|
||||
|
||||
```yaml
|
||||
# Available in blocks after the webhook
|
||||
<webhook.payload> # Full request payload/body
|
||||
<webhook.headers> # Request headers
|
||||
<webhook.method> # HTTP method used
|
||||
<webhook.query> # Query parameters
|
||||
<webhook.path> # Request path
|
||||
<webhook.challenge> # Challenge parameter (for verification)
|
||||
```
|
||||
|
||||
## Ausgabereferenzen
|
||||
|
||||
Nachdem ein Webhook eine Anfrage verarbeitet hat, können Sie auf seine Daten verweisen:
|
||||
|
||||
```yaml
|
||||
# In subsequent blocks
|
||||
process-webhook:
|
||||
inputs:
|
||||
payload: <webhook-name.payload> # Request payload
|
||||
headers: <webhook-name.headers> # Request headers
|
||||
method: <webhook-name.method> # HTTP method
|
||||
```
|
||||
|
||||
## Sicherheits-Best-Practices
|
||||
|
||||
- Verwenden Sie immer Webhook-Geheimnisse zur Verifizierung
|
||||
- Validieren Sie erwartete Header und Methoden
|
||||
- Implementieren Sie angemessene Fehlerbehandlung
|
||||
- Verwenden Sie HTTPS-Endpunkte in der Produktion
|
||||
- Überwachen Sie Webhook-Aktivitäten und -Fehler
|
||||
- Setzen Sie angemessene Antwort-Timeouts
|
||||
- Validieren Sie die Payload-Struktur vor der Verarbeitung
|
||||
@@ -1,299 +0,0 @@
|
||||
---
|
||||
title: YAML-Schema für Workflow-Blöcke
|
||||
description: YAML-Konfigurationsreferenz für Workflow-Blöcke
|
||||
---
|
||||
|
||||
## Schema-Definition
|
||||
|
||||
```yaml
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [workflow]
|
||||
description: Block type identifier
|
||||
name:
|
||||
type: string
|
||||
description: Display name for this workflow block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- workflowId
|
||||
properties:
|
||||
workflowId:
|
||||
type: string
|
||||
description: ID of the workflow to execute
|
||||
inputMapping:
|
||||
type: object
|
||||
description: Map current workflow data to sub-workflow inputs
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Input value or reference to parent workflow data
|
||||
environmentVariables:
|
||||
type: object
|
||||
description: Environment variables to pass to sub-workflow
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Environment variable value
|
||||
timeout:
|
||||
type: number
|
||||
description: Maximum execution time in milliseconds
|
||||
default: 300000
|
||||
minimum: 1000
|
||||
maximum: 1800000
|
||||
connections:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: string
|
||||
description: Target block ID for successful workflow completion
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
```
|
||||
|
||||
## Verbindungskonfiguration
|
||||
|
||||
Verbindungen definieren, wohin der Workflow basierend auf den Ergebnissen des Unter-Workflows geht:
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
success: <string> # Target block ID for successful completion
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
## Beispiele
|
||||
|
||||
### Einfache Workflow-Ausführung
|
||||
|
||||
```yaml
|
||||
data-processor:
|
||||
type: workflow
|
||||
name: "Data Processing Workflow"
|
||||
inputs:
|
||||
workflowId: "data-processing-v2"
|
||||
inputMapping:
|
||||
rawData: <start.input>
|
||||
userId: <user-validator.userId>
|
||||
environmentVariables:
|
||||
PROCESSING_MODE: "production"
|
||||
LOG_LEVEL: "info"
|
||||
connections:
|
||||
success: process-results
|
||||
error: workflow-error-handler
|
||||
```
|
||||
|
||||
### Content-Generierungs-Pipeline
|
||||
|
||||
```yaml
|
||||
content-generator:
|
||||
type: workflow
|
||||
name: "Content Generation Pipeline"
|
||||
inputs:
|
||||
workflowId: "content-generation-v3"
|
||||
inputMapping:
|
||||
topic: <start.topic>
|
||||
style: <style-analyzer.recommendedStyle>
|
||||
targetAudience: <audience-detector.audience>
|
||||
brandGuidelines: <brand-config.guidelines>
|
||||
environmentVariables:
|
||||
CONTENT_API_KEY: "{{CONTENT_API_KEY}}"
|
||||
QUALITY_THRESHOLD: "high"
|
||||
timeout: 120000
|
||||
connections:
|
||||
success: review-content
|
||||
error: content-generation-failed
|
||||
```
|
||||
|
||||
### Mehrstufiger Analyse-Workflow
|
||||
|
||||
```yaml
|
||||
analysis-workflow:
|
||||
type: workflow
|
||||
name: "Analysis Workflow"
|
||||
inputs:
|
||||
workflowId: "comprehensive-analysis"
|
||||
inputMapping:
|
||||
document: <document-processor.content>
|
||||
analysisType: "comprehensive"
|
||||
includeMetrics: true
|
||||
outputFormat: "structured"
|
||||
environmentVariables:
|
||||
ANALYSIS_MODEL: "gpt-4o"
|
||||
OPENAI_API_KEY: "{{OPENAI_API_KEY}}"
|
||||
CLAUDE_API_KEY: "{{CLAUDE_API_KEY}}"
|
||||
connections:
|
||||
success: compile-analysis-report
|
||||
error: analysis-workflow-error
|
||||
```
|
||||
|
||||
### Bedingte Workflow-Ausführung
|
||||
|
||||
```yaml
|
||||
customer-workflow-router:
|
||||
type: condition
|
||||
name: "Customer Workflow Router"
|
||||
inputs:
|
||||
conditions:
|
||||
if: <customer-type.type> === "enterprise"
|
||||
else-if: <customer-type.type> === "premium"
|
||||
else: true
|
||||
connections:
|
||||
conditions:
|
||||
if: enterprise-workflow
|
||||
else-if: premium-workflow
|
||||
else: standard-workflow
|
||||
|
||||
enterprise-workflow:
|
||||
type: workflow
|
||||
name: "Enterprise Customer Workflow"
|
||||
inputs:
|
||||
workflowId: "enterprise-customer-processing"
|
||||
inputMapping:
|
||||
customerData: <customer-data.profile>
|
||||
accountManager: <account-assignment.manager>
|
||||
tier: "enterprise"
|
||||
environmentVariables:
|
||||
PRIORITY_LEVEL: "high"
|
||||
SLA_REQUIREMENTS: "strict"
|
||||
connections:
|
||||
success: enterprise-complete
|
||||
|
||||
premium-workflow:
|
||||
type: workflow
|
||||
name: "Premium Customer Workflow"
|
||||
inputs:
|
||||
workflowId: "premium-customer-processing"
|
||||
inputMapping:
|
||||
customerData: <customer-data.profile>
|
||||
supportLevel: "premium"
|
||||
environmentVariables:
|
||||
PRIORITY_LEVEL: "medium"
|
||||
connections:
|
||||
success: premium-complete
|
||||
|
||||
standard-workflow:
|
||||
type: workflow
|
||||
name: "Standard Customer Workflow"
|
||||
inputs:
|
||||
workflowId: "standard-customer-processing"
|
||||
inputMapping:
|
||||
customerData: <customer-data.profile>
|
||||
environmentVariables:
|
||||
PRIORITY_LEVEL: "standard"
|
||||
connections:
|
||||
success: standard-complete
|
||||
```
|
||||
|
||||
### Parallele Workflow-Ausführung
|
||||
|
||||
```yaml
|
||||
parallel-workflows:
|
||||
type: parallel
|
||||
name: "Parallel Workflow Processing"
|
||||
inputs:
|
||||
parallelType: collection
|
||||
collection: |
|
||||
[
|
||||
{"workflowId": "sentiment-analysis", "focus": "sentiment"},
|
||||
{"workflowId": "topic-extraction", "focus": "topics"},
|
||||
{"workflowId": "entity-recognition", "focus": "entities"}
|
||||
]
|
||||
connections:
|
||||
success: merge-workflow-results
|
||||
|
||||
execute-analysis-workflow:
|
||||
type: workflow
|
||||
name: "Execute Analysis Workflow"
|
||||
parentId: parallel-workflows
|
||||
inputs:
|
||||
workflowId: <parallel.currentItem.workflowId>
|
||||
inputMapping:
|
||||
content: <start.content>
|
||||
analysisType: <parallel.currentItem.focus>
|
||||
environmentVariables:
|
||||
ANALYSIS_API_KEY: "{{ANALYSIS_API_KEY}}"
|
||||
connections:
|
||||
success: workflow-complete
|
||||
```
|
||||
|
||||
### Workflow zur Fehlerbehandlung
|
||||
|
||||
```yaml
|
||||
main-workflow:
|
||||
type: workflow
|
||||
name: "Main Processing Workflow"
|
||||
inputs:
|
||||
workflowId: "main-processing-v1"
|
||||
inputMapping:
|
||||
data: <start.input>
|
||||
timeout: 180000
|
||||
connections:
|
||||
success: main-complete
|
||||
error: error-recovery-workflow
|
||||
|
||||
error-recovery-workflow:
|
||||
type: workflow
|
||||
name: "Error Recovery Workflow"
|
||||
inputs:
|
||||
workflowId: "error-recovery-v1"
|
||||
inputMapping:
|
||||
originalInput: <start.input>
|
||||
errorDetails: <main-workflow.error>
|
||||
failureTimestamp: "{{new Date().toISOString()}}"
|
||||
environmentVariables:
|
||||
RECOVERY_MODE: "automatic"
|
||||
FALLBACK_ENABLED: "true"
|
||||
connections:
|
||||
success: recovery-complete
|
||||
error: manual-intervention-required
|
||||
```
|
||||
|
||||
## Input-Mapping
|
||||
|
||||
Daten vom übergeordneten Workflow zum Unter-Workflow zuordnen:
|
||||
|
||||
```yaml
|
||||
inputMapping:
|
||||
# Static values
|
||||
mode: "production"
|
||||
version: "1.0"
|
||||
|
||||
# References to parent workflow data
|
||||
userData: <user-processor.profile>
|
||||
settings: <config-loader.settings>
|
||||
|
||||
# Complex object mapping
|
||||
requestData:
|
||||
id: <start.requestId>
|
||||
timestamp: "{{new Date().toISOString()}}"
|
||||
source: "parent-workflow"
|
||||
```
|
||||
|
||||
## Output-Referenzen
|
||||
|
||||
Nach Abschluss eines Workflow-Blocks können Sie auf dessen Ausgaben verweisen:
|
||||
|
||||
```yaml
|
||||
# In subsequent blocks
|
||||
next-block:
|
||||
inputs:
|
||||
workflowResult: <workflow-name.output> # Sub-workflow output
|
||||
executionTime: <workflow-name.duration> # Execution duration
|
||||
status: <workflow-name.status> # Execution status
|
||||
```
|
||||
|
||||
## Bewährte Praktiken
|
||||
|
||||
- Verwenden Sie aussagekräftige Workflow-IDs für mehr Klarheit
|
||||
- Übertragen Sie nur notwendige Daten an Sub-Workflows
|
||||
- Setzen Sie angemessene Timeouts entsprechend der Workflow-Komplexität
|
||||
- Integrieren Sie Fehlerbehandlung für robuste Ausführung
|
||||
- Übergeben Sie Umgebungsvariablen sicher
|
||||
- Testen Sie Sub-Workflows zuerst unabhängig voneinander
|
||||
- Überwachen Sie die Leistung verschachtelter Workflows
|
||||
- Verwenden Sie versionierte Workflow-IDs für Stabilität
|
||||
@@ -1,273 +0,0 @@
|
||||
---
|
||||
title: YAML Workflow Beispiele
|
||||
description: Beispiele vollständiger YAML-Workflows
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
|
||||
## Multi-Agent-Ketten-Workflow
|
||||
|
||||
Ein Workflow, bei dem mehrere KI-Agenten Informationen sequentiell verarbeiten:
|
||||
|
||||
```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: <start.input>
|
||||
|
||||
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:
|
||||
|
||||
<agent1initiator.content>
|
||||
|
||||
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 2:
|
||||
|
||||
<agent2enhancer.content>
|
||||
|
||||
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:
|
||||
|
||||
<agent3refiner.content>
|
||||
|
||||
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}}'
|
||||
```
|
||||
|
||||
## Router-basierter bedingter Workflow
|
||||
|
||||
Ein Workflow, der Routing-Logik verwendet, um Daten basierend auf Bedingungen an verschiedene Agenten zu senden:
|
||||
|
||||
```yaml
|
||||
version: '1.0'
|
||||
blocks:
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: manual
|
||||
connections:
|
||||
success: router-1
|
||||
|
||||
router-1:
|
||||
type: router
|
||||
name: Router 1
|
||||
inputs:
|
||||
prompt: go to agent 1 if <start.input> is greater than 5. else agent 2 if greater than 10. else agent 3
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success:
|
||||
- agent-1
|
||||
- agent-2
|
||||
- agent-3
|
||||
|
||||
agent-1:
|
||||
type: agent
|
||||
name: Agent 1
|
||||
inputs:
|
||||
systemPrompt: say 1
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
|
||||
agent-2:
|
||||
type: agent
|
||||
name: Agent 2
|
||||
inputs:
|
||||
systemPrompt: say 2
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
|
||||
agent-3:
|
||||
type: agent
|
||||
name: Agent 3
|
||||
inputs:
|
||||
systemPrompt: say 3
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
|
||||
## Websuche mit strukturierter Ausgabe
|
||||
|
||||
Ein Workflow, der das Web mit Tools durchsucht und strukturierte Daten zurückgibt:
|
||||
|
||||
```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: <start.input>
|
||||
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"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Schleifenverarbeitung mit Sammlung
|
||||
|
||||
Ein Workflow, der jedes Element in einer Sammlung mithilfe einer Schleife verarbeitet:
|
||||
|
||||
```yaml
|
||||
version: '1.0'
|
||||
blocks:
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: manual
|
||||
connections:
|
||||
success: food-analysis-loop
|
||||
food-analysis-loop:
|
||||
type: loop
|
||||
name: Food Analysis Loop
|
||||
inputs:
|
||||
count: 5
|
||||
loopType: forEach
|
||||
collection: '["apple", "banana", "carrot"]'
|
||||
connections:
|
||||
loop:
|
||||
start: calorie-agent
|
||||
calorie-agent:
|
||||
type: agent
|
||||
name: Calorie Analyzer
|
||||
inputs:
|
||||
systemPrompt: Return the number of calories in the food
|
||||
userPrompt: <loop.currentItem>
|
||||
model: claude-sonnet-4-0
|
||||
apiKey: '{{ANTHROPIC_API_KEY}}'
|
||||
parentId: food-analysis-loop
|
||||
```
|
||||
|
||||
## E-Mail-Klassifizierung und -Antwort
|
||||
|
||||
Ein Workflow, der E-Mails klassifiziert und passende Antworten generiert:
|
||||
|
||||
```yaml
|
||||
version: '1.0'
|
||||
blocks:
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: manual
|
||||
connections:
|
||||
success: email-classifier
|
||||
|
||||
email-classifier:
|
||||
type: agent
|
||||
name: Email Classifier
|
||||
inputs:
|
||||
systemPrompt: Classify emails into categories and extract key information.
|
||||
userPrompt: |
|
||||
Classify this email: <start.input>
|
||||
|
||||
Categories: support, billing, sales, feedback
|
||||
Extract: urgency level, customer sentiment, main request
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
connections:
|
||||
success: response-generator
|
||||
|
||||
response-generator:
|
||||
type: agent
|
||||
name: Response Generator
|
||||
inputs:
|
||||
systemPrompt: Generate appropriate responses based on email classification.
|
||||
userPrompt: |
|
||||
Email classification: <emailclassifier.content>
|
||||
Original email: <start.input>
|
||||
|
||||
Generate a professional, helpful response addressing the customer's needs.
|
||||
model: gpt-4o
|
||||
temperature: 0.7
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
@@ -1,159 +0,0 @@
|
||||
---
|
||||
title: YAML Workflow Referenz
|
||||
description: Vollständiger Leitfaden zum Schreiben von YAML-Workflows in Sim
|
||||
---
|
||||
|
||||
import { Card, Cards } from "fumadocs-ui/components/card";
|
||||
import { Step, Steps } from "fumadocs-ui/components/steps";
|
||||
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
||||
|
||||
YAML-Workflows bieten eine leistungsstarke Möglichkeit, Workflow-Konfigurationen in Sim zu definieren, zu versionieren und zu teilen. Dieser Referenzleitfaden behandelt die vollständige YAML-Syntax, Block-Schemas und Best Practices für die Erstellung robuster Workflows.
|
||||
|
||||
## Schnellstart
|
||||
|
||||
Jeder Sim-Workflow folgt dieser grundlegenden Struktur:
|
||||
|
||||
```yaml
|
||||
version: '1.0'
|
||||
blocks:
|
||||
start:
|
||||
type: starter
|
||||
name: Start
|
||||
inputs:
|
||||
startWorkflow: manual
|
||||
connections:
|
||||
success: agent-1
|
||||
|
||||
agent-1:
|
||||
type: agent
|
||||
name: "AI Assistant"
|
||||
inputs:
|
||||
systemPrompt: "You are a helpful assistant."
|
||||
userPrompt: 'Hi'
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
|
||||
## Kernkonzepte
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Versionsdeklaration</strong>: Muss genau `version: '1.0'` (mit Anführungszeichen) sein
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Blockstruktur</strong>: Alle Workflow-Blöcke werden unter dem Schlüssel `blocks` definiert
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Block-Referenzen</strong>: Verwenden Sie Blocknamen in Kleinbuchstaben ohne Leerzeichen (z.B. `<aiassistant.content>`)
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Umgebungsvariablen</strong>: Referenzierung mit doppelten geschweiften Klammern `{{VARIABLE_NAME}}`
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Blocktypen
|
||||
|
||||
Sim unterstützt mehrere Kern-Blocktypen, jeder mit spezifischen YAML-Schemas:
|
||||
|
||||
<Cards>
|
||||
<Card title="Starter-Block" href="/yaml/blocks/starter">
|
||||
Workflow-Einstiegspunkt mit Unterstützung für manuelle, Webhook- und geplante Trigger
|
||||
</Card>
|
||||
<Card title="Agent-Block" href="/yaml/blocks/agent">
|
||||
KI-gestützte Verarbeitung mit Unterstützung für Tools und strukturierte Ausgabe
|
||||
</Card>
|
||||
<Card title="Function-Block" href="/yaml/blocks/function">
|
||||
Ausführung von benutzerdefiniertem JavaScript/TypeScript-Code
|
||||
</Card>
|
||||
<Card title="API-Block" href="/yaml/blocks/api">
|
||||
HTTP-Anfragen an externe Dienste
|
||||
</Card>
|
||||
<Card title="Condition-Block" href="/yaml/blocks/condition">
|
||||
Bedingte Verzweigung basierend auf booleschen Ausdrücken
|
||||
</Card>
|
||||
<Card title="Router-Block" href="/yaml/blocks/router">
|
||||
KI-gestützte intelligente Weiterleitung zu mehreren Pfaden
|
||||
</Card>
|
||||
<Card title="Loop-Block" href="/yaml/blocks/loop">
|
||||
Iterative Verarbeitung mit for- und forEach-Schleifen
|
||||
</Card>
|
||||
<Card title="Parallel-Block" href="/yaml/blocks/parallel">
|
||||
Gleichzeitige Ausführung über mehrere Instanzen
|
||||
</Card>
|
||||
<Card title="Webhook-Block" href="/yaml/blocks/webhook">
|
||||
Webhook-Trigger für externe Integrationen
|
||||
</Card>
|
||||
<Card title="Evaluator-Block" href="/yaml/blocks/evaluator">
|
||||
Validierung von Ausgaben anhand definierter Kriterien und Metriken
|
||||
</Card>
|
||||
<Card title="Workflow-Block" href="/yaml/blocks/workflow">
|
||||
Ausführung anderer Workflows als wiederverwendbare Komponenten
|
||||
</Card>
|
||||
<Card title="Response-Block" href="/yaml/blocks/response">
|
||||
Formatierung der endgültigen Workflow-Ausgabe
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Block-Referenz-Syntax
|
||||
|
||||
Der wichtigste Aspekt von YAML-Workflows ist das Verständnis, wie man Daten zwischen Blöcken referenziert:
|
||||
|
||||
### Grundregeln
|
||||
|
||||
1. **Verwende den Blocknamen** (nicht die Block-ID), umgewandelt in Kleinbuchstaben ohne Leerzeichen
|
||||
2. **Füge die entsprechende Eigenschaft hinzu** (.content für Agenten, .output für Tools)
|
||||
3. **Bei Verwendung von Chat, referenziere den Starter-Block** als `<start.input>`
|
||||
|
||||
### Beispiele
|
||||
|
||||
```yaml
|
||||
# Block definitions
|
||||
email-processor:
|
||||
type: agent
|
||||
name: "Email Agent"
|
||||
# ... configuration
|
||||
|
||||
data-formatter:
|
||||
type: function
|
||||
name: "Data Agent"
|
||||
# ... configuration
|
||||
|
||||
# Referencing their outputs
|
||||
next-block:
|
||||
type: agent
|
||||
name: "Next Step"
|
||||
inputs:
|
||||
userPrompt: |
|
||||
Process this email: <emailagent.content>
|
||||
Use this formatted data: <dataagent.output>
|
||||
Original input: <start.input>
|
||||
```
|
||||
|
||||
### Sonderfälle
|
||||
|
||||
- **Schleifenvariablen**: `<loop.index>`, `<loop.currentItem>`, `<loop.items>`
|
||||
- **Parallele Variablen**: `<parallel.index>`, `<parallel.currentItem>`
|
||||
|
||||
## Umgebungsvariablen
|
||||
|
||||
Verwende Umgebungsvariablen für sensible Daten wie API-Schlüssel:
|
||||
|
||||
```yaml
|
||||
inputs:
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
database: '{{DATABASE_URL}}'
|
||||
token: '{{SLACK_BOT_TOKEN}}'
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Halte Blocknamen benutzerfreundlich**: "Email Processor" für die UI-Anzeige
|
||||
- **Referenziere Umgebungsvariablen**: Niemals API-Schlüssel fest codieren
|
||||
- **Strukturiere für Lesbarkeit**: Gruppiere zusammengehörige Blöcke logisch
|
||||
- **Teste schrittweise**: Baue Workflows Schritt für Schritt auf
|
||||
|
||||
## Nächste Schritte
|
||||
|
||||
- [Block-Referenz-Syntax](/yaml/block-reference) - Detaillierte Referenzregeln
|
||||
- [Vollständige Block-Schemas](/yaml/blocks) - Alle verfügbaren Blocktypen
|
||||
- [Workflow-Beispiele](/yaml/examples) - Praxisnahe Workflow-Muster
|
||||
251
apps/docs/content/docs/en/blocks/guardrails.mdx
Normal file
251
apps/docs/content/docs/en/blocks/guardrails.mdx
Normal file
@@ -0,0 +1,251 @@
|
||||
---
|
||||
title: Guardrails
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
The Guardrails block validates and protects your AI workflows by checking content against multiple validation types. Ensure data quality, prevent hallucinations, detect PII, and enforce format requirements before content moves through your workflow.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/guardrails.png"
|
||||
alt="Guardrails Block"
|
||||
width={500}
|
||||
height={350}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
The Guardrails block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Validate JSON Structure</strong>: Ensure LLM outputs are valid JSON before parsing
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Match Regex Patterns</strong>: Verify content matches specific formats (emails, phone numbers, URLs, etc.)
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Detect Hallucinations</strong>: Use RAG + LLM scoring to validate AI outputs against knowledge base content
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Detect PII</strong>: Identify and optionally mask personally identifiable information across 40+ entity types
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Validation Types
|
||||
|
||||
### JSON Validation
|
||||
|
||||
Validates that content is properly formatted JSON. Perfect for ensuring structured LLM outputs can be safely parsed.
|
||||
|
||||
**Use Cases:**
|
||||
- Validate JSON responses from Agent blocks before parsing
|
||||
- Ensure API payloads are properly formatted
|
||||
- Check structured data integrity
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if valid JSON, `false` otherwise
|
||||
- `error`: Error message if validation fails (e.g., "Invalid JSON: Unexpected token...")
|
||||
|
||||
### Regex Validation
|
||||
|
||||
Checks if content matches a specified regular expression pattern.
|
||||
|
||||
**Use Cases:**
|
||||
- Validate email addresses
|
||||
- Check phone number formats
|
||||
- Verify URLs or custom identifiers
|
||||
- Enforce specific text patterns
|
||||
|
||||
**Configuration:**
|
||||
- **Regex Pattern**: The regular expression to match against (e.g., `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` for emails)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if content matches pattern, `false` otherwise
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
### Hallucination Detection
|
||||
|
||||
Uses Retrieval-Augmented Generation (RAG) with LLM scoring to detect when AI-generated content contradicts or isn't grounded in your knowledge base.
|
||||
|
||||
**How It Works:**
|
||||
1. Queries your knowledge base for relevant context
|
||||
2. Sends both the AI output and retrieved context to an LLM
|
||||
3. LLM assigns a confidence score (0-10 scale)
|
||||
- **0** = Full hallucination (completely ungrounded)
|
||||
- **10** = Fully grounded (completely supported by knowledge base)
|
||||
4. Validation passes if score ≥ threshold (default: 3)
|
||||
|
||||
**Configuration:**
|
||||
- **Knowledge Base**: Select from your existing knowledge bases
|
||||
- **Model**: Choose LLM for scoring (requires strong reasoning - GPT-4o, Claude 3.7 Sonnet recommended)
|
||||
- **API Key**: Authentication for selected LLM provider (auto-hidden for hosted/Ollama models)
|
||||
- **Confidence Threshold**: Minimum score to pass (0-10, default: 3)
|
||||
- **Top K** (Advanced): Number of knowledge base chunks to retrieve (default: 10)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `true` if confidence score ≥ threshold
|
||||
- `score`: Confidence score (0-10)
|
||||
- `reasoning`: LLM's explanation for the score
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
**Use Cases:**
|
||||
- Validate Agent responses against documentation
|
||||
- Ensure customer support answers are factually accurate
|
||||
- Verify generated content matches source material
|
||||
- Quality control for RAG applications
|
||||
|
||||
### PII Detection
|
||||
|
||||
Detects personally identifiable information using Microsoft Presidio. Supports 40+ entity types across multiple countries and languages.
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<Video src="guardrails.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
**How It Works:**
|
||||
1. Scans content for PII entities using pattern matching and NLP
|
||||
2. Returns detected entities with locations and confidence scores
|
||||
3. Optionally masks detected PII in the output
|
||||
|
||||
**Configuration:**
|
||||
- **PII Types to Detect**: Select from grouped categories via modal selector
|
||||
- **Common**: Person name, Email, Phone, Credit card, IP address, etc.
|
||||
- **USA**: SSN, Driver's license, Passport, etc.
|
||||
- **UK**: NHS number, National insurance number
|
||||
- **Spain**: NIF, NIE, CIF
|
||||
- **Italy**: Fiscal code, Driver's license, VAT code
|
||||
- **Poland**: PESEL, NIP, REGON
|
||||
- **Singapore**: NRIC/FIN, UEN
|
||||
- **Australia**: ABN, ACN, TFN, Medicare
|
||||
- **India**: Aadhaar, PAN, Passport, Voter number
|
||||
- **Mode**:
|
||||
- **Detect**: Only identify PII (default)
|
||||
- **Mask**: Replace detected PII with masked values
|
||||
- **Language**: Detection language (default: English)
|
||||
|
||||
**Output:**
|
||||
- `passed`: `false` if any selected PII types are detected
|
||||
- `detectedEntities`: Array of detected PII with type, location, and confidence
|
||||
- `maskedText`: Content with PII masked (only if mode = "Mask")
|
||||
- `error`: Error message if validation fails
|
||||
|
||||
**Use Cases:**
|
||||
- Block content containing sensitive personal information
|
||||
- Mask PII before logging or storing data
|
||||
- Compliance with GDPR, HIPAA, and other privacy regulations
|
||||
- Sanitize user inputs before processing
|
||||
|
||||
## Configuration
|
||||
|
||||
### Content to Validate
|
||||
|
||||
The input content to validate. This typically comes from:
|
||||
- Agent block outputs: `<agent.content>`
|
||||
- Function block results: `<function.output>`
|
||||
- API responses: `<api.output>`
|
||||
- Any other block output
|
||||
|
||||
### Validation Type
|
||||
|
||||
Choose from four validation types:
|
||||
- **Valid JSON**: Check if content is properly formatted JSON
|
||||
- **Regex Match**: Verify content matches a regex pattern
|
||||
- **Hallucination Check**: Validate against knowledge base with LLM scoring
|
||||
- **PII Detection**: Detect and optionally mask personally identifiable information
|
||||
|
||||
## Outputs
|
||||
|
||||
All validation types return:
|
||||
|
||||
- **`<guardrails.passed>`**: Boolean indicating if validation passed
|
||||
- **`<guardrails.validationType>`**: The type of validation performed
|
||||
- **`<guardrails.input>`**: The original input that was validated
|
||||
- **`<guardrails.error>`**: Error message if validation failed (optional)
|
||||
|
||||
Additional outputs by type:
|
||||
|
||||
**Hallucination Check:**
|
||||
- **`<guardrails.score>`**: Confidence score (0-10)
|
||||
- **`<guardrails.reasoning>`**: LLM's explanation
|
||||
|
||||
**PII Detection:**
|
||||
- **`<guardrails.detectedEntities>`**: Array of detected PII entities
|
||||
- **`<guardrails.maskedText>`**: Content with PII masked (if mode = "Mask")
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### Validate JSON Before Parsing
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Ensure Agent output is valid JSON</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent generates structured JSON response</li>
|
||||
<li>Guardrails validates JSON format</li>
|
||||
<li>Condition block checks `<guardrails.passed>`</li>
|
||||
<li>If passed → Parse and use data, If failed → Retry or handle error</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Prevent Hallucinations
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Validate customer support responses</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent generates response to customer question</li>
|
||||
<li>Guardrails checks against support documentation knowledge base</li>
|
||||
<li>If confidence score ≥ 3 → Send response</li>
|
||||
<li>If confidence score \< 3 → Flag for human review</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Block PII in User Inputs
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Sanitize user-submitted content</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>User submits form with text content</li>
|
||||
<li>Guardrails detects PII (emails, phone numbers, SSN, etc.)</li>
|
||||
<li>If PII detected → Reject submission or mask sensitive data</li>
|
||||
<li>If no PII → Process normally</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<Video src="guardrails-example.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
### Validate Email Format
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Check email address format</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent extracts email from text</li>
|
||||
<li>Guardrails validates with regex pattern</li>
|
||||
<li>If valid → Use email for notification</li>
|
||||
<li>If invalid → Request correction</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Chain with Condition blocks**: Use `<guardrails.passed>` to branch workflow logic based on validation results
|
||||
- **Use JSON validation before parsing**: Always validate JSON structure before attempting to parse LLM outputs
|
||||
- **Choose appropriate PII types**: Only select the PII entity types relevant to your use case for better performance
|
||||
- **Set reasonable confidence thresholds**: For hallucination detection, adjust threshold based on your accuracy requirements (higher = stricter)
|
||||
- **Use strong models for hallucination detection**: GPT-4o or Claude 3.7 Sonnet provide more accurate confidence scoring
|
||||
- **Mask PII for logging**: Use "Mask" mode when you need to log or store content that may contain PII
|
||||
- **Test regex patterns**: Validate your regex patterns thoroughly before deploying to production
|
||||
- **Monitor validation failures**: Track `<guardrails.error>` messages to identify common validation issues
|
||||
|
||||
<Callout type="info">
|
||||
Guardrails validation happens synchronously in your workflow. For hallucination detection, choose faster models (like GPT-4o-mini) if latency is critical.
|
||||
</Callout>
|
||||
|
||||
@@ -166,6 +166,38 @@ Different subscription plans have different usage limits:
|
||||
| **Team** | $500 (pooled) | 50 sync, 100 async |
|
||||
| **Enterprise** | Custom | Custom |
|
||||
|
||||
## Billing Model
|
||||
|
||||
Sim uses a **base subscription + overage** billing model:
|
||||
|
||||
### How It Works
|
||||
|
||||
**Pro Plan ($20/month):**
|
||||
- Monthly subscription includes $20 of usage
|
||||
- Usage under $20 → No additional charges
|
||||
- Usage over $20 → Pay the overage at month end
|
||||
- Example: $35 usage = $20 (subscription) + $15 (overage)
|
||||
|
||||
**Team Plan ($40/seat/month):**
|
||||
- Pooled usage across all team members
|
||||
- Overage calculated from total team usage
|
||||
- Organization owner receives one bill
|
||||
|
||||
**Enterprise Plans:**
|
||||
- Fixed monthly price, no overages
|
||||
- Custom usage limits per agreement
|
||||
|
||||
### Threshold Billing
|
||||
|
||||
When unbilled overage reaches $50, Sim automatically bills the full unbilled amount.
|
||||
|
||||
**Example:**
|
||||
- Day 10: $70 overage → Bill $70 immediately
|
||||
- Day 15: Additional $35 usage ($105 total) → Already billed, no action
|
||||
- Day 20: Another $50 usage ($155 total, $85 unbilled) → Bill $85 immediately
|
||||
|
||||
This spreads large overage charges throughout the month instead of one large bill at period end.
|
||||
|
||||
## Cost Management Best Practices
|
||||
|
||||
1. **Monitor Regularly**: Check your usage dashboard frequently to avoid surprises
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
The official Python SDK for Sim allows you to execute workflows programmatically from your Python applications using the official Python SDK.
|
||||
|
||||
<Callout type="info">
|
||||
The Python SDK supports Python 3.8+ and provides synchronous workflow execution. All workflow executions are currently synchronous.
|
||||
The Python SDK supports Python 3.8+ with async execution support, automatic rate limiting with exponential backoff, and usage tracking.
|
||||
</Callout>
|
||||
|
||||
## Installation
|
||||
@@ -74,8 +74,13 @@ result = client.execute_workflow(
|
||||
- `workflow_id` (str): The ID of the workflow to execute
|
||||
- `input_data` (dict, optional): Input data to pass to the workflow
|
||||
- `timeout` (float, optional): Timeout in seconds (default: 30.0)
|
||||
- `stream` (bool, optional): Enable streaming responses (default: False)
|
||||
- `selected_outputs` (list[str], optional): Block outputs to stream in `blockName.attribute` format (e.g., `["agent1.content"]`)
|
||||
- `async_execution` (bool, optional): Execute asynchronously (default: False)
|
||||
|
||||
**Returns:** `WorkflowExecutionResult`
|
||||
**Returns:** `WorkflowExecutionResult | AsyncExecutionResult`
|
||||
|
||||
When `async_execution=True`, returns immediately with a task ID for polling. Otherwise, waits for completion.
|
||||
|
||||
##### get_workflow_status()
|
||||
|
||||
@@ -107,28 +112,117 @@ if is_ready:
|
||||
|
||||
**Returns:** `bool`
|
||||
|
||||
##### execute_workflow_sync()
|
||||
##### get_job_status()
|
||||
|
||||
<Callout type="info">
|
||||
Currently, this method is identical to `execute_workflow()` since all executions are synchronous. This method is provided for future compatibility when asynchronous execution is added.
|
||||
</Callout>
|
||||
|
||||
Execute a workflow (currently synchronous, same as `execute_workflow()`).
|
||||
Get the status of an async job execution.
|
||||
|
||||
```python
|
||||
result = client.execute_workflow_sync(
|
||||
status = client.get_job_status("task-id-from-async-execution")
|
||||
print("Status:", status["status"]) # 'queued', 'processing', 'completed', 'failed'
|
||||
if status["status"] == "completed":
|
||||
print("Output:", status["output"])
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `task_id` (str): The task ID returned from async execution
|
||||
|
||||
**Returns:** `Dict[str, Any]`
|
||||
|
||||
**Response fields:**
|
||||
- `success` (bool): Whether the request was successful
|
||||
- `taskId` (str): The task ID
|
||||
- `status` (str): One of `'queued'`, `'processing'`, `'completed'`, `'failed'`, `'cancelled'`
|
||||
- `metadata` (dict): Contains `startedAt`, `completedAt`, and `duration`
|
||||
- `output` (any, optional): The workflow output (when completed)
|
||||
- `error` (any, optional): Error details (when failed)
|
||||
- `estimatedDuration` (int, optional): Estimated duration in milliseconds (when processing/queued)
|
||||
|
||||
##### execute_with_retry()
|
||||
|
||||
Execute a workflow with automatic retry on rate limit errors using exponential backoff.
|
||||
|
||||
```python
|
||||
result = client.execute_with_retry(
|
||||
"workflow-id",
|
||||
input_data={"data": "some input"},
|
||||
timeout=60.0
|
||||
input_data={"message": "Hello"},
|
||||
timeout=30.0,
|
||||
max_retries=3, # Maximum number of retries
|
||||
initial_delay=1.0, # Initial delay in seconds
|
||||
max_delay=30.0, # Maximum delay in seconds
|
||||
backoff_multiplier=2.0 # Exponential backoff multiplier
|
||||
)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `workflow_id` (str): The ID of the workflow to execute
|
||||
- `input_data` (dict, optional): Input data to pass to the workflow
|
||||
- `timeout` (float): Timeout for the initial request in seconds
|
||||
- `timeout` (float, optional): Timeout in seconds
|
||||
- `stream` (bool, optional): Enable streaming responses
|
||||
- `selected_outputs` (list, optional): Block outputs to stream
|
||||
- `async_execution` (bool, optional): Execute asynchronously
|
||||
- `max_retries` (int, optional): Maximum number of retries (default: 3)
|
||||
- `initial_delay` (float, optional): Initial delay in seconds (default: 1.0)
|
||||
- `max_delay` (float, optional): Maximum delay in seconds (default: 30.0)
|
||||
- `backoff_multiplier` (float, optional): Backoff multiplier (default: 2.0)
|
||||
|
||||
**Returns:** `WorkflowExecutionResult`
|
||||
**Returns:** `WorkflowExecutionResult | AsyncExecutionResult`
|
||||
|
||||
The retry logic uses exponential backoff (1s → 2s → 4s → 8s...) with ±25% jitter to prevent thundering herd. If the API provides a `retry-after` header, it will be used instead.
|
||||
|
||||
##### get_rate_limit_info()
|
||||
|
||||
Get the current rate limit information from the last API response.
|
||||
|
||||
```python
|
||||
rate_limit_info = client.get_rate_limit_info()
|
||||
if rate_limit_info:
|
||||
print("Limit:", rate_limit_info.limit)
|
||||
print("Remaining:", rate_limit_info.remaining)
|
||||
print("Reset:", datetime.fromtimestamp(rate_limit_info.reset))
|
||||
```
|
||||
|
||||
**Returns:** `RateLimitInfo | None`
|
||||
|
||||
##### get_usage_limits()
|
||||
|
||||
Get current usage limits and quota information for your account.
|
||||
|
||||
```python
|
||||
limits = client.get_usage_limits()
|
||||
print("Sync requests remaining:", limits.rate_limit["sync"]["remaining"])
|
||||
print("Async requests remaining:", limits.rate_limit["async"]["remaining"])
|
||||
print("Current period cost:", limits.usage["currentPeriodCost"])
|
||||
print("Plan:", limits.usage["plan"])
|
||||
```
|
||||
|
||||
**Returns:** `UsageLimits`
|
||||
|
||||
**Response structure:**
|
||||
```python
|
||||
{
|
||||
"success": bool,
|
||||
"rateLimit": {
|
||||
"sync": {
|
||||
"isLimited": bool,
|
||||
"limit": int,
|
||||
"remaining": int,
|
||||
"resetAt": str
|
||||
},
|
||||
"async": {
|
||||
"isLimited": bool,
|
||||
"limit": int,
|
||||
"remaining": int,
|
||||
"resetAt": str
|
||||
},
|
||||
"authType": str # 'api' or 'manual'
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": float,
|
||||
"limit": float,
|
||||
"plan": str # e.g., 'free', 'pro'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### set_api_key()
|
||||
|
||||
@@ -170,6 +264,18 @@ class WorkflowExecutionResult:
|
||||
total_duration: Optional[float] = None
|
||||
```
|
||||
|
||||
### AsyncExecutionResult
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class AsyncExecutionResult:
|
||||
success: bool
|
||||
task_id: str
|
||||
status: str # 'queued'
|
||||
created_at: str
|
||||
links: Dict[str, str] # e.g., {"status": "/api/jobs/{taskId}"}
|
||||
```
|
||||
|
||||
### WorkflowStatus
|
||||
|
||||
```python
|
||||
@@ -181,6 +287,27 @@ class WorkflowStatus:
|
||||
needs_redeployment: bool = False
|
||||
```
|
||||
|
||||
### RateLimitInfo
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class RateLimitInfo:
|
||||
limit: int
|
||||
remaining: int
|
||||
reset: int
|
||||
retry_after: Optional[int] = None
|
||||
```
|
||||
|
||||
### UsageLimits
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class UsageLimits:
|
||||
success: bool
|
||||
rate_limit: Dict[str, Any]
|
||||
usage: Dict[str, Any]
|
||||
```
|
||||
|
||||
### SimStudioError
|
||||
|
||||
```python
|
||||
@@ -191,6 +318,13 @@ class SimStudioError(Exception):
|
||||
self.status = status
|
||||
```
|
||||
|
||||
**Common error codes:**
|
||||
- `UNAUTHORIZED`: Invalid API key
|
||||
- `TIMEOUT`: Request timed out
|
||||
- `RATE_LIMIT_EXCEEDED`: Rate limit exceeded
|
||||
- `USAGE_LIMIT_EXCEEDED`: Usage limit exceeded
|
||||
- `EXECUTION_ERROR`: Workflow execution failed
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Workflow Execution
|
||||
@@ -214,7 +348,7 @@ class SimStudioError(Exception):
|
||||
import os
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def run_workflow():
|
||||
try:
|
||||
@@ -252,7 +386,7 @@ Handle different types of errors that may occur during workflow execution:
|
||||
from simstudio import SimStudioClient, SimStudioError
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_error_handling():
|
||||
try:
|
||||
@@ -284,7 +418,7 @@ from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
# Using context manager to automatically close the session
|
||||
with SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY")) as client:
|
||||
with SimStudioClient(api_key=os.getenv("SIM_API_KEY")) as client:
|
||||
result = client.execute_workflow("workflow-id")
|
||||
print("Result:", result)
|
||||
# Session is automatically closed here
|
||||
@@ -298,7 +432,7 @@ Execute multiple workflows efficiently:
|
||||
from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIMSTUDIO_API_KEY"))
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_workflows_batch(workflow_data_pairs):
|
||||
"""Execute multiple workflows with different input data."""
|
||||
@@ -339,6 +473,230 @@ for result in results:
|
||||
print(f"Workflow {result['workflow_id']}: {'Success' if result['success'] else 'Failed'}")
|
||||
```
|
||||
|
||||
### Async Workflow Execution
|
||||
|
||||
Execute workflows asynchronously for long-running tasks:
|
||||
|
||||
```python
|
||||
import os
|
||||
import time
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_async():
|
||||
try:
|
||||
# Start async execution
|
||||
result = client.execute_workflow(
|
||||
"workflow-id",
|
||||
input_data={"data": "large dataset"},
|
||||
async_execution=True # Execute asynchronously
|
||||
)
|
||||
|
||||
# Check if result is an async execution
|
||||
if hasattr(result, 'task_id'):
|
||||
print(f"Task ID: {result.task_id}")
|
||||
print(f"Status endpoint: {result.links['status']}")
|
||||
|
||||
# Poll for completion
|
||||
status = client.get_job_status(result.task_id)
|
||||
|
||||
while status["status"] in ["queued", "processing"]:
|
||||
print(f"Current status: {status['status']}")
|
||||
time.sleep(2) # Wait 2 seconds
|
||||
status = client.get_job_status(result.task_id)
|
||||
|
||||
if status["status"] == "completed":
|
||||
print("Workflow completed!")
|
||||
print(f"Output: {status['output']}")
|
||||
print(f"Duration: {status['metadata']['duration']}")
|
||||
else:
|
||||
print(f"Workflow failed: {status['error']}")
|
||||
|
||||
except Exception as error:
|
||||
print(f"Error: {error}")
|
||||
|
||||
execute_async()
|
||||
```
|
||||
|
||||
### Rate Limiting and Retry
|
||||
|
||||
Handle rate limits automatically with exponential backoff:
|
||||
|
||||
```python
|
||||
import os
|
||||
from simstudio import SimStudioClient, SimStudioError
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_retry_handling():
|
||||
try:
|
||||
# Automatically retries on rate limit
|
||||
result = client.execute_with_retry(
|
||||
"workflow-id",
|
||||
input_data={"message": "Process this"},
|
||||
max_retries=5,
|
||||
initial_delay=1.0,
|
||||
max_delay=60.0,
|
||||
backoff_multiplier=2.0
|
||||
)
|
||||
|
||||
print(f"Success: {result}")
|
||||
except SimStudioError as error:
|
||||
if error.code == "RATE_LIMIT_EXCEEDED":
|
||||
print("Rate limit exceeded after all retries")
|
||||
|
||||
# Check rate limit info
|
||||
rate_limit_info = client.get_rate_limit_info()
|
||||
if rate_limit_info:
|
||||
from datetime import datetime
|
||||
reset_time = datetime.fromtimestamp(rate_limit_info.reset)
|
||||
print(f"Rate limit resets at: {reset_time}")
|
||||
|
||||
execute_with_retry_handling()
|
||||
```
|
||||
|
||||
### Usage Monitoring
|
||||
|
||||
Monitor your account usage and limits:
|
||||
|
||||
```python
|
||||
import os
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def check_usage():
|
||||
try:
|
||||
limits = client.get_usage_limits()
|
||||
|
||||
print("=== Rate Limits ===")
|
||||
print("Sync requests:")
|
||||
print(f" Limit: {limits.rate_limit['sync']['limit']}")
|
||||
print(f" Remaining: {limits.rate_limit['sync']['remaining']}")
|
||||
print(f" Resets at: {limits.rate_limit['sync']['resetAt']}")
|
||||
print(f" Is limited: {limits.rate_limit['sync']['isLimited']}")
|
||||
|
||||
print("\nAsync requests:")
|
||||
print(f" Limit: {limits.rate_limit['async']['limit']}")
|
||||
print(f" Remaining: {limits.rate_limit['async']['remaining']}")
|
||||
print(f" Resets at: {limits.rate_limit['async']['resetAt']}")
|
||||
print(f" Is limited: {limits.rate_limit['async']['isLimited']}")
|
||||
|
||||
print("\n=== Usage ===")
|
||||
print(f"Current period cost: ${limits.usage['currentPeriodCost']:.2f}")
|
||||
print(f"Limit: ${limits.usage['limit']:.2f}")
|
||||
print(f"Plan: {limits.usage['plan']}")
|
||||
|
||||
percent_used = (limits.usage['currentPeriodCost'] / limits.usage['limit']) * 100
|
||||
print(f"Usage: {percent_used:.1f}%")
|
||||
|
||||
if percent_used > 80:
|
||||
print("⚠️ Warning: You are approaching your usage limit!")
|
||||
|
||||
except Exception as error:
|
||||
print(f"Error checking usage: {error}")
|
||||
|
||||
check_usage()
|
||||
```
|
||||
|
||||
### Streaming Workflow Execution
|
||||
|
||||
Execute workflows with real-time streaming responses:
|
||||
|
||||
```python
|
||||
from simstudio import SimStudioClient
|
||||
import os
|
||||
|
||||
client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
|
||||
|
||||
def execute_with_streaming():
|
||||
"""Execute workflow with streaming enabled."""
|
||||
try:
|
||||
# Enable streaming for specific block outputs
|
||||
result = client.execute_workflow(
|
||||
"workflow-id",
|
||||
input_data={"message": "Count to five"},
|
||||
stream=True,
|
||||
selected_outputs=["agent1.content"] # Use blockName.attribute format
|
||||
)
|
||||
|
||||
print("Workflow result:", result)
|
||||
except Exception as error:
|
||||
print("Error:", error)
|
||||
|
||||
execute_with_streaming()
|
||||
```
|
||||
|
||||
The streaming response follows the Server-Sent Events (SSE) format:
|
||||
|
||||
```
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", two"}
|
||||
|
||||
data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}}
|
||||
|
||||
data: [DONE]
|
||||
```
|
||||
|
||||
**Flask Streaming Example:**
|
||||
|
||||
```python
|
||||
from flask import Flask, Response, stream_with_context
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/stream-workflow')
|
||||
def stream_workflow():
|
||||
"""Stream workflow execution to the client."""
|
||||
|
||||
def generate():
|
||||
response = requests.post(
|
||||
'https://sim.ai/api/workflows/WORKFLOW_ID/execute',
|
||||
headers={
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': os.getenv('SIM_API_KEY')
|
||||
},
|
||||
json={
|
||||
'message': 'Generate a story',
|
||||
'stream': True,
|
||||
'selectedOutputs': ['agent1.content']
|
||||
},
|
||||
stream=True
|
||||
)
|
||||
|
||||
for line in response.iter_lines():
|
||||
if line:
|
||||
decoded_line = line.decode('utf-8')
|
||||
if decoded_line.startswith('data: '):
|
||||
data = decoded_line[6:] # Remove 'data: ' prefix
|
||||
|
||||
if data == '[DONE]':
|
||||
break
|
||||
|
||||
try:
|
||||
parsed = json.loads(data)
|
||||
if 'chunk' in parsed:
|
||||
yield f"data: {json.dumps(parsed)}\n\n"
|
||||
elif parsed.get('event') == 'done':
|
||||
yield f"data: {json.dumps(parsed)}\n\n"
|
||||
print("Execution complete:", parsed.get('metadata'))
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
|
||||
return Response(
|
||||
stream_with_context(generate()),
|
||||
mimetype='text/event-stream'
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
```
|
||||
|
||||
### Environment Configuration
|
||||
|
||||
Configure the client using environment variables:
|
||||
@@ -351,8 +709,8 @@ Configure the client using environment variables:
|
||||
|
||||
# Development configuration
|
||||
client = SimStudioClient(
|
||||
api_key=os.getenv("SIMSTUDIO_API_KEY"),
|
||||
base_url=os.getenv("SIMSTUDIO_BASE_URL", "https://sim.ai")
|
||||
api_key=os.getenv("SIM_API_KEY")
|
||||
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
|
||||
)
|
||||
```
|
||||
</Tab>
|
||||
@@ -362,13 +720,13 @@ Configure the client using environment variables:
|
||||
from simstudio import SimStudioClient
|
||||
|
||||
# Production configuration with error handling
|
||||
api_key = os.getenv("SIMSTUDIO_API_KEY")
|
||||
api_key = os.getenv("SIM_API_KEY")
|
||||
if not api_key:
|
||||
raise ValueError("SIMSTUDIO_API_KEY environment variable is required")
|
||||
raise ValueError("SIM_API_KEY environment variable is required")
|
||||
|
||||
client = SimStudioClient(
|
||||
api_key=api_key,
|
||||
base_url=os.getenv("SIMSTUDIO_BASE_URL", "https://sim.ai")
|
||||
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
|
||||
)
|
||||
```
|
||||
</Tab>
|
||||
|
||||
@@ -7,10 +7,10 @@ import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
|
||||
The official TypeScript/JavaScript SDK for Sim provides full type safety and supports both Node.js and browser environments, allowing you to execute workflows programmatically from your Node.js applications, web applications, and other JavaScript environments. All workflow executions are currently synchronous.
|
||||
The official TypeScript/JavaScript SDK for Sim provides full type safety and supports both Node.js and browser environments, allowing you to execute workflows programmatically from your Node.js applications, web applications, and other JavaScript environments.
|
||||
|
||||
<Callout type="info">
|
||||
The TypeScript SDK provides full type safety and supports both Node.js and browser environments. All workflow executions are currently synchronous.
|
||||
The TypeScript SDK provides full type safety, async execution support, automatic rate limiting with exponential backoff, and usage tracking.
|
||||
</Callout>
|
||||
|
||||
## Installation
|
||||
@@ -89,8 +89,13 @@ const result = await client.executeWorkflow('workflow-id', {
|
||||
- `options` (ExecutionOptions, optional):
|
||||
- `input` (any): Input data to pass to the workflow
|
||||
- `timeout` (number): Timeout in milliseconds (default: 30000)
|
||||
- `stream` (boolean): Enable streaming responses (default: false)
|
||||
- `selectedOutputs` (string[]): Block outputs to stream in `blockName.attribute` format (e.g., `["agent1.content"]`)
|
||||
- `async` (boolean): Execute asynchronously (default: false)
|
||||
|
||||
**Returns:** `Promise<WorkflowExecutionResult>`
|
||||
**Returns:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
|
||||
|
||||
When `async: true`, returns immediately with a task ID for polling. Otherwise, waits for completion.
|
||||
|
||||
##### getWorkflowStatus()
|
||||
|
||||
@@ -122,28 +127,116 @@ if (isReady) {
|
||||
|
||||
**Returns:** `Promise<boolean>`
|
||||
|
||||
##### executeWorkflowSync()
|
||||
##### getJobStatus()
|
||||
|
||||
<Callout type="info">
|
||||
Currently, this method is identical to `executeWorkflow()` since all executions are synchronous. This method is provided for future compatibility when asynchronous execution is added.
|
||||
</Callout>
|
||||
|
||||
Execute a workflow (currently synchronous, same as `executeWorkflow()`).
|
||||
Get the status of an async job execution.
|
||||
|
||||
```typescript
|
||||
const result = await client.executeWorkflowSync('workflow-id', {
|
||||
input: { data: 'some input' },
|
||||
timeout: 60000
|
||||
const status = await client.getJobStatus('task-id-from-async-execution');
|
||||
console.log('Status:', status.status); // 'queued', 'processing', 'completed', 'failed'
|
||||
if (status.status === 'completed') {
|
||||
console.log('Output:', status.output);
|
||||
}
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `taskId` (string): The task ID returned from async execution
|
||||
|
||||
**Returns:** `Promise<JobStatus>`
|
||||
|
||||
**Response fields:**
|
||||
- `success` (boolean): Whether the request was successful
|
||||
- `taskId` (string): The task ID
|
||||
- `status` (string): One of `'queued'`, `'processing'`, `'completed'`, `'failed'`, `'cancelled'`
|
||||
- `metadata` (object): Contains `startedAt`, `completedAt`, and `duration`
|
||||
- `output` (any, optional): The workflow output (when completed)
|
||||
- `error` (any, optional): Error details (when failed)
|
||||
- `estimatedDuration` (number, optional): Estimated duration in milliseconds (when processing/queued)
|
||||
|
||||
##### executeWithRetry()
|
||||
|
||||
Execute a workflow with automatic retry on rate limit errors using exponential backoff.
|
||||
|
||||
```typescript
|
||||
const result = await client.executeWithRetry('workflow-id', {
|
||||
input: { message: 'Hello' },
|
||||
timeout: 30000
|
||||
}, {
|
||||
maxRetries: 3, // Maximum number of retries
|
||||
initialDelay: 1000, // Initial delay in ms (1 second)
|
||||
maxDelay: 30000, // Maximum delay in ms (30 seconds)
|
||||
backoffMultiplier: 2 // Exponential backoff multiplier
|
||||
});
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `workflowId` (string): The ID of the workflow to execute
|
||||
- `options` (ExecutionOptions, optional):
|
||||
- `input` (any): Input data to pass to the workflow
|
||||
- `timeout` (number): Timeout for the initial request in milliseconds
|
||||
- `options` (ExecutionOptions, optional): Same as `executeWorkflow()`
|
||||
- `retryOptions` (RetryOptions, optional):
|
||||
- `maxRetries` (number): Maximum number of retries (default: 3)
|
||||
- `initialDelay` (number): Initial delay in ms (default: 1000)
|
||||
- `maxDelay` (number): Maximum delay in ms (default: 30000)
|
||||
- `backoffMultiplier` (number): Backoff multiplier (default: 2)
|
||||
|
||||
**Returns:** `Promise<WorkflowExecutionResult>`
|
||||
**Returns:** `Promise<WorkflowExecutionResult | AsyncExecutionResult>`
|
||||
|
||||
The retry logic uses exponential backoff (1s → 2s → 4s → 8s...) with ±25% jitter to prevent thundering herd. If the API provides a `retry-after` header, it will be used instead.
|
||||
|
||||
##### getRateLimitInfo()
|
||||
|
||||
Get the current rate limit information from the last API response.
|
||||
|
||||
```typescript
|
||||
const rateLimitInfo = client.getRateLimitInfo();
|
||||
if (rateLimitInfo) {
|
||||
console.log('Limit:', rateLimitInfo.limit);
|
||||
console.log('Remaining:', rateLimitInfo.remaining);
|
||||
console.log('Reset:', new Date(rateLimitInfo.reset * 1000));
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:** `RateLimitInfo | null`
|
||||
|
||||
##### getUsageLimits()
|
||||
|
||||
Get current usage limits and quota information for your account.
|
||||
|
||||
```typescript
|
||||
const limits = await client.getUsageLimits();
|
||||
console.log('Sync requests remaining:', limits.rateLimit.sync.remaining);
|
||||
console.log('Async requests remaining:', limits.rateLimit.async.remaining);
|
||||
console.log('Current period cost:', limits.usage.currentPeriodCost);
|
||||
console.log('Plan:', limits.usage.plan);
|
||||
```
|
||||
|
||||
**Returns:** `Promise<UsageLimits>`
|
||||
|
||||
**Response structure:**
|
||||
```typescript
|
||||
{
|
||||
success: boolean
|
||||
rateLimit: {
|
||||
sync: {
|
||||
isLimited: boolean
|
||||
limit: number
|
||||
remaining: number
|
||||
resetAt: string
|
||||
}
|
||||
async: {
|
||||
isLimited: boolean
|
||||
limit: number
|
||||
remaining: number
|
||||
resetAt: string
|
||||
}
|
||||
authType: string // 'api' or 'manual'
|
||||
}
|
||||
usage: {
|
||||
currentPeriodCost: number
|
||||
limit: number
|
||||
plan: string // e.g., 'free', 'pro'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### setApiKey()
|
||||
|
||||
@@ -181,6 +274,20 @@ interface WorkflowExecutionResult {
|
||||
}
|
||||
```
|
||||
|
||||
### AsyncExecutionResult
|
||||
|
||||
```typescript
|
||||
interface AsyncExecutionResult {
|
||||
success: boolean;
|
||||
taskId: string;
|
||||
status: 'queued';
|
||||
createdAt: string;
|
||||
links: {
|
||||
status: string; // e.g., "/api/jobs/{taskId}"
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### WorkflowStatus
|
||||
|
||||
```typescript
|
||||
@@ -192,6 +299,45 @@ interface WorkflowStatus {
|
||||
}
|
||||
```
|
||||
|
||||
### RateLimitInfo
|
||||
|
||||
```typescript
|
||||
interface RateLimitInfo {
|
||||
limit: number;
|
||||
remaining: number;
|
||||
reset: number;
|
||||
retryAfter?: number;
|
||||
}
|
||||
```
|
||||
|
||||
### UsageLimits
|
||||
|
||||
```typescript
|
||||
interface UsageLimits {
|
||||
success: boolean;
|
||||
rateLimit: {
|
||||
sync: {
|
||||
isLimited: boolean;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
resetAt: string;
|
||||
};
|
||||
async: {
|
||||
isLimited: boolean;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
resetAt: string;
|
||||
};
|
||||
authType: string;
|
||||
};
|
||||
usage: {
|
||||
currentPeriodCost: number;
|
||||
limit: number;
|
||||
plan: string;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### SimStudioError
|
||||
|
||||
```typescript
|
||||
@@ -201,6 +347,13 @@ class SimStudioError extends Error {
|
||||
}
|
||||
```
|
||||
|
||||
**Common error codes:**
|
||||
- `UNAUTHORIZED`: Invalid API key
|
||||
- `TIMEOUT`: Request timed out
|
||||
- `RATE_LIMIT_EXCEEDED`: Rate limit exceeded
|
||||
- `USAGE_LIMIT_EXCEEDED`: Usage limit exceeded
|
||||
- `EXECUTION_ERROR`: Workflow execution failed
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Workflow Execution
|
||||
@@ -224,7 +377,7 @@ class SimStudioError extends Error {
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function runWorkflow() {
|
||||
@@ -265,7 +418,7 @@ Handle different types of errors that may occur during workflow execution:
|
||||
import { SimStudioClient, SimStudioError } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithErrorHandling() {
|
||||
@@ -308,14 +461,14 @@ Configure the client using environment variables:
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
// Development configuration
|
||||
const apiKey = process.env.SIMSTUDIO_API_KEY;
|
||||
const apiKey = process.env.SIM_API_KEY;
|
||||
if (!apiKey) {
|
||||
throw new Error('SIMSTUDIO_API_KEY environment variable is required');
|
||||
throw new Error('SIM_API_KEY environment variable is required');
|
||||
}
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey,
|
||||
baseUrl: process.env.SIMSTUDIO_BASE_URL // optional
|
||||
baseUrl: process.env.SIM_BASE_URL // optional
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
@@ -324,14 +477,14 @@ Configure the client using environment variables:
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
// Production configuration with validation
|
||||
const apiKey = process.env.SIMSTUDIO_API_KEY;
|
||||
const apiKey = process.env.SIM_API_KEY;
|
||||
if (!apiKey) {
|
||||
throw new Error('SIMSTUDIO_API_KEY environment variable is required');
|
||||
throw new Error('SIM_API_KEY environment variable is required');
|
||||
}
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey,
|
||||
baseUrl: process.env.SIMSTUDIO_BASE_URL || 'https://sim.ai'
|
||||
baseUrl: process.env.SIM_BASE_URL || 'https://sim.ai'
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
@@ -347,7 +500,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const app = express();
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
app.use(express.json());
|
||||
@@ -389,7 +542,7 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
export default async function handler(
|
||||
@@ -440,14 +593,91 @@ async function executeClientSideWorkflow() {
|
||||
});
|
||||
|
||||
console.log('Workflow result:', result);
|
||||
|
||||
|
||||
// Update UI with result
|
||||
document.getElementById('result')!.textContent =
|
||||
document.getElementById('result')!.textContent =
|
||||
JSON.stringify(result.output, null, 2);
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### File Upload
|
||||
|
||||
File objects are automatically detected and converted to base64 format. Include them in your input under the field name matching your workflow's API trigger input format.
|
||||
|
||||
The SDK converts File objects to this format:
|
||||
```typescript
|
||||
{
|
||||
type: 'file',
|
||||
data: 'data:mime/type;base64,base64data',
|
||||
name: 'filename',
|
||||
mime: 'mime/type'
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, you can manually provide files using the URL format:
|
||||
```typescript
|
||||
{
|
||||
type: 'url',
|
||||
data: 'https://example.com/file.pdf',
|
||||
name: 'file.pdf',
|
||||
mime: 'application/pdf'
|
||||
}
|
||||
```
|
||||
|
||||
<Tabs items={['Browser', 'Node.js']}>
|
||||
<Tab value="Browser">
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.NEXT_PUBLIC_SIM_API_KEY!
|
||||
});
|
||||
|
||||
// From file input
|
||||
async function handleFileUpload(event: Event) {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const files = Array.from(input.files || []);
|
||||
|
||||
// Include files under the field name from your API trigger's input format
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: {
|
||||
documents: files, // Must match your workflow's "files" field name
|
||||
instructions: 'Analyze these documents'
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Result:', result);
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
<Tab value="Node.js">
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
import fs from 'fs';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
// Read file and create File object
|
||||
const fileBuffer = fs.readFileSync('./document.pdf');
|
||||
const file = new File([fileBuffer], 'document.pdf', {
|
||||
type: 'application/pdf'
|
||||
});
|
||||
|
||||
// Include files under the field name from your API trigger's input format
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: {
|
||||
documents: [file], // Must match your workflow's "files" field name
|
||||
query: 'Summarize this document'
|
||||
}
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
// Attach to button click
|
||||
document.getElementById('executeBtn')?.addEventListener('click', executeClientSideWorkflow);
|
||||
@@ -466,7 +696,7 @@ import { useState, useCallback } from 'react';
|
||||
import { SimStudioClient, WorkflowExecutionResult } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.NEXT_PUBLIC_SIMSTUDIO_API_KEY!
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
interface UseWorkflowResult {
|
||||
@@ -522,7 +752,7 @@ function WorkflowComponent() {
|
||||
<button onClick={handleExecute} disabled={loading}>
|
||||
{loading ? 'Executing...' : 'Execute Workflow'}
|
||||
</button>
|
||||
|
||||
|
||||
{error && <div>Error: {error.message}</div>}
|
||||
{result && (
|
||||
<div>
|
||||
@@ -535,6 +765,251 @@ function WorkflowComponent() {
|
||||
}
|
||||
```
|
||||
|
||||
### Async Workflow Execution
|
||||
|
||||
Execute workflows asynchronously for long-running tasks:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient, AsyncExecutionResult } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeAsync() {
|
||||
try {
|
||||
// Start async execution
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: { data: 'large dataset' },
|
||||
async: true // Execute asynchronously
|
||||
});
|
||||
|
||||
// Check if result is an async execution
|
||||
if ('taskId' in result) {
|
||||
console.log('Task ID:', result.taskId);
|
||||
console.log('Status endpoint:', result.links.status);
|
||||
|
||||
// Poll for completion
|
||||
let status = await client.getJobStatus(result.taskId);
|
||||
|
||||
while (status.status === 'queued' || status.status === 'processing') {
|
||||
console.log('Current status:', status.status);
|
||||
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds
|
||||
status = await client.getJobStatus(result.taskId);
|
||||
}
|
||||
|
||||
if (status.status === 'completed') {
|
||||
console.log('Workflow completed!');
|
||||
console.log('Output:', status.output);
|
||||
console.log('Duration:', status.metadata.duration);
|
||||
} else {
|
||||
console.error('Workflow failed:', status.error);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
executeAsync();
|
||||
```
|
||||
|
||||
### Rate Limiting and Retry
|
||||
|
||||
Handle rate limits automatically with exponential backoff:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient, SimStudioError } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithRetryHandling() {
|
||||
try {
|
||||
// Automatically retries on rate limit
|
||||
const result = await client.executeWithRetry('workflow-id', {
|
||||
input: { message: 'Process this' }
|
||||
}, {
|
||||
maxRetries: 5,
|
||||
initialDelay: 1000,
|
||||
maxDelay: 60000,
|
||||
backoffMultiplier: 2
|
||||
});
|
||||
|
||||
console.log('Success:', result);
|
||||
} catch (error) {
|
||||
if (error instanceof SimStudioError && error.code === 'RATE_LIMIT_EXCEEDED') {
|
||||
console.error('Rate limit exceeded after all retries');
|
||||
|
||||
// Check rate limit info
|
||||
const rateLimitInfo = client.getRateLimitInfo();
|
||||
if (rateLimitInfo) {
|
||||
console.log('Rate limit resets at:', new Date(rateLimitInfo.reset * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Usage Monitoring
|
||||
|
||||
Monitor your account usage and limits:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function checkUsage() {
|
||||
try {
|
||||
const limits = await client.getUsageLimits();
|
||||
|
||||
console.log('=== Rate Limits ===');
|
||||
console.log('Sync requests:');
|
||||
console.log(' Limit:', limits.rateLimit.sync.limit);
|
||||
console.log(' Remaining:', limits.rateLimit.sync.remaining);
|
||||
console.log(' Resets at:', limits.rateLimit.sync.resetAt);
|
||||
console.log(' Is limited:', limits.rateLimit.sync.isLimited);
|
||||
|
||||
console.log('\nAsync requests:');
|
||||
console.log(' Limit:', limits.rateLimit.async.limit);
|
||||
console.log(' Remaining:', limits.rateLimit.async.remaining);
|
||||
console.log(' Resets at:', limits.rateLimit.async.resetAt);
|
||||
console.log(' Is limited:', limits.rateLimit.async.isLimited);
|
||||
|
||||
console.log('\n=== Usage ===');
|
||||
console.log('Current period cost: $' + limits.usage.currentPeriodCost.toFixed(2));
|
||||
console.log('Limit: $' + limits.usage.limit.toFixed(2));
|
||||
console.log('Plan:', limits.usage.plan);
|
||||
|
||||
const percentUsed = (limits.usage.currentPeriodCost / limits.usage.limit) * 100;
|
||||
console.log('Usage: ' + percentUsed.toFixed(1) + '%');
|
||||
|
||||
if (percentUsed > 80) {
|
||||
console.warn('⚠️ Warning: You are approaching your usage limit!');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error checking usage:', error);
|
||||
}
|
||||
}
|
||||
|
||||
checkUsage();
|
||||
```
|
||||
|
||||
### Streaming Workflow Execution
|
||||
|
||||
Execute workflows with real-time streaming responses:
|
||||
|
||||
```typescript
|
||||
import { SimStudioClient } from 'simstudio-ts-sdk';
|
||||
|
||||
const client = new SimStudioClient({
|
||||
apiKey: process.env.SIM_API_KEY!
|
||||
});
|
||||
|
||||
async function executeWithStreaming() {
|
||||
try {
|
||||
// Enable streaming for specific block outputs
|
||||
const result = await client.executeWorkflow('workflow-id', {
|
||||
input: { message: 'Count to five' },
|
||||
stream: true,
|
||||
selectedOutputs: ['agent1.content'] // Use blockName.attribute format
|
||||
});
|
||||
|
||||
console.log('Workflow result:', result);
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The streaming response follows the Server-Sent Events (SSE) format:
|
||||
|
||||
```
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":"One"}
|
||||
|
||||
data: {"blockId":"7b7735b9-19e5-4bd6-818b-46aae2596e9f","chunk":", two"}
|
||||
|
||||
data: {"event":"done","success":true,"output":{},"metadata":{"duration":610}}
|
||||
|
||||
data: [DONE]
|
||||
```
|
||||
|
||||
**React Streaming Example:**
|
||||
|
||||
```typescript
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
function StreamingWorkflow() {
|
||||
const [output, setOutput] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const executeStreaming = async () => {
|
||||
setLoading(true);
|
||||
setOutput('');
|
||||
|
||||
// IMPORTANT: Make this API call from your backend server, not the browser
|
||||
// Never expose your API key in client-side code
|
||||
const response = await fetch('https://sim.ai/api/workflows/WORKFLOW_ID/execute', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': process.env.SIM_API_KEY! // Server-side environment variable only
|
||||
},
|
||||
body: JSON.stringify({
|
||||
message: 'Generate a story',
|
||||
stream: true,
|
||||
selectedOutputs: ['agent1.content']
|
||||
})
|
||||
});
|
||||
|
||||
const reader = response.body?.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
while (reader) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
const chunk = decoder.decode(value);
|
||||
const lines = chunk.split('\n\n');
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('data: ')) {
|
||||
const data = line.slice(6);
|
||||
if (data === '[DONE]') {
|
||||
setLoading(false);
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(data);
|
||||
if (parsed.chunk) {
|
||||
setOutput(prev => prev + parsed.chunk);
|
||||
} else if (parsed.event === 'done') {
|
||||
console.log('Execution complete:', parsed.metadata);
|
||||
}
|
||||
} catch (e) {
|
||||
// Skip invalid JSON
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button onClick={executeStreaming} disabled={loading}>
|
||||
{loading ? 'Generating...' : 'Start Streaming'}
|
||||
</button>
|
||||
<div style={{ whiteSpace: 'pre-wrap' }}>{output}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Getting Your API Key
|
||||
|
||||
<Steps>
|
||||
@@ -564,34 +1039,6 @@ function WorkflowComponent() {
|
||||
- Node.js 16+
|
||||
- TypeScript 5.0+ (for TypeScript projects)
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
The SDK is written in TypeScript and provides full type safety:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
SimStudioClient,
|
||||
WorkflowExecutionResult,
|
||||
WorkflowStatus,
|
||||
SimStudioError
|
||||
} from 'simstudio-ts-sdk';
|
||||
|
||||
// Type-safe client initialization
|
||||
const client: SimStudioClient = new SimStudioClient({
|
||||
apiKey: process.env.SIMSTUDIO_API_KEY!
|
||||
});
|
||||
|
||||
// Type-safe workflow execution
|
||||
const result: WorkflowExecutionResult = await client.executeWorkflow('workflow-id', {
|
||||
input: {
|
||||
message: 'Hello, TypeScript!'
|
||||
}
|
||||
});
|
||||
|
||||
// Type-safe status checking
|
||||
const status: WorkflowStatus = await client.getWorkflowStatus('workflow-id');
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
Apache-2.0
|
||||
|
||||
@@ -57,7 +57,7 @@ In Sim, the Airtable integration enables your agents to interact with your Airta
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrates Airtable into the workflow. Can create, get, list, or update Airtable records. Requires OAuth. Can be used in trigger mode to trigger a workflow when an update is made to an Airtable table.
|
||||
Integrates Airtable into the workflow. Can create, get, list, or update Airtable records. Can be used in trigger mode to trigger a workflow when an update is made to an Airtable table.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ In Sim, the BrowserUse integration allows your agents to interact with the web a
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Browser Use into the workflow. Can navigate the web and perform actions as if a real user was interacting with the browser. Requires API Key.
|
||||
Integrate Browser Use into the workflow. Can navigate the web and perform actions as if a real user was interacting with the browser.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ In Sim, the Clay integration allows your agents to push structured data into Cla
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Clay into the workflow. Can populate a table with data. Requires an API Key.
|
||||
Integrate Clay into the workflow. Can populate a table with data.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ In Sim, the Confluence integration enables your agents to access and leverage yo
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Confluence into the workflow. Can read and update a page. Requires OAuth.
|
||||
Integrate Confluence into the workflow. Can read and update a page.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Discord components in Sim use efficient lazy loading, only fetching data when ne
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Discord into the workflow. Can send and get messages, get server information, and get a user’s information. Requires bot API key.
|
||||
Integrate Discord into the workflow. Can send and get messages, get server information, and get a user’s information.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ In Sim, the ElevenLabs integration enables your agents to convert text to lifeli
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate ElevenLabs into the workflow. Can convert text to speech. Requires API key.
|
||||
Integrate ElevenLabs into the workflow. Can convert text to speech.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ In Sim, the Exa integration allows your agents to search the web for information
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Exa into the workflow. Can search, get contents, find similar links, answer a question, and perform research. Requires API Key.
|
||||
Integrate Exa into the workflow. Can search, get contents, find similar links, answer a question, and perform research.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ This allows your agents to gather information from websites, extract structured
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Firecrawl into the workflow. Can search, scrape, or crawl websites. Requires API Key.
|
||||
Integrate Firecrawl into the workflow. Can search, scrape, or crawl websites.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ In Sim, the GitHub integration enables your agents to interact directly with Git
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Github into the workflow. Can get get PR details, create PR comment, get repository info, and get latest commit. Requires github token API Key. Can be used in trigger mode to trigger a workflow when a PR is created, commented on, or a commit is pushed.
|
||||
Integrate Github into the workflow. Can get get PR details, create PR comment, get repository info, and get latest commit. Can be used in trigger mode to trigger a workflow when a PR is created, commented on, or a commit is pushed.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ In Sim, the Gmail integration enables your agents to send, read, and search emai
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Gmail into the workflow. Can send, read, and search emails. Requires OAuth. Can be used in trigger mode to trigger a workflow when a new email is received.
|
||||
Integrate Gmail into the workflow. Can send, read, and search emails. Can be used in trigger mode to trigger a workflow when a new email is received.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ In Sim, the Google Calendar integration enables your agents to programmatically
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Calendar into the workflow. Can create, read, update, and list calendar events. Requires OAuth.
|
||||
Integrate Google Calendar into the workflow. Can create, read, update, and list calendar events.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ In Sim, the Google Docs integration enables your agents to interact directly wit
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Docs into the workflow. Can read, write, and create documents. Requires OAuth.
|
||||
Integrate Google Docs into the workflow. Can read, write, and create documents.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ In Sim, the Google Drive integration enables your agents to interact directly wi
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Drive into the workflow. Can create, upload, and list files. Requires OAuth.
|
||||
Integrate Google Drive into the workflow. Can create, upload, and list files.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -69,9 +69,6 @@ Integrate Google Forms into your workflow. Provide a Form ID to list responses,
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| formId | string | Yes | The ID of the Google Form |
|
||||
| responseId | string | No | If provided, returns this specific response |
|
||||
| pageSize | number | No | Max responses to return (service may return fewer). Defaults to 5000 |
|
||||
|
||||
#### Output
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ In Sim, the Google Search integration enables your agents to search the web prog
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Search into the workflow. Can search the web. Requires API Key.
|
||||
Integrate Google Search into the workflow. Can search the web.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ In Sim, the Google Sheets integration enables your agents to interact directly w
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Sheets into the workflow. Can read, write, append, and update data. Requires OAuth.
|
||||
Integrate Google Sheets into the workflow. Can read, write, append, and update data.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ In Sim, the HuggingFace integration enables your agents to programmatically gene
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API. Requires API Key.
|
||||
Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ In Sim, the Hunter.io integration enables your agents to programmatically search
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Hunter into the workflow. Can search domains, find email addresses, verify email addresses, discover companies, find companies, and count email addresses. Requires API Key.
|
||||
Integrate Hunter into the workflow. Can search domains, find email addresses, verify email addresses, discover companies, find companies, and count email addresses.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ In Sim, the DALL-E integration enables your agents to generate images programmat
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image. Requires API Key.
|
||||
Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ This integration is particularly valuable for building agents that need to gathe
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Jina into the workflow. Extracts content from websites. Requires API Key.
|
||||
Integrate Jina into the workflow. Extracts content from websites.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ In Sim, the Jira integration allows your agents to seamlessly interact with your
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Jira into the workflow. Can read, write, and update issues. Requires OAuth.
|
||||
Integrate Jira into the workflow. Can read, write, and update issues.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ Search for similar content in a knowledge base using vector similarity
|
||||
| `knowledgeBaseId` | string | Yes | ID of the knowledge base to search in |
|
||||
| `query` | string | No | Search query text \(optional when using tag filters\) |
|
||||
| `topK` | number | No | Number of most similar results to return \(1-100\) |
|
||||
| `tagFilters` | any | No | Array of tag filters with tagName and tagValue properties |
|
||||
| `tagFilters` | array | No | Array of tag filters with tagName and tagValue properties |
|
||||
|
||||
#### Output
|
||||
|
||||
|
||||
@@ -10,8 +10,11 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
color="#5E6AD2"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='currentColor'
|
||||
|
||||
|
||||
viewBox='0 0 100 100'
|
||||
>
|
||||
<path
|
||||
@@ -39,7 +42,7 @@ In Sim, the Linear integration allows your agents to seamlessly interact with yo
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Linear into the workflow. Can read and create issues. Requires OAuth.
|
||||
Integrate Linear into the workflow. Can read and create issues.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ To implement Linkup in your agent, simply add the tool to your agent's configura
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Linkup into the workflow. Can search the web. Requires API Key.
|
||||
Integrate Linkup into the workflow. Can search the web.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ In Sim, the Mem0 integration enables your agents to maintain persistent memory a
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Mem0 into the workflow. Can add, search, and retrieve memories. Requires API Key.
|
||||
Integrate Mem0 into the workflow. Can add, search, and retrieve memories.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"google_forms",
|
||||
"google_search",
|
||||
"google_sheets",
|
||||
"google_vault",
|
||||
"huggingface",
|
||||
"hunter",
|
||||
"image_generator",
|
||||
@@ -69,6 +70,7 @@
|
||||
"whatsapp",
|
||||
"wikipedia",
|
||||
"x",
|
||||
"youtube"
|
||||
"youtube",
|
||||
"zep"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ In Sim, the Microsoft Excel integration provides seamless access to spreadsheet
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Microsoft Excel into the workflow. Can read, write, update, and add to table. Requires OAuth.
|
||||
Integrate Microsoft Excel into the workflow. Can read, write, update, and add to table.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ In Sim, the Microsoft Planner integration allows your agents to programmatically
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Microsoft Planner into the workflow. Can read and create tasks. Requires OAuth.
|
||||
Integrate Microsoft Planner into the workflow. Can read and create tasks.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ In Sim, the Microsoft Teams integration enables your agents to interact directly
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Microsoft Teams into the workflow. Can read and write chat messages, and read and write channel messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel.
|
||||
Integrate Microsoft Teams into the workflow. Can read and write chat messages, and read and write channel messages. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel.
|
||||
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ Read content from a Microsoft Teams chat
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `chatId` | string | Yes | The ID of the chat to read from |
|
||||
| `includeAttachments` | boolean | No | Download and include message attachments \(hosted contents\) into storage |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -125,6 +126,7 @@ Read content from a Microsoft Teams chat
|
||||
| `attachmentCount` | number | Total number of attachments found |
|
||||
| `attachmentTypes` | array | Types of attachments found |
|
||||
| `content` | string | Formatted content of chat messages |
|
||||
| `attachments` | file[] | Uploaded attachments for convenience \(flattened\) |
|
||||
|
||||
### `microsoft_teams_write_chat`
|
||||
|
||||
@@ -158,6 +160,7 @@ Read content from a Microsoft Teams channel
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `teamId` | string | Yes | The ID of the team to read from |
|
||||
| `channelId` | string | Yes | The ID of the channel to read from |
|
||||
| `includeAttachments` | boolean | No | Download and include message attachments \(hosted contents\) into storage |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -171,6 +174,7 @@ Read content from a Microsoft Teams channel
|
||||
| `attachmentCount` | number | Total number of attachments found |
|
||||
| `attachmentTypes` | array | Types of attachments found |
|
||||
| `content` | string | Formatted content of channel messages |
|
||||
| `attachments` | file[] | Uploaded attachments for convenience \(flattened\) |
|
||||
|
||||
### `microsoft_teams_write_channel`
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ The Mistral Parse tool is particularly useful for scenarios where your agents ne
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Mistral Parse into the workflow. Can extract text from uploaded PDF documents, or from a URL. Requires API Key.
|
||||
Integrate Mistral Parse into the workflow. Can extract text from uploaded PDF documents, or from a URL.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ This integration bridges the gap between your AI workflows and your knowledge ba
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate with Notion into the workflow. Can read page, read database, create page, create database, append content, query database, and search workspace. Requires OAuth.
|
||||
Integrate with Notion into the workflow. Can read page, read database, create page, create database, append content, query database, and search workspace.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ In Sim, the OneDrive integration enables your agents to directly interact with y
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate OneDrive into the workflow. Can create, upload, and list files. Requires OAuth.
|
||||
Integrate OneDrive into the workflow. Can create, upload, and list files.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ In Sim, the OpenAI integration enables your agents to leverage these powerful AI
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Embeddings into the workflow. Can generate embeddings from text. Requires API Key.
|
||||
Integrate Embeddings into the workflow. Can generate embeddings from text.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ In Sim, the Microsoft Outlook integration enables your agents to interact direct
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Outlook into the workflow. Can read, draft, and send email messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a new email is received.
|
||||
Integrate Outlook into the workflow. Can read, draft, and send email messages. Can be used in trigger mode to trigger a workflow when a new email is received.
|
||||
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ Read emails from Outlook
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `folder` | string | No | Folder ID to read emails from \(default: Inbox\) |
|
||||
| `maxResults` | number | No | Maximum number of emails to retrieve \(default: 1, max: 10\) |
|
||||
| `includeAttachments` | boolean | No | Download and include email attachments |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -213,6 +214,7 @@ Read emails from Outlook
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or status message |
|
||||
| `results` | array | Array of email message objects |
|
||||
| `attachments` | file[] | All email attachments flattened from all emails |
|
||||
|
||||
### `outlook_forward`
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ In Sim, the Parallel AI integration empowers your agents to perform web searches
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Parallel AI into the workflow. Can search the web. Requires API Key.
|
||||
Integrate Parallel AI into the workflow. Can search the web.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ In Sim, the Perplexity integration enables your agents to leverage these powerfu
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Perplexity into the workflow. Can generate completions using Perplexity AI chat models. Requires API Key.
|
||||
Integrate Perplexity into the workflow. Can generate completions using Perplexity AI chat models.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ In Sim, the Pinecone integration enables your agents to leverage vector search c
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Pinecone into the workflow. Can generate embeddings, upsert text, search with text, fetch vectors, and search with vectors. Requires API Key.
|
||||
Integrate Pinecone into the workflow. Can generate embeddings, upsert text, search with text, fetch vectors, and search with vectors.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ This integration allows your agents to leverage powerful vector search and manag
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Qdrant into the workflow. Can upsert, search, and fetch points. Requires API Key.
|
||||
Integrate Qdrant into the workflow. Can upsert, search, and fetch points.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ These operations let your agents access and analyze Reddit content as part of yo
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Reddit into the workflow. Can get posts and comments from a subreddit. Requires OAuth.
|
||||
Integrate Reddit into the workflow. Can get posts and comments from a subreddit.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="schedule"
|
||||
color="#7B68EE"
|
||||
color="#6366F1"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ In Sim, the Serper integration enables your agents to leverage the power of web
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Serper into the workflow. Can search the web. Requires API Key.
|
||||
Integrate Serper into the workflow. Can search the web.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ This allows for powerful automation scenarios such as sending notifications, ale
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Slack into the workflow. Can send messages, create canvases, and read messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a message is sent to a channel.
|
||||
Integrate Slack into the workflow. Can send messages, create canvases, and read messages. Requires Bot Token instead of OAuth in advanced mode. Can be used in trigger mode to trigger a workflow when a message is sent to a channel.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ In Sim, the Stagehand integration enables your agents to extract structured data
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Stagehand into the workflow. Can extract structured data from webpages. Requires API Key.
|
||||
Integrate Stagehand into the workflow. Can extract structured data from webpages.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ In Sim, the Stagehand integration enables your agents to seamlessly interact wit
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks. Requires API Key.
|
||||
Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ Insert data into a Supabase table
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to insert data into |
|
||||
| `data` | any | Yes | The data to insert |
|
||||
| `data` | array | Yes | The data to insert \(array of objects or a single object\) |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
#### Output
|
||||
@@ -195,7 +195,7 @@ Insert or update data in a Supabase table (upsert operation)
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to upsert data into |
|
||||
| `data` | any | Yes | The data to upsert \(insert or update\) |
|
||||
| `data` | array | Yes | The data to upsert \(insert or update\) - array of objects or a single object |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Telegram
|
||||
description: Send messages through Telegram or trigger workflows from Telegram events
|
||||
description: Interact with Telegram
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
@@ -67,7 +67,7 @@ In Sim, the Telegram integration enables your agents to leverage these powerful
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Telegram into the workflow. Can send messages. Can be used in trigger mode to trigger a workflow when a message is sent to a chat.
|
||||
Integrate Telegram into the workflow. Can send and delete messages. Can be used in trigger mode to trigger a workflow when a message is sent to a chat.
|
||||
|
||||
|
||||
|
||||
@@ -89,12 +89,107 @@ Send messages to Telegram channels or users through the Telegram Bot API. Enable
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `success` | boolean | Telegram message send success status |
|
||||
| `messageId` | number | Unique Telegram message identifier |
|
||||
| `chatId` | string | Target chat ID where message was sent |
|
||||
| `text` | string | Text content of the sent message |
|
||||
| `timestamp` | number | Unix timestamp when message was sent |
|
||||
| `from` | object | Information about the bot that sent the message |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Telegram message data |
|
||||
|
||||
### `telegram_delete_message`
|
||||
|
||||
Delete messages in Telegram channels or chats through the Telegram Bot API. Requires the message ID of the message to delete.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Yes | Your Telegram Bot API Token |
|
||||
| `chatId` | string | Yes | Target Telegram chat ID |
|
||||
| `messageId` | string | Yes | Message ID to delete |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Delete operation result |
|
||||
|
||||
### `telegram_send_photo`
|
||||
|
||||
Send photos to Telegram channels or users through the Telegram Bot API.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Yes | Your Telegram Bot API Token |
|
||||
| `chatId` | string | Yes | Target Telegram chat ID |
|
||||
| `photo` | string | Yes | Photo to send. Pass a file_id or HTTP URL |
|
||||
| `caption` | string | No | Photo caption \(optional\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Telegram message data including optional photo\(s\) |
|
||||
|
||||
### `telegram_send_video`
|
||||
|
||||
Send videos to Telegram channels or users through the Telegram Bot API.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Yes | Your Telegram Bot API Token |
|
||||
| `chatId` | string | Yes | Target Telegram chat ID |
|
||||
| `video` | string | Yes | Video to send. Pass a file_id or HTTP URL |
|
||||
| `caption` | string | No | Video caption \(optional\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Telegram message data including optional media |
|
||||
|
||||
### `telegram_send_audio`
|
||||
|
||||
Send audio files to Telegram channels or users through the Telegram Bot API.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Yes | Your Telegram Bot API Token |
|
||||
| `chatId` | string | Yes | Target Telegram chat ID |
|
||||
| `audio` | string | Yes | Audio file to send. Pass a file_id or HTTP URL |
|
||||
| `caption` | string | No | Audio caption \(optional\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Telegram message data including voice/audio information |
|
||||
|
||||
### `telegram_send_animation`
|
||||
|
||||
Send animations (GIFs) to Telegram channels or users through the Telegram Bot API.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `botToken` | string | Yes | Your Telegram Bot API Token |
|
||||
| `chatId` | string | Yes | Target Telegram chat ID |
|
||||
| `animation` | string | Yes | Animation to send. Pass a file_id or HTTP URL |
|
||||
| `caption` | string | No | Animation caption \(optional\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `message` | string | Success or error message |
|
||||
| `data` | object | Telegram message data including optional media |
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ In Sim, the Vision integration enables your agents to analyze images with vision
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Vision into the workflow. Can analyze images with vision models. Requires API Key.
|
||||
Integrate Vision into the workflow. Can analyze images with vision models.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ In Sim, the Wealthbox integration enables your agents to seamlessly interact wit
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Wealthbox into the workflow. Can read and write notes, read and write contacts, and read and write tasks. Requires OAuth.
|
||||
Integrate Wealthbox into the workflow. Can read and write notes, read and write contacts, and read and write tasks.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ In Sim, the X integration enables sophisticated social media automation scenario
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate X into the workflow. Can post a new tweet, get tweet details, search tweets, and get user profile. Requires OAuth.
|
||||
Integrate X into the workflow. Can post a new tweet, get tweet details, search tweets, and get user profile.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: YouTube
|
||||
description: Search for videos on YouTube
|
||||
description: Interact with YouTube videos, channels, and playlists
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
@@ -40,7 +40,7 @@ In Sim, the YouTube integration enables your agents to programmatically search a
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate YouTube into the workflow. Can search for videos. Requires API Key.
|
||||
Integrate YouTube into the workflow. Can search for videos, get video details, get channel information, get playlist items, and get video comments.
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,99 @@ Search for videos on YouTube using the YouTube Data API.
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array of YouTube videos matching the search query |
|
||||
|
||||
### `youtube_video_details`
|
||||
|
||||
Get detailed information about a specific YouTube video.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `videoId` | string | Yes | YouTube video ID |
|
||||
| `apiKey` | string | Yes | YouTube API Key |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `videoId` | string | YouTube video ID |
|
||||
| `title` | string | Video title |
|
||||
| `description` | string | Video description |
|
||||
| `channelId` | string | Channel ID |
|
||||
| `channelTitle` | string | Channel name |
|
||||
| `publishedAt` | string | Published date and time |
|
||||
| `duration` | string | Video duration in ISO 8601 format |
|
||||
| `viewCount` | number | Number of views |
|
||||
| `likeCount` | number | Number of likes |
|
||||
| `commentCount` | number | Number of comments |
|
||||
| `thumbnail` | string | Video thumbnail URL |
|
||||
| `tags` | array | Video tags |
|
||||
|
||||
### `youtube_channel_info`
|
||||
|
||||
Get detailed information about a YouTube channel.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `channelId` | string | No | YouTube channel ID \(use either channelId or username\) |
|
||||
| `username` | string | No | YouTube channel username \(use either channelId or username\) |
|
||||
| `apiKey` | string | Yes | YouTube API Key |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `channelId` | string | YouTube channel ID |
|
||||
| `title` | string | Channel name |
|
||||
| `description` | string | Channel description |
|
||||
| `subscriberCount` | number | Number of subscribers |
|
||||
| `videoCount` | number | Number of videos |
|
||||
| `viewCount` | number | Total channel views |
|
||||
| `publishedAt` | string | Channel creation date |
|
||||
| `thumbnail` | string | Channel thumbnail URL |
|
||||
| `customUrl` | string | Channel custom URL |
|
||||
|
||||
### `youtube_playlist_items`
|
||||
|
||||
Get videos from a YouTube playlist.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `playlistId` | string | Yes | YouTube playlist ID |
|
||||
| `maxResults` | number | No | Maximum number of videos to return |
|
||||
| `pageToken` | string | No | Page token for pagination |
|
||||
| `apiKey` | string | Yes | YouTube API Key |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array of videos in the playlist |
|
||||
|
||||
### `youtube_comments`
|
||||
|
||||
Get comments from a YouTube video.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `videoId` | string | Yes | YouTube video ID |
|
||||
| `maxResults` | number | No | Maximum number of comments to return |
|
||||
| `order` | string | No | Order of comments: time or relevance |
|
||||
| `pageToken` | string | No | Page token for pagination |
|
||||
| `apiKey` | string | Yes | YouTube API Key |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `items` | array | Array of comments from the video |
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user