mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 23:17:59 -05:00
Compare commits
225 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c92d5d456 | ||
|
|
aa01e7e58a | ||
|
|
a3c76da636 | ||
|
|
cf19c895bb | ||
|
|
c017027000 | ||
|
|
73d779ad79 | ||
|
|
25781279e2 | ||
|
|
6fada45cd8 | ||
|
|
e640102797 | ||
|
|
16f5819941 | ||
|
|
d83865c635 | ||
|
|
6b4ebbac6e | ||
|
|
708321d0bf | ||
|
|
e4d35afe1f | ||
|
|
1d74ccfeda | ||
|
|
545e590ce5 | ||
|
|
93f9293f2c | ||
|
|
b5570c1c0e | ||
|
|
225571c49a | ||
|
|
a1c518e4e1 | ||
|
|
04922fe5c9 | ||
|
|
8e70a61ba9 | ||
|
|
abae6b96b5 | ||
|
|
bff1852a85 | ||
|
|
7327b448e5 | ||
|
|
eb1e90bb7f | ||
|
|
3905d1cb81 | ||
|
|
cd084e8236 | ||
|
|
5d96484501 | ||
|
|
6747a497fc | ||
|
|
2df65527d3 | ||
|
|
d0b69455e2 | ||
|
|
6028b1f5c0 | ||
|
|
658cf11299 | ||
|
|
6312df3a07 | ||
|
|
9de7a00373 | ||
|
|
325a666a8b | ||
|
|
2149f5e36d | ||
|
|
009e1da5f1 | ||
|
|
6101493f12 | ||
|
|
4b5c2b43e9 | ||
|
|
bd402cdda5 | ||
|
|
0c30646a2d | ||
|
|
53792b9a1d | ||
|
|
48f86e66f4 | ||
|
|
fd422b5d0d | ||
|
|
17cf72834d | ||
|
|
3122b506fd | ||
|
|
a31305b7ee | ||
|
|
4f26a7aa73 | ||
|
|
a06ae0d2e7 | ||
|
|
ab97ac5a77 | ||
|
|
ac8bf96eee | ||
|
|
d4165f5be6 | ||
|
|
994c35f62c | ||
|
|
4ce6bc94c3 | ||
|
|
ba21d274ec | ||
|
|
d73a97ffa2 | ||
|
|
f2ec43e4f9 | ||
|
|
3e5d3735dc | ||
|
|
172d51e061 | ||
|
|
1ad31c92ac | ||
|
|
065fc5b87b | ||
|
|
3798c56e8c | ||
|
|
c591433248 | ||
|
|
f0186593a1 | ||
|
|
6cf02b9b5a | ||
|
|
2dc75b1ac1 | ||
|
|
d3f7ef4ac4 | ||
|
|
9a6cc78332 | ||
|
|
ea8762e99b | ||
|
|
cff0a8718e | ||
|
|
abca73106d | ||
|
|
afb99fbaf1 | ||
|
|
4d973ffb01 | ||
|
|
8841e9bd6b | ||
|
|
3d4b9f0665 | ||
|
|
c48039f97f | ||
|
|
8f7b11f089 | ||
|
|
ae670a7819 | ||
|
|
a5c224e4b0 | ||
|
|
0785f6e920 | ||
|
|
cf4a935575 | ||
|
|
521316bb8c | ||
|
|
d357280003 | ||
|
|
adf8c2244c | ||
|
|
ebfdb9ce3b | ||
|
|
784992f347 | ||
|
|
5218dd41b9 | ||
|
|
07e70409c7 | ||
|
|
07ba17422b | ||
|
|
d45324bb83 | ||
|
|
ced64129da | ||
|
|
1e14743391 | ||
|
|
a0bb754c8c | ||
|
|
851031239d | ||
|
|
3811b509ef | ||
|
|
abb835d22d | ||
|
|
f2a046ff24 | ||
|
|
bd6d4a91a3 | ||
|
|
21beca8fd5 | ||
|
|
0a86eda853 | ||
|
|
60a061e38a | ||
|
|
ab71fcfc49 | ||
|
|
864622c1dc | ||
|
|
8668622d66 | ||
|
|
53dd277cfe | ||
|
|
0e8e8c7a47 | ||
|
|
47da5eb6e8 | ||
|
|
37dcde2afc | ||
|
|
e31627c7c2 | ||
|
|
57c98d86ba | ||
|
|
0f7dfe084a | ||
|
|
afc1632830 | ||
|
|
56eee2c2d2 | ||
|
|
fc558a8eef | ||
|
|
c68cadfb84 | ||
|
|
95d93a2532 | ||
|
|
59b2023124 | ||
|
|
a672f17136 | ||
|
|
1de59668e4 | ||
|
|
26243b99e8 | ||
|
|
fce1423d05 | ||
|
|
3656d3d7ad | ||
|
|
581929bc01 | ||
|
|
11d8188415 | ||
|
|
36c98d18e9 | ||
|
|
0cf87e650d | ||
|
|
baef8d77f9 | ||
|
|
b74ab46820 | ||
|
|
533b4c53e0 | ||
|
|
c2d668c3eb | ||
|
|
1a5d5ddffa | ||
|
|
9de0d91f9a | ||
|
|
3db73ff721 | ||
|
|
9ffb48ee02 | ||
|
|
1f2a317ac2 | ||
|
|
a618d289d8 | ||
|
|
461d7b2342 | ||
|
|
4273161c0f | ||
|
|
54d42b33eb | ||
|
|
2c2c32c64b | ||
|
|
65e861822c | ||
|
|
12135d2aa8 | ||
|
|
f75c807580 | ||
|
|
9ea7ea79e9 | ||
|
|
5bbb349d8a | ||
|
|
ea09fcecb7 | ||
|
|
9ccb7600f9 | ||
|
|
ee17cf461a | ||
|
|
43cb124d97 | ||
|
|
76889fde26 | ||
|
|
7780d9b32b | ||
|
|
4a703a02cb | ||
|
|
a969d09782 | ||
|
|
0bc778130f | ||
|
|
df3d532495 | ||
|
|
f4f8fc051e | ||
|
|
76fac13f3d | ||
|
|
a3838302e0 | ||
|
|
4310dd6c15 | ||
|
|
813a0fb741 | ||
|
|
7e23e942d7 | ||
|
|
7fcbafab97 | ||
|
|
056dc2879c | ||
|
|
1aec32b7e2 | ||
|
|
316c9704af | ||
|
|
4e3a3bd1b1 | ||
|
|
36773e8cdb | ||
|
|
7ac89e35a1 | ||
|
|
faa094195a | ||
|
|
69319d21cd | ||
|
|
8362fd7a83 | ||
|
|
39ad793a9a | ||
|
|
921c755711 | ||
|
|
41ec75fcad | ||
|
|
f2502f5e48 | ||
|
|
f3c4f7e20a | ||
|
|
f578f43c9a | ||
|
|
5c73038023 | ||
|
|
92132024ca | ||
|
|
ed11456de3 | ||
|
|
8739a3d378 | ||
|
|
ca015deea9 | ||
|
|
fd6d927228 | ||
|
|
6ac59a3264 | ||
|
|
aa84c75360 | ||
|
|
ebb8cf8bf9 | ||
|
|
cadfcdbfbd | ||
|
|
7d62c200fa | ||
|
|
df646256b3 | ||
|
|
7c73f5ffe0 | ||
|
|
bb5f40a027 | ||
|
|
5ae5429296 | ||
|
|
fcf128f6db | ||
|
|
56543dafb4 | ||
|
|
7cc4574913 | ||
|
|
3f900947ce | ||
|
|
bda8ee772a | ||
|
|
104d34cc9e | ||
|
|
06e9a6b302 | ||
|
|
fed4e507cc | ||
|
|
389456e0f3 | ||
|
|
c720f23d9b | ||
|
|
89f7d2b943 | ||
|
|
923c05239c | ||
|
|
3424a338b7 | ||
|
|
51b1e97fa2 | ||
|
|
ab74b13802 | ||
|
|
861ab1446a | ||
|
|
e6f519a5a6 | ||
|
|
8226e7b40a | ||
|
|
b177b291cf | ||
|
|
9c3b43325b | ||
|
|
973a5c6497 | ||
|
|
78437c688e | ||
|
|
3b74250335 | ||
|
|
c68800c772 | ||
|
|
5403665fa9 | ||
|
|
3d3443f68e | ||
|
|
e5c0b14367 | ||
|
|
a495516901 | ||
|
|
1f9b4a8ef0 | ||
|
|
3372829c30 | ||
|
|
45372aece5 |
@@ -77,7 +77,7 @@ services:
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_DB=simstudio
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- "${POSTGRES_PORT:-5432}:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
|
||||
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@@ -2,8 +2,7 @@ name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
branches: [main, staging]
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
@@ -56,7 +55,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
@@ -70,10 +69,7 @@ jobs:
|
||||
images: ${{ matrix.image }}
|
||||
tags: |
|
||||
type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=ref,event=pr,suffix=-${{ matrix.arch }}
|
||||
type=semver,pattern={{version}},suffix=-${{ matrix.arch }}
|
||||
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.arch }}
|
||||
type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-${{ matrix.arch }}
|
||||
type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
|
||||
type=sha,format=long,suffix=-${{ matrix.arch }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
@@ -82,7 +78,7 @@ jobs:
|
||||
context: .
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=build-v3
|
||||
@@ -93,7 +89,7 @@ jobs:
|
||||
create-manifests:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-push
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -119,10 +115,6 @@ jobs:
|
||||
images: ${{ matrix.image }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||
type=sha,format=long
|
||||
|
||||
- name: Create and push manifest
|
||||
|
||||
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -26,12 +26,13 @@ jobs:
|
||||
node-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run tests with coverage
|
||||
env:
|
||||
NODE_OPTIONS: '--no-warnings'
|
||||
NEXT_PUBLIC_APP_URL: 'https://www.sim.ai'
|
||||
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/simstudio'
|
||||
ENCRYPTION_KEY: '7cf672e460e430c1fba707575c2b0e2ad5a99dddf9b7b7e3b5646e630861db1c' # dummy key for CI only
|
||||
run: bun run test
|
||||
|
||||
@@ -39,6 +40,7 @@ jobs:
|
||||
env:
|
||||
NODE_OPTIONS: '--no-warnings'
|
||||
NEXT_PUBLIC_APP_URL: 'https://www.sim.ai'
|
||||
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/simstudio'
|
||||
STRIPE_SECRET_KEY: 'dummy_key_for_ci_only'
|
||||
STRIPE_WEBHOOK_SECRET: 'dummy_secret_for_ci_only'
|
||||
RESEND_API_KEY: 'dummy_key_for_ci_only'
|
||||
@@ -71,7 +73,7 @@ jobs:
|
||||
run: bun install
|
||||
|
||||
- name: Apply migrations
|
||||
working-directory: ./apps/sim
|
||||
working-directory: ./packages/db
|
||||
env:
|
||||
DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }}
|
||||
run: bunx drizzle-kit migrate
|
||||
run: bunx drizzle-kit migrate --config=./drizzle.config.ts
|
||||
|
||||
151
.github/workflows/i18n.yml
vendored
Normal file
151
.github/workflows/i18n.yml
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
name: 'Auto-translate Documentation'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ staging ]
|
||||
paths:
|
||||
- 'apps/docs/content/docs/en/**'
|
||||
- 'apps/docs/i18n.json'
|
||||
workflow_dispatch: # Allow manual triggers
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
translate:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.actor != 'github-actions[bot]' # Prevent infinite loops
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Run Lingo.dev translations
|
||||
env:
|
||||
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}
|
||||
run: |
|
||||
cd apps/docs
|
||||
bunx lingo.dev@latest i18n
|
||||
|
||||
- name: Check for translation changes
|
||||
id: changes
|
||||
run: |
|
||||
cd apps/docs
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
|
||||
if [ -n "$(git status --porcelain content/docs)" ]; then
|
||||
echo "changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create Pull Request with translations
|
||||
if: steps.changes.outputs.changes == 'true'
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
commit-message: "feat(i18n): update translations"
|
||||
title: "🌐 Auto-update translations"
|
||||
body: |
|
||||
## Summary
|
||||
Automated translation updates triggered by changes to documentation.
|
||||
|
||||
This PR was automatically created after content changes were made, updating translations for all supported languages using Lingo.dev AI translation engine.
|
||||
|
||||
**Original trigger**: ${{ github.event.head_commit.message }}
|
||||
**Commit**: ${{ github.sha }}
|
||||
**Workflow**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
## Type of Change
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
- [ ] Breaking change
|
||||
- [x] Documentation
|
||||
- [ ] Other: ___________
|
||||
|
||||
## Testing
|
||||
This PR includes automated translations for modified English documentation content:
|
||||
- 🇪🇸 Spanish (es) translations
|
||||
- 🇫🇷 French (fr) translations
|
||||
- 🇨🇳 Chinese (zh) translations
|
||||
|
||||
**What reviewers should focus on:**
|
||||
- Verify translated content accuracy and context
|
||||
- Check that all links and references work correctly in translated versions
|
||||
- Ensure formatting, code blocks, and structure are preserved
|
||||
- Validate that technical terms are appropriately translated
|
||||
|
||||
## Checklist
|
||||
- [x] Code follows project style guidelines (automated translation)
|
||||
- [x] Self-reviewed my changes (automated process)
|
||||
- [ ] Tests added/updated and passing
|
||||
- [x] No new warnings introduced
|
||||
- [x] I confirm that I have read and agree to the terms outlined in the [Contributor License Agreement (CLA)](./CONTRIBUTING.md#contributor-license-agreement-cla)
|
||||
|
||||
## Screenshots/Videos
|
||||
<!-- Translation changes are text-based - no visual changes expected -->
|
||||
<!-- Reviewers should check the documentation site renders correctly for all languages -->
|
||||
branch: auto-translate/staging-merge-${{ github.run_id }}
|
||||
base: staging
|
||||
labels: |
|
||||
i18n
|
||||
|
||||
verify-translations:
|
||||
needs: translate
|
||||
runs-on: ubuntu-latest
|
||||
if: always() # Run even if translation fails
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: staging
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd apps/docs
|
||||
bun install
|
||||
|
||||
- name: Build documentation to verify translations
|
||||
run: |
|
||||
cd apps/docs
|
||||
bun run build
|
||||
|
||||
- name: Report translation status
|
||||
run: |
|
||||
cd apps/docs
|
||||
echo "## Translation Status Report" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Triggered by merge to staging branch**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
en_count=$(find content/docs/en -name "*.mdx" | wc -l)
|
||||
es_count=$(find content/docs/es -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
||||
fr_count=$(find content/docs/fr -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
||||
zh_count=$(find content/docs/zh -name "*.mdx" 2>/dev/null | wc -l || echo 0)
|
||||
|
||||
es_percentage=$((es_count * 100 / en_count))
|
||||
fr_percentage=$((fr_count * 100 / en_count))
|
||||
zh_percentage=$((zh_count * 100 / en_count))
|
||||
|
||||
echo "### Coverage Statistics" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **🇬🇧 English**: $en_count files (source)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **🇪🇸 Spanish**: $es_count/$en_count files ($es_percentage%)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **🇫🇷 French**: $fr_count/$en_count files ($fr_percentage%)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **🇨🇳 Chinese**: $zh_count/$en_count files ($zh_percentage%)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "🔄 **Auto-translation PR**: Check for new pull request with updated translations" >> $GITHUB_STEP_SUMMARY
|
||||
4
.github/workflows/trigger-deploy.yml
vendored
4
.github/workflows/trigger-deploy.yml
vendored
@@ -35,10 +35,10 @@ jobs:
|
||||
- name: Deploy to Staging
|
||||
if: github.ref == 'refs/heads/staging'
|
||||
working-directory: ./apps/sim
|
||||
run: npx --yes trigger.dev@4.0.0 deploy -e staging
|
||||
run: npx --yes trigger.dev@4.0.4 deploy -e staging
|
||||
|
||||
- name: Deploy to Production
|
||||
if: github.ref == 'refs/heads/main'
|
||||
working-directory: ./apps/sim
|
||||
run: npx --yes trigger.dev@4.0.0 deploy
|
||||
run: npx --yes trigger.dev@4.0.4 deploy
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -68,4 +68,5 @@ start-collector.sh
|
||||
.vscode
|
||||
|
||||
## Helm Chart Tests
|
||||
helm/sim/test
|
||||
helm/sim/test
|
||||
i18n.cache
|
||||
|
||||
18
README.md
18
README.md
@@ -127,8 +127,20 @@ DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio"
|
||||
|
||||
4. Set up the database:
|
||||
|
||||
First, configure the database package environment:
|
||||
```bash
|
||||
bunx drizzle-kit migrate
|
||||
cd packages/db
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Update your `packages/db/.env` file with the database URL:
|
||||
```bash
|
||||
DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio"
|
||||
```
|
||||
|
||||
Then run the migrations:
|
||||
```bash
|
||||
bunx drizzle-kit migrate --config=./drizzle.config.ts
|
||||
```
|
||||
|
||||
5. Start the development servers:
|
||||
@@ -159,8 +171,7 @@ bun run dev:sockets
|
||||
Copilot is a Sim-managed service. To use Copilot on a self-hosted instance:
|
||||
|
||||
- Go to https://sim.ai → Settings → Copilot and generate a Copilot API key
|
||||
- Set `COPILOT_API_KEY` in your self-hosted environment to that value
|
||||
- Host Sim on a publicly available DNS and set NEXT_PUBLIC_APP_URL and BETTER_AUTH_URL to that value ([ngrok](https://ngrok.com/))
|
||||
- Set `COPILOT_API_KEY` environment variable in your self-hosted apps/sim/.env file to that value
|
||||
|
||||
## Tech Stack
|
||||
|
||||
@@ -175,6 +186,7 @@ Copilot is a Sim-managed service. To use Copilot on a self-hosted instance:
|
||||
- **Monorepo**: [Turborepo](https://turborepo.org/)
|
||||
- **Realtime**: [Socket.io](https://socket.io/)
|
||||
- **Background Jobs**: [Trigger.dev](https://trigger.dev/)
|
||||
- **Remote Code Execution**: [E2B](https://www.e2b.dev/)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
export default function SlugLayout({ children }: { children: ReactNode }) {
|
||||
return children
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page'
|
||||
import { notFound } from 'next/navigation'
|
||||
import mdxComponents from '@/components/mdx-components'
|
||||
import { source } from '@/lib/source'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
|
||||
const params = await props.params
|
||||
const page = source.getPage(params.slug)
|
||||
if (!page) notFound()
|
||||
|
||||
const MDX = page.data.body
|
||||
|
||||
return (
|
||||
<DocsPage
|
||||
toc={page.data.toc}
|
||||
full={page.data.full}
|
||||
tableOfContent={{
|
||||
style: 'clerk',
|
||||
enabled: true,
|
||||
header: <div className='mb-2 font-medium text-sm'>On this page</div>,
|
||||
single: false,
|
||||
}}
|
||||
article={{
|
||||
className: 'scroll-smooth max-sm:pb-16',
|
||||
}}
|
||||
tableOfContentPopover={{
|
||||
style: 'clerk',
|
||||
enabled: true,
|
||||
}}
|
||||
footer={{
|
||||
enabled: false,
|
||||
}}
|
||||
>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription>{page.data.description}</DocsDescription>
|
||||
<DocsBody>
|
||||
<MDX components={mdxComponents} />
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
)
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return source.generateParams()
|
||||
}
|
||||
|
||||
export async function generateMetadata(props: { params: Promise<{ slug?: string[] }> }) {
|
||||
const params = await props.params
|
||||
const page = source.getPage(params.slug)
|
||||
if (!page) notFound()
|
||||
|
||||
return {
|
||||
title: page.data.title,
|
||||
description: page.data.description,
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
|
||||
import { ExternalLink, GithubIcon } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { source } from '@/lib/source'
|
||||
|
||||
const GitHubLink = () => (
|
||||
<div className='fixed right-4 bottom-4 z-50'>
|
||||
<Link
|
||||
href='https://github.com/simstudioai/sim'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
className='flex h-8 w-8 items-center justify-center rounded-full border border-border bg-background transition-colors hover:bg-muted'
|
||||
>
|
||||
<GithubIcon className='h-4 w-4' />
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default function Layout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<>
|
||||
<DocsLayout
|
||||
tree={source.pageTree}
|
||||
nav={{
|
||||
title: <div className='flex items-center font-medium'>Sim</div>,
|
||||
}}
|
||||
links={[
|
||||
{
|
||||
text: 'Visit Sim',
|
||||
url: 'https://sim.ai',
|
||||
icon: <ExternalLink className='h-4 w-4' />,
|
||||
},
|
||||
]}
|
||||
sidebar={{
|
||||
defaultOpenLevel: 1,
|
||||
collapsible: true,
|
||||
footer: null,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
<GitHubLink />
|
||||
</>
|
||||
)
|
||||
}
|
||||
161
apps/docs/app/[lang]/[[...slug]]/page.tsx
Normal file
161
apps/docs/app/[lang]/[[...slug]]/page.tsx
Normal file
@@ -0,0 +1,161 @@
|
||||
import { findNeighbour } from 'fumadocs-core/server'
|
||||
import defaultMdxComponents from 'fumadocs-ui/mdx'
|
||||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/page'
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { notFound } from 'next/navigation'
|
||||
import { StructuredData } from '@/components/structured-data'
|
||||
import { source } from '@/lib/source'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export default async function Page(props: { params: Promise<{ slug?: string[]; lang: string }> }) {
|
||||
const params = await props.params
|
||||
const page = source.getPage(params.slug, params.lang)
|
||||
if (!page) notFound()
|
||||
|
||||
const MDX = page.data.body
|
||||
const baseUrl = 'https://docs.sim.ai'
|
||||
|
||||
const pageTreeRecord = source.pageTree as Record<string, any>
|
||||
const pageTree =
|
||||
pageTreeRecord[params.lang] ?? pageTreeRecord.en ?? Object.values(pageTreeRecord)[0]
|
||||
const neighbours = pageTree ? findNeighbour(pageTree, page.url) : null
|
||||
|
||||
const CustomFooter = () => (
|
||||
<div className='mt-12 flex items-center justify-between border-border border-t py-8'>
|
||||
{neighbours?.previous ? (
|
||||
<Link
|
||||
href={neighbours.previous.url}
|
||||
className='group flex items-center gap-2 text-muted-foreground transition-colors hover:text-foreground'
|
||||
>
|
||||
<ChevronLeft className='group-hover:-translate-x-1 h-4 w-4 transition-transform' />
|
||||
<span className='font-medium'>{neighbours.previous.name}</span>
|
||||
</Link>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
|
||||
{neighbours?.next ? (
|
||||
<Link
|
||||
href={neighbours.next.url}
|
||||
className='group flex items-center gap-2 text-muted-foreground transition-colors hover:text-foreground'
|
||||
>
|
||||
<span className='font-medium'>{neighbours.next.name}</span>
|
||||
<ChevronRight className='h-4 w-4 transition-transform group-hover:translate-x-1' />
|
||||
</Link>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<StructuredData
|
||||
title={page.data.title}
|
||||
description={page.data.description || ''}
|
||||
url={`${baseUrl}${page.url}`}
|
||||
lang={params.lang}
|
||||
/>
|
||||
<DocsPage
|
||||
toc={page.data.toc}
|
||||
full={page.data.full}
|
||||
tableOfContent={{
|
||||
style: 'clerk',
|
||||
enabled: true,
|
||||
header: <div className='mb-2 font-medium text-sm'>On this page</div>,
|
||||
single: false,
|
||||
}}
|
||||
article={{
|
||||
className: 'scroll-smooth max-sm:pb-16',
|
||||
}}
|
||||
tableOfContentPopover={{
|
||||
style: 'clerk',
|
||||
enabled: true,
|
||||
}}
|
||||
footer={{
|
||||
enabled: true,
|
||||
component: <CustomFooter />,
|
||||
}}
|
||||
>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription>{page.data.description}</DocsDescription>
|
||||
<DocsBody>
|
||||
<MDX components={defaultMdxComponents} />
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return source.generateParams()
|
||||
}
|
||||
|
||||
export async function generateMetadata(props: {
|
||||
params: Promise<{ slug?: string[]; lang: string }>
|
||||
}) {
|
||||
const params = await props.params
|
||||
const page = source.getPage(params.slug, params.lang)
|
||||
if (!page) notFound()
|
||||
|
||||
const baseUrl = 'https://docs.sim.ai'
|
||||
const fullUrl = `${baseUrl}${page.url}`
|
||||
|
||||
return {
|
||||
title: page.data.title,
|
||||
description:
|
||||
page.data.description || 'Sim visual workflow builder for AI applications documentation',
|
||||
keywords: [
|
||||
'AI workflow builder',
|
||||
'visual workflow editor',
|
||||
'AI automation',
|
||||
'workflow automation',
|
||||
'AI agents',
|
||||
'no-code AI',
|
||||
'drag and drop workflows',
|
||||
page.data.title?.toLowerCase().split(' '),
|
||||
]
|
||||
.flat()
|
||||
.filter(Boolean),
|
||||
authors: [{ name: 'Sim Team' }],
|
||||
category: 'Developer Tools',
|
||||
openGraph: {
|
||||
title: page.data.title,
|
||||
description:
|
||||
page.data.description || 'Sim visual workflow builder for AI applications documentation',
|
||||
url: fullUrl,
|
||||
siteName: 'Sim Documentation',
|
||||
type: 'article',
|
||||
locale: params.lang,
|
||||
alternateLocale: ['en', 'fr', 'zh'].filter((lang) => lang !== params.lang),
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary',
|
||||
title: page.data.title,
|
||||
description:
|
||||
page.data.description || 'Sim visual workflow builder for AI applications documentation',
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
follow: true,
|
||||
googleBot: {
|
||||
index: true,
|
||||
follow: true,
|
||||
'max-video-preview': -1,
|
||||
'max-image-preview': 'large',
|
||||
'max-snippet': -1,
|
||||
},
|
||||
},
|
||||
canonical: fullUrl,
|
||||
alternates: {
|
||||
canonical: fullUrl,
|
||||
languages: {
|
||||
en: `${baseUrl}/en${page.url.replace(`/${params.lang}`, '')}`,
|
||||
fr: `${baseUrl}/fr${page.url.replace(`/${params.lang}`, '')}`,
|
||||
zh: `${baseUrl}/zh${page.url.replace(`/${params.lang}`, '')}`,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
99
apps/docs/app/[lang]/layout.tsx
Normal file
99
apps/docs/app/[lang]/layout.tsx
Normal file
@@ -0,0 +1,99 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { defineI18nUI } from 'fumadocs-ui/i18n'
|
||||
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
|
||||
import { RootProvider } from 'fumadocs-ui/provider'
|
||||
import { ExternalLink, GithubIcon } from 'lucide-react'
|
||||
import { Inter } from 'next/font/google'
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { LanguageDropdown } from '@/components/ui/language-dropdown'
|
||||
import { i18n } from '@/lib/i18n'
|
||||
import { source } from '@/lib/source'
|
||||
import '../global.css'
|
||||
import { Analytics } from '@vercel/analytics/next'
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
})
|
||||
|
||||
const { provider } = defineI18nUI(i18n, {
|
||||
translations: {
|
||||
en: {
|
||||
displayName: 'English',
|
||||
},
|
||||
es: {
|
||||
displayName: 'Español',
|
||||
},
|
||||
fr: {
|
||||
displayName: 'Français',
|
||||
},
|
||||
zh: {
|
||||
displayName: '简体中文',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const GitHubLink = () => (
|
||||
<div className='fixed right-4 bottom-4 z-50'>
|
||||
<Link
|
||||
href='https://github.com/simstudioai/sim'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
className='flex h-8 w-8 items-center justify-center rounded-full border border-border bg-background transition-colors hover:bg-muted'
|
||||
>
|
||||
<GithubIcon className='h-4 w-4' />
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
|
||||
type LayoutProps = {
|
||||
children: ReactNode
|
||||
params: Promise<{ lang: string }>
|
||||
}
|
||||
|
||||
export default async function Layout({ children, params }: LayoutProps) {
|
||||
const { lang } = await params
|
||||
|
||||
return (
|
||||
<html lang={lang} className={inter.className} suppressHydrationWarning>
|
||||
<body className='flex min-h-screen flex-col'>
|
||||
<RootProvider i18n={provider(lang)}>
|
||||
<DocsLayout
|
||||
tree={source.pageTree[lang]}
|
||||
nav={{
|
||||
title: (
|
||||
<div className='flex items-center gap-3'>
|
||||
<Image
|
||||
src='/static/logo.png'
|
||||
alt='Sim'
|
||||
width={60}
|
||||
height={24}
|
||||
className='h-6 w-auto'
|
||||
/>
|
||||
<LanguageDropdown />
|
||||
</div>
|
||||
),
|
||||
}}
|
||||
links={[
|
||||
{
|
||||
text: 'Visit Sim',
|
||||
url: 'https://sim.ai',
|
||||
icon: <ExternalLink className='h-4 w-4' />,
|
||||
},
|
||||
]}
|
||||
sidebar={{
|
||||
defaultOpenLevel: 0,
|
||||
collapsible: true,
|
||||
footer: null,
|
||||
banner: null,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
<GitHubLink />
|
||||
<Analytics />
|
||||
</RootProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -6,6 +6,150 @@
|
||||
--color-fd-primary: #802fff; /* Purple from control-bar component */
|
||||
}
|
||||
|
||||
/* Target any potential border classes */
|
||||
* {
|
||||
--fd-border-sidebar: transparent !important;
|
||||
}
|
||||
|
||||
/* Override any CSS custom properties for borders */
|
||||
:root {
|
||||
--fd-border: transparent !important;
|
||||
--fd-border-sidebar: transparent !important;
|
||||
}
|
||||
|
||||
/* Sidebar improvements for cleaner design */
|
||||
[data-sidebar] {
|
||||
--fd-sidebar-width: 280px;
|
||||
background-color: rgb(255 255 255);
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
||||
/* Clean sidebar container */
|
||||
[data-sidebar] > div {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
/* Section headers/separators styling */
|
||||
[data-sidebar] .text-sm.font-medium.text-muted-foreground,
|
||||
[data-sidebar] [data-separator] {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 6px;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
color: rgb(115 115 115);
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
/* First separator should have less top margin */
|
||||
[data-sidebar] [data-separator]:first-of-type {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
/* Clean sidebar item styling */
|
||||
[data-sidebar] a {
|
||||
padding: 8px 12px;
|
||||
margin: 1px 0;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
transition: all 0.15s ease;
|
||||
display: block;
|
||||
color: rgb(71 85 105);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
[data-sidebar] a[data-active="true"] {
|
||||
background-color: rgba(128, 47, 255, 0.08);
|
||||
color: var(--color-fd-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
[data-sidebar] a:hover:not([data-active="true"]) {
|
||||
background-color: rgb(248 250 252);
|
||||
color: rgb(51 65 85);
|
||||
}
|
||||
|
||||
/* Improve spacing between sidebar items */
|
||||
[data-sidebar] nav > * + * {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* Section group styling */
|
||||
[data-sidebar] [data-folder] {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
[data-sidebar] [data-folder] > div:first-child {
|
||||
font-weight: 500;
|
||||
font-size: 13px;
|
||||
color: rgb(15 23 42);
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
/* Clean up folder toggle buttons */
|
||||
[data-sidebar] button[data-folder-toggle] {
|
||||
padding: 4px 8px 4px 12px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: rgb(51 65 85);
|
||||
}
|
||||
|
||||
[data-sidebar] button[data-folder-toggle]:hover {
|
||||
background-color: rgb(248 250 252);
|
||||
}
|
||||
|
||||
/* Nested item indentation */
|
||||
[data-sidebar] [data-folder] a {
|
||||
padding-left: 24px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* Dark mode adjustments */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
[data-sidebar] {
|
||||
background-color: rgb(2 8 23);
|
||||
}
|
||||
|
||||
[data-sidebar] a {
|
||||
color: rgb(148 163 184);
|
||||
}
|
||||
|
||||
[data-sidebar] a:hover:not([data-active="true"]) {
|
||||
background-color: rgb(30 41 59);
|
||||
color: rgb(226 232 240);
|
||||
}
|
||||
|
||||
[data-sidebar] a[data-active="true"] {
|
||||
background-color: rgba(128, 47, 255, 0.15);
|
||||
color: var(--color-fd-primary);
|
||||
}
|
||||
|
||||
[data-sidebar] .text-sm.font-medium.text-muted-foreground,
|
||||
[data-sidebar] [data-separator] {
|
||||
color: rgb(148 163 184);
|
||||
}
|
||||
|
||||
[data-sidebar] [data-folder] > div:first-child {
|
||||
color: rgb(226 232 240);
|
||||
}
|
||||
|
||||
[data-sidebar] button[data-folder-toggle] {
|
||||
color: rgb(148 163 184);
|
||||
}
|
||||
|
||||
[data-sidebar] button[data-folder-toggle]:hover {
|
||||
background-color: rgb(30 41 59);
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom text highlighting styles */
|
||||
.text-highlight {
|
||||
color: var(--color-fd-primary);
|
||||
@@ -16,6 +160,23 @@
|
||||
color: var(--color-fd-primary);
|
||||
}
|
||||
|
||||
/* Add bottom spacing to prevent abrupt page endings */
|
||||
[data-content] {
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
/* Alternative fallback for different Fumadocs versions */
|
||||
main article,
|
||||
.docs-page main {
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
/* Remove any unwanted borders/outlines from video elements */
|
||||
video {
|
||||
outline: none !important;
|
||||
border-style: solid !important;
|
||||
}
|
||||
|
||||
/* Tailwind v4 content sources */
|
||||
@source '../app/**/*.{js,ts,jsx,tsx,mdx}';
|
||||
@source '../components/**/*.{js,ts,jsx,tsx,mdx}';
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { RootProvider } from 'fumadocs-ui/provider'
|
||||
import { Inter } from 'next/font/google'
|
||||
import './global.css'
|
||||
import { Analytics } from '@vercel/analytics/next'
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
})
|
||||
|
||||
export default function Layout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang='en' className={inter.className} suppressHydrationWarning>
|
||||
<body className='flex min-h-screen flex-col'>
|
||||
<RootProvider>
|
||||
{children}
|
||||
<Analytics />
|
||||
</RootProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return children
|
||||
}
|
||||
|
||||
export const metadata = {
|
||||
title: 'Sim',
|
||||
metadataBase: new URL('https://docs.sim.ai'),
|
||||
title: {
|
||||
default: 'Sim Documentation - Visual Workflow Builder for AI Applications',
|
||||
template: '%s',
|
||||
},
|
||||
description:
|
||||
'Build agents in seconds with a drag and drop workflow builder. Access comprehensive documentation to help you create efficient workflows and maximize your automation capabilities.',
|
||||
'Comprehensive documentation for Sim - the visual workflow builder for AI applications. Create powerful AI agents, automation workflows, and data processing pipelines by connecting blocks on a canvas—no coding required.',
|
||||
keywords: [
|
||||
'AI workflow builder',
|
||||
'visual workflow editor',
|
||||
'AI automation',
|
||||
'workflow automation',
|
||||
'AI agents',
|
||||
'no-code AI',
|
||||
'drag and drop workflows',
|
||||
'AI integrations',
|
||||
'workflow canvas',
|
||||
'AI development platform',
|
||||
],
|
||||
authors: [{ name: 'Sim Team', url: 'https://sim.ai' }],
|
||||
category: 'Developer Tools',
|
||||
classification: 'Developer Documentation',
|
||||
manifest: '/favicon/site.webmanifest',
|
||||
icons: {
|
||||
icon: [
|
||||
@@ -39,4 +41,40 @@ export const metadata = {
|
||||
statusBarStyle: 'default',
|
||||
title: 'Sim Docs',
|
||||
},
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
locale: 'en_US',
|
||||
alternateLocale: ['fr_FR', 'zh_CN'],
|
||||
url: 'https://docs.sim.ai',
|
||||
siteName: 'Sim Documentation',
|
||||
title: 'Sim Documentation - Visual Workflow Builder for AI Applications',
|
||||
description:
|
||||
'Comprehensive documentation for Sim - the visual workflow builder for AI applications. Create powerful AI agents, automation workflows, and data processing pipelines.',
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary',
|
||||
title: 'Sim Documentation - Visual Workflow Builder for AI Applications',
|
||||
description:
|
||||
'Comprehensive documentation for Sim - the visual workflow builder for AI applications.',
|
||||
creator: '@sim_ai',
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
follow: true,
|
||||
googleBot: {
|
||||
index: true,
|
||||
follow: true,
|
||||
'max-video-preview': -1,
|
||||
'max-image-preview': 'large',
|
||||
'max-snippet': -1,
|
||||
},
|
||||
},
|
||||
alternates: {
|
||||
canonical: 'https://docs.sim.ai',
|
||||
languages: {
|
||||
en: '/en',
|
||||
fr: '/fr',
|
||||
zh: '/zh',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getLLMText } from '@/lib/llms'
|
||||
import { source } from '@/lib/source'
|
||||
|
||||
// cached forever
|
||||
export const revalidate = false
|
||||
|
||||
export async function GET() {
|
||||
|
||||
58
apps/docs/app/robots.txt/route.ts
Normal file
58
apps/docs/app/robots.txt/route.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
export const revalidate = false
|
||||
|
||||
export async function GET() {
|
||||
const baseUrl = 'https://docs.sim.ai'
|
||||
|
||||
const robotsTxt = `# Robots.txt for Sim Documentation
|
||||
# Generated on ${new Date().toISOString()}
|
||||
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
# Allow all well-behaved crawlers
|
||||
User-agent: Googlebot
|
||||
Allow: /
|
||||
|
||||
User-agent: Bingbot
|
||||
Allow: /
|
||||
|
||||
# AI and LLM crawlers
|
||||
User-agent: GPTBot
|
||||
Allow: /
|
||||
|
||||
User-agent: ChatGPT-User
|
||||
Allow: /
|
||||
|
||||
User-agent: CCBot
|
||||
Allow: /
|
||||
|
||||
User-agent: anthropic-ai
|
||||
Allow: /
|
||||
|
||||
User-agent: Claude-Web
|
||||
Allow: /
|
||||
|
||||
# Disallow admin and internal paths (if any exist)
|
||||
Disallow: /.next/
|
||||
Disallow: /api/internal/
|
||||
Disallow: /_next/static/
|
||||
Disallow: /admin/
|
||||
|
||||
# Allow but don't prioritize these
|
||||
Allow: /api/search
|
||||
Allow: /llms.txt
|
||||
Allow: /llms.mdx/
|
||||
|
||||
# Sitemaps
|
||||
Sitemap: ${baseUrl}/sitemap.xml
|
||||
|
||||
# Additional resources for AI indexing
|
||||
# See https://github.com/AnswerDotAI/llms-txt for more info
|
||||
# LLM-friendly content available at: ${baseUrl}/llms.txt`
|
||||
|
||||
return new Response(robotsTxt, {
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
})
|
||||
}
|
||||
54
apps/docs/app/sitemap.xml/route.ts
Normal file
54
apps/docs/app/sitemap.xml/route.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { i18n } from '@/lib/i18n'
|
||||
import { source } from '@/lib/source'
|
||||
|
||||
export const revalidate = false
|
||||
|
||||
export async function GET() {
|
||||
const baseUrl = 'https://docs.sim.ai'
|
||||
|
||||
const allPages = source.getPages()
|
||||
|
||||
const urls = allPages
|
||||
.flatMap((page) => {
|
||||
const urlWithoutLang = page.url.replace(/^\/[a-z]{2}\//, '/')
|
||||
|
||||
return i18n.languages.map((lang) => {
|
||||
const url =
|
||||
lang === i18n.defaultLanguage
|
||||
? `${baseUrl}${urlWithoutLang}`
|
||||
: `${baseUrl}/${lang}${urlWithoutLang}`
|
||||
|
||||
return ` <url>
|
||||
<loc>${url}</loc>
|
||||
<lastmod>${new Date().toISOString().split('T')[0]}</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>${urlWithoutLang === '/introduction' ? '1.0' : '0.8'}</priority>
|
||||
${i18n.languages.length > 1 ? generateAlternateLinks(baseUrl, urlWithoutLang) : ''}
|
||||
</url>`
|
||||
})
|
||||
})
|
||||
.join('\n')
|
||||
|
||||
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
${urls}
|
||||
</urlset>`
|
||||
|
||||
return new Response(sitemap, {
|
||||
headers: {
|
||||
'Content-Type': 'application/xml',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function generateAlternateLinks(baseUrl: string, urlWithoutLang: string): string {
|
||||
return i18n.languages
|
||||
.map((lang) => {
|
||||
const url =
|
||||
lang === i18n.defaultLanguage
|
||||
? `${baseUrl}${urlWithoutLang}`
|
||||
: `${baseUrl}/${lang}${urlWithoutLang}`
|
||||
return ` <xhtml:link rel="alternate" hreflang="${lang}" href="${url}" />`
|
||||
})
|
||||
.join('\n')
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import defaultMdxComponents from 'fumadocs-ui/mdx'
|
||||
import { ThemeImage } from './ui/theme-image'
|
||||
|
||||
// Extend the default MDX components with our custom components
|
||||
const mdxComponents = {
|
||||
...defaultMdxComponents,
|
||||
ThemeImage,
|
||||
}
|
||||
|
||||
export default mdxComponents
|
||||
174
apps/docs/components/structured-data.tsx
Normal file
174
apps/docs/components/structured-data.tsx
Normal file
@@ -0,0 +1,174 @@
|
||||
import Script from 'next/script'
|
||||
|
||||
interface StructuredDataProps {
|
||||
title: string
|
||||
description: string
|
||||
url: string
|
||||
lang: string
|
||||
dateModified?: string
|
||||
breadcrumb?: Array<{ name: string; url: string }>
|
||||
}
|
||||
|
||||
export function StructuredData({
|
||||
title,
|
||||
description,
|
||||
url,
|
||||
lang,
|
||||
dateModified,
|
||||
breadcrumb,
|
||||
}: StructuredDataProps) {
|
||||
const baseUrl = 'https://docs.sim.ai'
|
||||
|
||||
const articleStructuredData = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'TechArticle',
|
||||
headline: title,
|
||||
description: description,
|
||||
url: url,
|
||||
datePublished: dateModified || new Date().toISOString(),
|
||||
dateModified: dateModified || new Date().toISOString(),
|
||||
author: {
|
||||
'@type': 'Organization',
|
||||
name: 'Sim Team',
|
||||
url: baseUrl,
|
||||
},
|
||||
publisher: {
|
||||
'@type': 'Organization',
|
||||
name: 'Sim',
|
||||
url: baseUrl,
|
||||
logo: {
|
||||
'@type': 'ImageObject',
|
||||
url: `${baseUrl}/static/logo.png`,
|
||||
},
|
||||
},
|
||||
mainEntityOfPage: {
|
||||
'@type': 'WebPage',
|
||||
'@id': url,
|
||||
},
|
||||
inLanguage: lang,
|
||||
isPartOf: {
|
||||
'@type': 'WebSite',
|
||||
name: 'Sim Documentation',
|
||||
url: baseUrl,
|
||||
},
|
||||
potentialAction: {
|
||||
'@type': 'ReadAction',
|
||||
target: url,
|
||||
},
|
||||
}
|
||||
|
||||
const breadcrumbStructuredData = breadcrumb && {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: breadcrumb.map((item, index) => ({
|
||||
'@type': 'ListItem',
|
||||
position: index + 1,
|
||||
name: item.name,
|
||||
item: item.url,
|
||||
})),
|
||||
}
|
||||
|
||||
const websiteStructuredData = url === baseUrl && {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'WebSite',
|
||||
name: 'Sim Documentation',
|
||||
url: baseUrl,
|
||||
description:
|
||||
'Comprehensive documentation for Sim visual workflow builder for AI applications. Create powerful AI agents, automation workflows, and data processing pipelines.',
|
||||
publisher: {
|
||||
'@type': 'Organization',
|
||||
name: 'Sim',
|
||||
url: baseUrl,
|
||||
},
|
||||
potentialAction: {
|
||||
'@type': 'SearchAction',
|
||||
target: {
|
||||
'@type': 'EntryPoint',
|
||||
urlTemplate: `${baseUrl}/search?q={search_term_string}`,
|
||||
},
|
||||
'query-input': 'required name=search_term_string',
|
||||
},
|
||||
inLanguage: ['en', 'fr', 'zh'],
|
||||
}
|
||||
|
||||
const faqStructuredData = title.toLowerCase().includes('faq') && {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'FAQPage',
|
||||
mainEntity: [],
|
||||
}
|
||||
|
||||
const softwareStructuredData = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'SoftwareApplication',
|
||||
name: 'Sim',
|
||||
applicationCategory: 'DeveloperApplication',
|
||||
operatingSystem: 'Any',
|
||||
description:
|
||||
'Visual workflow builder for AI applications. Create powerful AI agents, automation workflows, and data processing pipelines by connecting blocks on a canvas—no coding required.',
|
||||
url: baseUrl,
|
||||
author: {
|
||||
'@type': 'Organization',
|
||||
name: 'Sim Team',
|
||||
},
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
category: 'Developer Tools',
|
||||
},
|
||||
featureList: [
|
||||
'Visual workflow builder with drag-and-drop interface',
|
||||
'AI agent creation and automation',
|
||||
'80+ built-in integrations',
|
||||
'Real-time team collaboration',
|
||||
'Multiple deployment options',
|
||||
'Custom integrations via MCP protocol',
|
||||
],
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Script
|
||||
id='article-structured-data'
|
||||
type='application/ld+json'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(articleStructuredData),
|
||||
}}
|
||||
/>
|
||||
{breadcrumbStructuredData && (
|
||||
<Script
|
||||
id='breadcrumb-structured-data'
|
||||
type='application/ld+json'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(breadcrumbStructuredData),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{websiteStructuredData && (
|
||||
<Script
|
||||
id='website-structured-data'
|
||||
type='application/ld+json'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(websiteStructuredData),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{faqStructuredData && (
|
||||
<Script
|
||||
id='faq-structured-data'
|
||||
type='application/ld+json'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(faqStructuredData),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{url === baseUrl && (
|
||||
<Script
|
||||
id='software-structured-data'
|
||||
type='application/ld+json'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(softwareStructuredData),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
import {
|
||||
AgentIcon,
|
||||
ApiIcon,
|
||||
ChartBarIcon,
|
||||
CodeIcon,
|
||||
ConditionalIcon,
|
||||
ConnectIcon,
|
||||
ResponseIcon,
|
||||
} from '@/components/icons'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
// Custom Feature component specifically for BlockTypes to handle the 6-item layout
|
||||
const BlockFeature = ({
|
||||
title,
|
||||
description,
|
||||
icon,
|
||||
href,
|
||||
index,
|
||||
totalItems,
|
||||
itemsPerRow,
|
||||
}: {
|
||||
title: string
|
||||
description: string
|
||||
icon: React.ReactNode
|
||||
href?: string
|
||||
index: number
|
||||
totalItems: number
|
||||
itemsPerRow: number
|
||||
}) => {
|
||||
const blockColor = {
|
||||
'--block-color':
|
||||
title === 'Agent'
|
||||
? '#8b5cf6'
|
||||
: title === 'API'
|
||||
? '#3b82f6'
|
||||
: title === 'Condition'
|
||||
? '#f59e0b'
|
||||
: title === 'Function'
|
||||
? '#10b981'
|
||||
: title === 'Router'
|
||||
? '#6366f1'
|
||||
: title === 'Evaluator'
|
||||
? '#ef4444'
|
||||
: '#8b5cf6',
|
||||
} as React.CSSProperties
|
||||
|
||||
const content = (
|
||||
<>
|
||||
{index < itemsPerRow && (
|
||||
<div className='pointer-events-none absolute inset-0 h-full w-full bg-gradient-to-t from-neutral-100 to-transparent opacity-0 transition duration-200 group-hover/feature:opacity-100 dark:from-neutral-800' />
|
||||
)}
|
||||
{index >= itemsPerRow && (
|
||||
<div className='pointer-events-none absolute inset-0 h-full w-full bg-gradient-to-b from-neutral-100 to-transparent opacity-0 transition duration-200 group-hover/feature:opacity-100 dark:from-neutral-800' />
|
||||
)}
|
||||
<div
|
||||
className='relative z-10 mb-4 px-10 text-neutral-500 transition-colors duration-200 group-hover/feature:text-[color:var(--block-color,#8b5cf6)] dark:text-neutral-400 dark:group-hover/feature:text-[color:var(--block-color,#a78bfa)]'
|
||||
style={blockColor}
|
||||
>
|
||||
{icon}
|
||||
</div>
|
||||
<div className='relative z-10 mb-2 px-10 font-bold text-lg'>
|
||||
<div
|
||||
className='absolute inset-y-0 left-0 h-6 w-1 origin-center rounded-tr-full rounded-br-full bg-neutral-300 transition-all duration-200 group-hover/feature:h-8 group-hover/feature:bg-[color:var(--block-color,#8b5cf6)] dark:bg-neutral-700'
|
||||
style={blockColor}
|
||||
/>
|
||||
<span className='inline-block text-neutral-800 transition duration-200 group-hover/feature:translate-x-2 dark:text-neutral-100'>
|
||||
{title}
|
||||
</span>
|
||||
</div>
|
||||
<p className='relative z-10 max-w-xs px-10 text-neutral-600 text-sm dark:text-neutral-300'>
|
||||
{description}
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
|
||||
const containerClasses = cn(
|
||||
'flex flex-col lg:border-r py-5 relative group/feature dark:border-neutral-800',
|
||||
(index === 0 || index === itemsPerRow) && 'lg:border-l dark:border-neutral-800',
|
||||
index < itemsPerRow && 'lg:border-b dark:border-neutral-800',
|
||||
href && 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-900/50 transition-colors'
|
||||
)
|
||||
|
||||
if (href) {
|
||||
return (
|
||||
<a href={href} className={containerClasses} style={{ textDecoration: 'none' }}>
|
||||
{content}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
return <div className={containerClasses}>{content}</div>
|
||||
}
|
||||
|
||||
export function BlockTypes() {
|
||||
const features = [
|
||||
{
|
||||
title: 'Agent',
|
||||
description:
|
||||
'Create powerful AI agents using any LLM provider with customizable system prompts and tool integrations.',
|
||||
icon: <AgentIcon className='h-6 w-6' />,
|
||||
href: '/blocks/agent',
|
||||
},
|
||||
{
|
||||
title: 'API',
|
||||
description:
|
||||
'Connect to any external API with support for all standard HTTP methods and customizable request parameters.',
|
||||
icon: <ApiIcon className='h-6 w-6' />,
|
||||
href: '/blocks/api',
|
||||
},
|
||||
{
|
||||
title: 'Condition',
|
||||
description:
|
||||
'Add a condition to the workflow to branch the execution path based on a boolean expression.',
|
||||
icon: <ConditionalIcon className='h-6 w-6' />,
|
||||
href: '/blocks/condition',
|
||||
},
|
||||
{
|
||||
title: 'Function',
|
||||
description:
|
||||
'Execute custom JavaScript or TypeScript code within your workflow to transform data or implement complex logic.',
|
||||
icon: <CodeIcon className='h-6 w-6' />,
|
||||
href: '/blocks/function',
|
||||
},
|
||||
{
|
||||
title: 'Router',
|
||||
description:
|
||||
'Intelligently direct workflow execution to different paths based on input analysis.',
|
||||
icon: <ConnectIcon className='h-6 w-6' />,
|
||||
href: '/blocks/router',
|
||||
},
|
||||
{
|
||||
title: 'Evaluator',
|
||||
description:
|
||||
'Assess content using customizable evaluation metrics and scoring criteria across multiple dimensions.',
|
||||
icon: <ChartBarIcon className='h-6 w-6' />,
|
||||
href: '/blocks/evaluator',
|
||||
},
|
||||
{
|
||||
title: 'Response',
|
||||
description:
|
||||
'Send a response back to the caller with customizable data, status, and headers.',
|
||||
icon: <ResponseIcon className='h-6 w-6' />,
|
||||
href: '/blocks/response',
|
||||
},
|
||||
]
|
||||
|
||||
const totalItems = features.length
|
||||
const itemsPerRow = 3 // For large screens
|
||||
|
||||
return (
|
||||
<div className='relative z-10 mx-auto grid max-w-7xl grid-cols-1 py-10 md:grid-cols-2 lg:grid-cols-3'>
|
||||
{features.map((feature, index) => (
|
||||
<BlockFeature
|
||||
key={feature.title}
|
||||
{...feature}
|
||||
index={index}
|
||||
totalItems={totalItems}
|
||||
itemsPerRow={itemsPerRow}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
import {
|
||||
IconAdjustmentsBolt,
|
||||
IconCloud,
|
||||
IconEaseInOut,
|
||||
IconHeart,
|
||||
IconHelp,
|
||||
IconHistory,
|
||||
IconRouteAltLeft,
|
||||
IconTerminal2,
|
||||
} from '@tabler/icons-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
export function Features() {
|
||||
const features = [
|
||||
{
|
||||
title: 'Multi-LLM Support',
|
||||
description: 'Connect to any LLM provider including OpenAI, Anthropic, and more',
|
||||
icon: <IconCloud />,
|
||||
},
|
||||
{
|
||||
title: 'API Deployment',
|
||||
description: 'Deploy your workflows as secure, scalable APIs',
|
||||
icon: <IconTerminal2 />,
|
||||
},
|
||||
{
|
||||
title: 'Webhook Integration',
|
||||
description: 'Trigger workflows via webhooks from external services',
|
||||
icon: <IconRouteAltLeft />,
|
||||
},
|
||||
{
|
||||
title: 'Scheduled Execution',
|
||||
description: 'Schedule workflows to run at specific times or intervals',
|
||||
icon: <IconEaseInOut />,
|
||||
},
|
||||
{
|
||||
title: '40+ Integrations',
|
||||
description: 'Connect to hundreds of external services and data sources',
|
||||
icon: <IconAdjustmentsBolt />,
|
||||
},
|
||||
{
|
||||
title: 'Visual Debugging',
|
||||
description: 'Debug workflows visually with detailed execution logs',
|
||||
icon: <IconHelp />,
|
||||
},
|
||||
{
|
||||
title: 'Version Control',
|
||||
description: 'Track changes and roll back to previous versions',
|
||||
icon: <IconHistory />,
|
||||
},
|
||||
{
|
||||
title: 'Team Collaboration',
|
||||
description: 'Collaborate with team members on workflow development',
|
||||
icon: <IconHeart />,
|
||||
},
|
||||
]
|
||||
return (
|
||||
<div className='relative z-20 mx-auto grid max-w-7xl grid-cols-1 py-10 md:grid-cols-2 lg:grid-cols-4'>
|
||||
{features.map((feature, index) => (
|
||||
<Feature key={feature.title} {...feature} index={index} />
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export const Feature = ({
|
||||
title,
|
||||
description,
|
||||
icon,
|
||||
index,
|
||||
}: {
|
||||
title: string
|
||||
description: string
|
||||
icon: React.ReactNode
|
||||
index: number
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'group/feature relative flex flex-col py-5 lg:border-r dark:border-neutral-800',
|
||||
(index === 0 || index === 4) && 'lg:border-l dark:border-neutral-800',
|
||||
index < 4 && 'lg:border-b dark:border-neutral-800'
|
||||
)}
|
||||
>
|
||||
{index < 4 && (
|
||||
<div className='pointer-events-none absolute inset-0 h-full w-full bg-gradient-to-t from-neutral-100 to-transparent opacity-0 transition duration-200 group-hover/feature:opacity-100 dark:from-neutral-800' />
|
||||
)}
|
||||
{index >= 4 && (
|
||||
<div className='pointer-events-none absolute inset-0 h-full w-full bg-gradient-to-b from-neutral-100 to-transparent opacity-0 transition duration-200 group-hover/feature:opacity-100 dark:from-neutral-800' />
|
||||
)}
|
||||
<div className='relative z-10 mb-4 px-10 text-neutral-600 dark:text-neutral-400'>{icon}</div>
|
||||
<div className='relative z-10 mb-2 px-10 font-bold text-lg'>
|
||||
<div className='absolute inset-y-0 left-0 h-6 w-1 origin-center rounded-tr-full rounded-br-full bg-neutral-300 transition-all duration-200 group-hover/feature:h-8 group-hover/feature:bg-purple-500 dark:bg-neutral-700' />
|
||||
<span className='inline-block text-neutral-800 transition duration-200 group-hover/feature:translate-x-2 dark:text-neutral-100'>
|
||||
{title}
|
||||
</span>
|
||||
</div>
|
||||
<p className='relative z-10 max-w-xs px-10 text-neutral-600 text-sm dark:text-neutral-300'>
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
53
apps/docs/components/ui/image.tsx
Normal file
53
apps/docs/components/ui/image.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import NextImage, { type ImageProps as NextImageProps } from 'next/image'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Lightbox } from './lightbox'
|
||||
|
||||
interface ImageProps extends Omit<NextImageProps, 'className'> {
|
||||
className?: string
|
||||
enableLightbox?: boolean
|
||||
}
|
||||
|
||||
export function Image({
|
||||
className = 'w-full',
|
||||
enableLightbox = true,
|
||||
alt = '',
|
||||
src,
|
||||
...props
|
||||
}: ImageProps) {
|
||||
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
||||
|
||||
const handleImageClick = () => {
|
||||
if (enableLightbox) {
|
||||
setIsLightboxOpen(true)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextImage
|
||||
className={cn(
|
||||
'overflow-hidden rounded-xl border border-border object-cover shadow-sm',
|
||||
enableLightbox && 'cursor-pointer transition-opacity hover:opacity-90',
|
||||
className
|
||||
)}
|
||||
alt={alt}
|
||||
src={src}
|
||||
onClick={handleImageClick}
|
||||
{...props}
|
||||
/>
|
||||
|
||||
{enableLightbox && (
|
||||
<Lightbox
|
||||
isOpen={isLightboxOpen}
|
||||
onClose={() => setIsLightboxOpen(false)}
|
||||
src={typeof src === 'string' ? src : String(src)}
|
||||
alt={alt}
|
||||
type='image'
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
107
apps/docs/components/ui/language-dropdown.tsx
Normal file
107
apps/docs/components/ui/language-dropdown.tsx
Normal file
@@ -0,0 +1,107 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Check, ChevronDown } from 'lucide-react'
|
||||
import { useParams, usePathname } from 'next/navigation'
|
||||
|
||||
const languages = {
|
||||
en: { name: 'English', flag: '🇺🇸' },
|
||||
es: { name: 'Español', flag: '🇪🇸' },
|
||||
fr: { name: 'Français', flag: '🇫🇷' },
|
||||
zh: { name: '简体中文', flag: '🇨🇳' },
|
||||
}
|
||||
|
||||
export function LanguageDropdown() {
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const pathname = usePathname()
|
||||
const params = useParams()
|
||||
|
||||
const [currentLang, setCurrentLang] = useState(() => {
|
||||
const langFromParams = params?.lang as string
|
||||
return langFromParams && Object.keys(languages).includes(langFromParams) ? langFromParams : 'en'
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
const langFromParams = params?.lang as string
|
||||
|
||||
if (langFromParams && Object.keys(languages).includes(langFromParams)) {
|
||||
if (langFromParams !== currentLang) {
|
||||
setCurrentLang(langFromParams)
|
||||
}
|
||||
} else {
|
||||
if (currentLang !== 'en') {
|
||||
setCurrentLang('en')
|
||||
}
|
||||
}
|
||||
}, [params, currentLang])
|
||||
|
||||
const handleLanguageChange = (locale: string) => {
|
||||
if (locale === currentLang) {
|
||||
setIsOpen(false)
|
||||
return
|
||||
}
|
||||
|
||||
setIsOpen(false)
|
||||
|
||||
const segments = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (segments[0] && Object.keys(languages).includes(segments[0])) {
|
||||
segments.shift()
|
||||
}
|
||||
|
||||
let newPath = ''
|
||||
if (locale === 'en') {
|
||||
newPath = segments.length > 0 ? `/${segments.join('/')}` : '/introduction'
|
||||
} else {
|
||||
newPath = `/${locale}${segments.length > 0 ? `/${segments.join('/')}` : '/introduction'}`
|
||||
}
|
||||
|
||||
window.location.href = newPath
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='relative'>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setIsOpen(!isOpen)
|
||||
}}
|
||||
className='flex items-center gap-2 rounded-xl border border-border/20 bg-muted/50 px-3 py-2 text-sm backdrop-blur-sm transition-colors hover:bg-muted'
|
||||
>
|
||||
<span className='text-base'>{languages[currentLang as keyof typeof languages]?.flag}</span>
|
||||
<span className='font-medium text-foreground'>
|
||||
{languages[currentLang as keyof typeof languages]?.name}
|
||||
</span>
|
||||
<ChevronDown
|
||||
className={`h-3 w-3 text-muted-foreground transition-transform ${isOpen ? 'rotate-180' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
|
||||
{isOpen && (
|
||||
<>
|
||||
<div className='fixed inset-0 z-10' onClick={() => setIsOpen(false)} />
|
||||
<div className='absolute top-full left-0 z-20 mt-1 w-48 rounded-lg border border-border/50 bg-background/95 shadow-xl backdrop-blur-md'>
|
||||
{Object.entries(languages).map(([code, lang]) => (
|
||||
<button
|
||||
key={code}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
handleLanguageChange(code)
|
||||
}}
|
||||
className={`flex w-full items-center gap-3 px-3 py-2.5 text-sm transition-colors first:rounded-t-lg last:rounded-b-lg hover:bg-muted/80 ${
|
||||
currentLang === code ? 'bg-muted/60 font-medium text-primary' : 'text-foreground'
|
||||
}`}
|
||||
>
|
||||
<span className='text-base'>{lang.flag}</span>
|
||||
<span>{lang.name}</span>
|
||||
{currentLang === code && <Check className='ml-auto h-4 w-4 text-primary' />}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
74
apps/docs/components/ui/lightbox.tsx
Normal file
74
apps/docs/components/ui/lightbox.tsx
Normal file
@@ -0,0 +1,74 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { getVideoUrl } from '@/lib/utils'
|
||||
|
||||
interface LightboxProps {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
src: string
|
||||
alt: string
|
||||
type: 'image' | 'video'
|
||||
}
|
||||
|
||||
export function Lightbox({ isOpen, onClose, src, alt, type }: LightboxProps) {
|
||||
const overlayRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
onClose()
|
||||
}
|
||||
}
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (overlayRef.current && event.target === overlayRef.current) {
|
||||
onClose()
|
||||
}
|
||||
}
|
||||
|
||||
if (isOpen) {
|
||||
document.addEventListener('keydown', handleKeyDown)
|
||||
document.addEventListener('click', handleClickOutside)
|
||||
document.body.style.overflow = 'hidden'
|
||||
}
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('keydown', handleKeyDown)
|
||||
document.removeEventListener('click', handleClickOutside)
|
||||
document.body.style.overflow = 'unset'
|
||||
}
|
||||
}, [isOpen, onClose])
|
||||
|
||||
if (!isOpen) return null
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={overlayRef}
|
||||
className='fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-12 backdrop-blur-sm'
|
||||
role='dialog'
|
||||
aria-modal='true'
|
||||
aria-label='Media viewer'
|
||||
>
|
||||
<div className='relative max-h-full max-w-full overflow-hidden rounded-xl shadow-2xl'>
|
||||
{type === 'image' ? (
|
||||
<img
|
||||
src={src}
|
||||
alt={alt}
|
||||
className='max-h-[calc(100vh-6rem)] max-w-[calc(100vw-6rem)] rounded-xl object-contain'
|
||||
loading='lazy'
|
||||
/>
|
||||
) : (
|
||||
<video
|
||||
src={getVideoUrl(src)}
|
||||
autoPlay
|
||||
loop
|
||||
muted
|
||||
playsInline
|
||||
className='max-h-[calc(100vh-6rem)] max-w-[calc(100vw-6rem)] rounded-xl outline-none focus:outline-none'
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import Image from 'next/image'
|
||||
import { useTheme } from 'next-themes'
|
||||
|
||||
interface ThemeImageProps {
|
||||
lightSrc: string
|
||||
darkSrc: string
|
||||
alt: string
|
||||
width?: number
|
||||
height?: number
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function ThemeImage({
|
||||
lightSrc,
|
||||
darkSrc,
|
||||
alt,
|
||||
width = 600,
|
||||
height = 400,
|
||||
className = 'rounded-lg border border-border my-6',
|
||||
}: ThemeImageProps) {
|
||||
const { resolvedTheme } = useTheme()
|
||||
const [imageSrc, setImageSrc] = useState(lightSrc)
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
// Wait until component is mounted to avoid hydration mismatch
|
||||
useEffect(() => {
|
||||
setMounted(true)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (mounted) {
|
||||
setImageSrc(resolvedTheme === 'dark' ? darkSrc : lightSrc)
|
||||
}
|
||||
}, [resolvedTheme, lightSrc, darkSrc, mounted])
|
||||
|
||||
if (!mounted) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex justify-center'>
|
||||
<Image src={imageSrc} alt={alt} width={width} height={height} className={className} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { getVideoUrl } from '@/lib/utils'
|
||||
import { Lightbox } from './lightbox'
|
||||
|
||||
interface VideoProps {
|
||||
src: string
|
||||
@@ -7,24 +11,47 @@ interface VideoProps {
|
||||
loop?: boolean
|
||||
muted?: boolean
|
||||
playsInline?: boolean
|
||||
enableLightbox?: boolean
|
||||
}
|
||||
|
||||
export function Video({
|
||||
src,
|
||||
className = 'w-full -mb-2 rounded-lg',
|
||||
className = 'w-full rounded-xl border border-border shadow-sm overflow-hidden outline-none focus:outline-none',
|
||||
autoPlay = true,
|
||||
loop = true,
|
||||
muted = true,
|
||||
playsInline = true,
|
||||
enableLightbox = true,
|
||||
}: VideoProps) {
|
||||
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
||||
|
||||
const handleVideoClick = () => {
|
||||
if (enableLightbox) {
|
||||
setIsLightboxOpen(true)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<video
|
||||
autoPlay={autoPlay}
|
||||
loop={loop}
|
||||
muted={muted}
|
||||
playsInline={playsInline}
|
||||
className={className}
|
||||
src={getVideoUrl(src)}
|
||||
/>
|
||||
<>
|
||||
<video
|
||||
autoPlay={autoPlay}
|
||||
loop={loop}
|
||||
muted={muted}
|
||||
playsInline={playsInline}
|
||||
className={`${className} ${enableLightbox ? 'cursor-pointer transition-opacity hover:opacity-90' : ''}`}
|
||||
src={getVideoUrl(src)}
|
||||
onClick={handleVideoClick}
|
||||
/>
|
||||
|
||||
{enableLightbox && (
|
||||
<Lightbox
|
||||
isOpen={isLightboxOpen}
|
||||
onClose={() => setIsLightboxOpen(false)}
|
||||
src={src}
|
||||
alt={`Video: ${src}`}
|
||||
type='video'
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
---
|
||||
title: Evaluator
|
||||
description: Assess content quality using customizable evaluation metrics
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
The Evaluator block uses AI to score and assess content quality based on metrics you define. Perfect for quality control, A/B testing, and ensuring your AI outputs meet specific standards.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/evaluator-light.png"
|
||||
darkSrc="/static/dark/evaluator-dark.png"
|
||||
alt="Evaluator Block Configuration"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
|
||||
## What You Can Evaluate
|
||||
|
||||
**AI-Generated Content**: Score chatbot responses, generated articles, or marketing copy
|
||||
**User Input**: Evaluate customer feedback, survey responses, or form submissions
|
||||
**Content Quality**: Assess clarity, accuracy, relevance, and tone
|
||||
**Performance Metrics**: Track improvements over time with consistent scoring
|
||||
**A/B Testing**: Compare different approaches with objective metrics
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Evaluation Metrics
|
||||
|
||||
Define custom metrics to evaluate content against. Each metric includes:
|
||||
|
||||
- **Name**: A short identifier for the metric
|
||||
- **Description**: A detailed explanation of what the metric measures
|
||||
- **Range**: The numeric range for scoring (e.g., 1-5, 0-10)
|
||||
|
||||
Example metrics:
|
||||
|
||||
```
|
||||
Accuracy (1-5): How factually accurate is the content?
|
||||
Clarity (1-5): How clear and understandable is the content?
|
||||
Relevance (1-5): How relevant is the content to the original query?
|
||||
```
|
||||
|
||||
### Content
|
||||
|
||||
The content to be evaluated. This can be:
|
||||
|
||||
- Directly provided in the block configuration
|
||||
- Connected from another block's output (typically an Agent block)
|
||||
- Dynamically generated during workflow execution
|
||||
|
||||
### Model Selection
|
||||
|
||||
Choose an AI model to perform the evaluation:
|
||||
|
||||
**OpenAI**: GPT-4o, o1, o3, o4-mini, gpt-4.1
|
||||
**Anthropic**: Claude 3.7 Sonnet
|
||||
**Google**: Gemini 2.5 Pro, Gemini 2.0 Flash
|
||||
**Other Providers**: Groq, Cerebras, xAI, DeepSeek
|
||||
**Local Models**: Any model running on Ollama
|
||||
|
||||
<div className="w-full max-w-2xl mx-auto overflow-hidden rounded-lg">
|
||||
<Video src="models.mp4" />
|
||||
</div>
|
||||
|
||||
**Recommendation**: Use models with strong reasoning capabilities like GPT-4o or Claude 3.7 Sonnet for more accurate evaluations.
|
||||
|
||||
### API Key
|
||||
|
||||
Your API key for the selected LLM provider. This is securely stored and used for authentication.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. The Evaluator block takes the provided content and your custom metrics
|
||||
2. It generates a specialized prompt that instructs the LLM to evaluate the content
|
||||
3. The prompt includes clear guidelines on how to score each metric
|
||||
4. The LLM evaluates the content and returns numeric scores for each metric
|
||||
5. The Evaluator block formats these scores as structured output for use in your workflow
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
### Inputs
|
||||
|
||||
- **Content**: The text or structured data to evaluate
|
||||
- **Metrics**: Custom evaluation criteria with scoring ranges
|
||||
- **Model Settings**: LLM provider and parameters
|
||||
|
||||
### Outputs
|
||||
|
||||
- **Content**: A summary of the evaluation
|
||||
- **Model**: The model used for evaluation
|
||||
- **Tokens**: Usage statistics
|
||||
- **Metric Scores**: Numeric scores for each defined metric
|
||||
|
||||
## Example Usage
|
||||
|
||||
Here's an example of how an Evaluator block might be configured for assessing customer service responses:
|
||||
|
||||
```yaml
|
||||
# Example Evaluator Configuration
|
||||
metrics:
|
||||
- name: Empathy
|
||||
description: How well does the response acknowledge and address the customer's emotional state?
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
- name: Solution
|
||||
description: How effectively does the response solve the customer's problem?
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
- name: Clarity
|
||||
description: How clear and easy to understand is the response?
|
||||
range:
|
||||
min: 1
|
||||
max: 5
|
||||
|
||||
model: Anthropic/claude-3-opus
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Use specific metric descriptions**: Clearly define what each metric measures to get more accurate evaluations
|
||||
- **Choose appropriate ranges**: Select scoring ranges that provide enough granularity without being overly complex
|
||||
- **Connect with Agent blocks**: Use Evaluator blocks to assess Agent block outputs and create feedback loops
|
||||
- **Use consistent metrics**: For comparative analysis, maintain consistent metrics across similar evaluations
|
||||
- **Combine multiple metrics**: Use several metrics to get a comprehensive evaluation
|
||||
@@ -1,313 +0,0 @@
|
||||
---
|
||||
title: Function
|
||||
description: Execute custom JavaScript or TypeScript code in your workflows
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
|
||||
The Function block lets you run custom JavaScript or TypeScript code in your workflow. Use it to transform data, perform calculations, or implement custom logic that isn't available in other blocks.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/function-light.png"
|
||||
darkSrc="/static/dark/function-dark.png"
|
||||
alt="Function Block with Code Editor"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
|
||||
## Overview
|
||||
|
||||
The Function block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Transform data</strong>: Convert formats, parse text, manipulate arrays and objects
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Perform calculations</strong>: Math operations, statistics, financial calculations
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Implement custom logic</strong>: Complex conditionals, loops, and algorithms
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Process external data</strong>: Parse responses, format requests, handle authentication
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The Function block runs your code in a secure, isolated environment:
|
||||
|
||||
1. **Receive Input**: Access data from previous blocks via the `input` object
|
||||
2. **Execute Code**: Run your JavaScript/TypeScript code
|
||||
3. **Return Results**: Use `return` to pass data to the next block
|
||||
4. **Handle Errors**: Built-in error handling and logging
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Code Editor
|
||||
|
||||
Write your JavaScript/TypeScript code in a full-featured editor with:
|
||||
- Syntax highlighting and error checking
|
||||
- Line numbers and bracket matching
|
||||
- Support for modern JavaScript features
|
||||
- Native support for `fetch`
|
||||
|
||||
### Accessing Input Data
|
||||
|
||||
Use the `input` object to access data from previous blocks:
|
||||
|
||||
```javascript
|
||||
// Access data from connected blocks
|
||||
const userData = <agent.userData>;
|
||||
const orderData = <agent.orderData>;
|
||||
|
||||
// Access specific fields
|
||||
const customerName = <agent.customer.name>;
|
||||
const total = <agent.order.total>;
|
||||
```
|
||||
|
||||
### Common Examples
|
||||
|
||||
**Data Transformation**:
|
||||
```javascript
|
||||
// Convert and format data
|
||||
const formatted = {
|
||||
name: <agent.user.firstName> + ' ' + <agent.user.lastName>,
|
||||
email: <agent.user.email>.toLowerCase(),
|
||||
joinDate: new Date(<agent.user.created>).toLocaleDateString()
|
||||
};
|
||||
return formatted;
|
||||
```
|
||||
|
||||
**Calculations**:
|
||||
```javascript
|
||||
// Calculate discounts and totals
|
||||
const subtotal = <agent.items>.reduce((sum, item) => sum + item.price, 0);
|
||||
const discount = subtotal > 100 ? 0.1 : 0;
|
||||
const total = subtotal * (1 - discount);
|
||||
|
||||
return { subtotal, discount, total };
|
||||
```
|
||||
|
||||
**Data Validation**:
|
||||
```javascript
|
||||
// Validate email format
|
||||
const email = <agent.email>;
|
||||
const isValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
||||
|
||||
if (!isValid) {
|
||||
throw new Error('Invalid email format');
|
||||
}
|
||||
return { email, isValid };
|
||||
```
|
||||
|
||||
### Accessing Results
|
||||
|
||||
After a function executes, you can access its outputs:
|
||||
|
||||
- **`<function.result>`**: The value returned from your function
|
||||
- **`<function.stdout>`**: Any console.log() output from your code
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Async/Await Support
|
||||
|
||||
Use async functions for complex operations:
|
||||
|
||||
```javascript
|
||||
// Async function example
|
||||
const processData = async () => {
|
||||
const data = <api.response>;
|
||||
|
||||
// Process data with async operations
|
||||
const processed = await Promise.all(
|
||||
data.map(async (item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
processed: true,
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
return processed;
|
||||
};
|
||||
|
||||
return await processData();
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
Implement robust error handling:
|
||||
|
||||
```javascript
|
||||
try {
|
||||
const result = <api.data>;
|
||||
|
||||
if (!result || !result.length) {
|
||||
throw new Error('No data received');
|
||||
}
|
||||
|
||||
return result.map(item => ({
|
||||
id: item.id,
|
||||
name: item.name.trim(),
|
||||
valid: true
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('Processing failed:', error.message);
|
||||
return { error: error.message, valid: false };
|
||||
}
|
||||
```
|
||||
|
||||
### Performance Optimization
|
||||
|
||||
Optimize for large datasets:
|
||||
|
||||
```javascript
|
||||
// Efficient data processing
|
||||
const data = <api.large_dataset>;
|
||||
|
||||
// Use efficient array methods
|
||||
const processed = data
|
||||
.filter(item => item.status === 'active')
|
||||
.map(item => ({
|
||||
id: item.id,
|
||||
summary: item.description.substring(0, 100)
|
||||
}))
|
||||
.slice(0, 1000); // Limit results
|
||||
|
||||
return processed;
|
||||
```
|
||||
|
||||
## Security and Limitations
|
||||
|
||||
<Callout type="warning">
|
||||
Functions run in a secure environment with these restrictions:
|
||||
- **Execution timeout**: 30 seconds maximum to prevent infinite loops
|
||||
- **Memory limits**: Limited memory to prevent resource exhaustion
|
||||
- **No network access**: Cannot make HTTP requests (use API blocks instead)
|
||||
- **Limited APIs**: Only safe JavaScript APIs are available
|
||||
</Callout>
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables', 'Results']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Code</strong>: Your JavaScript/TypeScript code to execute
|
||||
</li>
|
||||
<li>
|
||||
<strong>Timeout</strong>: Maximum execution time (defaults to 30 seconds)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Input Data</strong>: All connected block outputs available via variables
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>function.result</strong>: The value returned from your function
|
||||
</li>
|
||||
<li>
|
||||
<strong>function.stdout</strong>: Console.log() output from your code
|
||||
</li>
|
||||
<li>
|
||||
<strong>function.error</strong>: Error details if function failed
|
||||
</li>
|
||||
<li>
|
||||
<strong>function.execution_time</strong>: Time taken to execute
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Function Result</strong>: Primary output from your code
|
||||
</li>
|
||||
<li>
|
||||
<strong>Debug Information</strong>: Logs and execution details
|
||||
</li>
|
||||
<li>
|
||||
<strong>Access</strong>: Available in blocks after the function
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### Data Processing Pipeline
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Transform API response into structured data</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>API block fetches raw customer data</li>
|
||||
<li>Function block processes and validates data</li>
|
||||
<li>Function block calculates derived metrics</li>
|
||||
<li>Response block returns formatted results</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Business Logic Implementation
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Calculate loyalty scores and tiers</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent retrieves customer purchase history</li>
|
||||
<li>Function block calculates loyalty metrics</li>
|
||||
<li>Function block determines customer tier</li>
|
||||
<li>Condition block routes based on tier level</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Data Validation and Sanitization
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Validate and clean user input</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>User input received from form submission</li>
|
||||
<li>Function block validates email format and phone numbers</li>
|
||||
<li>Function block sanitizes and normalizes data</li>
|
||||
<li>API block saves validated data to database</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Example: Loyalty Score Calculator
|
||||
|
||||
```javascript title="loyalty-calculator.js"
|
||||
// Process customer data and calculate loyalty score
|
||||
const { purchaseHistory, accountAge, supportTickets } = <agent>;
|
||||
|
||||
// Calculate metrics
|
||||
const totalSpent = purchaseHistory.reduce((sum, purchase) => sum + purchase.amount, 0);
|
||||
const purchaseFrequency = purchaseHistory.length / (accountAge / 365);
|
||||
const ticketRatio = supportTickets.resolved / supportTickets.total;
|
||||
|
||||
// Calculate loyalty score (0-100)
|
||||
const spendScore = Math.min(totalSpent / 1000 * 30, 30);
|
||||
const frequencyScore = Math.min(purchaseFrequency * 20, 40);
|
||||
const supportScore = ticketRatio * 30;
|
||||
|
||||
const loyaltyScore = Math.round(spendScore + frequencyScore + supportScore);
|
||||
|
||||
return {
|
||||
customer: <agent.name>,
|
||||
loyaltyScore,
|
||||
loyaltyTier: loyaltyScore >= 80 ? "Platinum" : loyaltyScore >= 60 ? "Gold" : "Silver",
|
||||
metrics: { spendScore, frequencyScore, supportScore }
|
||||
};
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Keep functions focused**: Write functions that do one thing well to improve maintainability and debugging
|
||||
- **Handle errors gracefully**: Use try/catch blocks to handle potential errors and provide meaningful error messages
|
||||
- **Test edge cases**: Ensure your code handles unusual inputs, null values, and boundary conditions correctly
|
||||
- **Optimize for performance**: Be mindful of computational complexity and memory usage for large datasets
|
||||
- **Use console.log() for debugging**: Leverage stdout output to debug and monitor function execution
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"title": "Blocks",
|
||||
"pages": [
|
||||
"agent",
|
||||
"api",
|
||||
"condition",
|
||||
"evaluator",
|
||||
"function",
|
||||
"loop",
|
||||
"parallel",
|
||||
"response",
|
||||
"router",
|
||||
"workflow"
|
||||
]
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
---
|
||||
title: Response
|
||||
description: Send a structured response back to API calls
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
|
||||
The Response block is the final step in your workflow that formats and returns data to whoever called your workflow. It's like the "return" statement for your entire workflow—it packages up results and sends them back.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/response-light.png"
|
||||
darkSrc="/static/dark/response-dark.png"
|
||||
alt="Response Block Configuration"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
|
||||
<Callout type="info">
|
||||
Response blocks are terminal blocks - they end the workflow execution and cannot connect to other blocks.
|
||||
</Callout>
|
||||
|
||||
## When You Need Response Blocks
|
||||
|
||||
**API Endpoints**: When your workflow is called via API, Response blocks format the return data
|
||||
**Webhooks**: Return confirmation or data back to the calling system
|
||||
**Testing**: See formatted results when testing your workflow
|
||||
**Data Export**: Structure data for external systems or reports
|
||||
|
||||
## Two Ways to Build Responses
|
||||
|
||||
### Builder Mode (Recommended)
|
||||
Visual interface for building response structure:
|
||||
- Drag and drop fields
|
||||
- Reference workflow variables easily
|
||||
- Visual preview of response structure
|
||||
|
||||
### Editor Mode (Advanced)
|
||||
Write JSON directly:
|
||||
- Full control over response format
|
||||
- Support for complex nested structures
|
||||
- Use `<variable.name>` syntax for dynamic values
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Response Data
|
||||
|
||||
The response data is the main content that will be sent back to the API caller. This should be formatted as JSON and can include:
|
||||
|
||||
- Static values
|
||||
- Dynamic references to workflow variables using the `<variable.name>` syntax
|
||||
- Nested objects and arrays
|
||||
- Any valid JSON structure
|
||||
|
||||
### Status Code
|
||||
|
||||
Set the HTTP status code for the response. Common status codes include:
|
||||
|
||||
<Tabs items={['Success (2xx)', 'Client Error (4xx)', 'Server Error (5xx)']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>200</strong>: OK - Standard success response</li>
|
||||
<li><strong>201</strong>: Created - Resource successfully created</li>
|
||||
<li><strong>204</strong>: No Content - Success with no response body</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>400</strong>: Bad Request - Invalid request parameters</li>
|
||||
<li><strong>401</strong>: Unauthorized - Authentication required</li>
|
||||
<li><strong>404</strong>: Not Found - Resource doesn't exist</li>
|
||||
<li><strong>422</strong>: Unprocessable Entity - Validation errors</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>500</strong>: Internal Server Error - Server-side error</li>
|
||||
<li><strong>502</strong>: Bad Gateway - External service error</li>
|
||||
<li><strong>503</strong>: Service Unavailable - Service temporarily down</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<p className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
||||
Default status code is 200 if not specified.
|
||||
</p>
|
||||
|
||||
### Response Headers
|
||||
|
||||
Configure additional HTTP headers to include in the response.
|
||||
|
||||
Headers are configured as key-value pairs:
|
||||
|
||||
| Key | Value |
|
||||
|-----|-------|
|
||||
| Content-Type | application/json |
|
||||
| Cache-Control | no-cache |
|
||||
| X-API-Version | 1.0 |
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Inputs', 'Outputs']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>data</strong> (JSON, optional): The JSON data to send in the response body
|
||||
</li>
|
||||
<li>
|
||||
<strong>status</strong> (number, optional): HTTP status code (default: 200)
|
||||
</li>
|
||||
<li>
|
||||
<strong>headers</strong> (JSON, optional): Additional response headers
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>data</strong>: The response body data</li>
|
||||
<li><strong>status</strong>: HTTP status code</li>
|
||||
<li><strong>headers</strong>: Response headers</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Variable References
|
||||
|
||||
Use the `<variable.name>` syntax to dynamically insert workflow variables into your response:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"id": "<variable.userId>",
|
||||
"name": "<variable.userName>",
|
||||
"email": "<variable.userEmail>"
|
||||
},
|
||||
"query": "<variable.searchQuery>",
|
||||
"results": "<variable.searchResults>",
|
||||
"totalFound": "<variable.resultCount>",
|
||||
"processingTime": "<variable.executionTime>ms"
|
||||
}
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Variable names are case-sensitive and must match exactly with the variables available in your workflow.
|
||||
</Callout>
|
||||
|
||||
## Example Usage
|
||||
|
||||
Here's an example of how a Response block might be configured for a user search API:
|
||||
|
||||
```yaml
|
||||
data: |
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"users": "<variable.searchResults>",
|
||||
"pagination": {
|
||||
"page": "<variable.currentPage>",
|
||||
"limit": "<variable.pageSize>",
|
||||
"total": "<variable.totalUsers>"
|
||||
}
|
||||
},
|
||||
"query": {
|
||||
"searchTerm": "<variable.searchTerm>",
|
||||
"filters": "<variable.appliedFilters>"
|
||||
},
|
||||
"timestamp": "<variable.timestamp>"
|
||||
}
|
||||
status: 200
|
||||
headers:
|
||||
- key: X-Total-Count
|
||||
value: <variable.totalUsers>
|
||||
- key: Cache-Control
|
||||
value: public, max-age=300
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Use meaningful status codes**: Choose appropriate HTTP status codes that accurately reflect the outcome of the workflow
|
||||
- **Structure your responses consistently**: Maintain a consistent JSON structure across all your API endpoints for better developer experience
|
||||
- **Include relevant metadata**: Add timestamps and version information to help with debugging and monitoring
|
||||
- **Handle errors gracefully**: Use conditional logic in your workflow to set appropriate error responses with descriptive messages
|
||||
- **Validate variable references**: Ensure all referenced variables exist and contain the expected data types before the Response block executes
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
---
|
||||
title: Accessing Connected Data
|
||||
description: Techniques for accessing and manipulating data from connected blocks
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { File, Files, Folder } from 'fumadocs-ui/components/files'
|
||||
|
||||
Once blocks are connected, you can access data from source blocks in destination blocks using connection tags and various data access techniques.
|
||||
|
||||
## Basic Data Access
|
||||
|
||||
The simplest way to access data is through direct references using connection tags:
|
||||
|
||||
<Files>
|
||||
<File name="Simple Property" annotation="<block.content>" />
|
||||
<File name="Nested Property" annotation="<block.tokens.total>" />
|
||||
<File name="Array Element" annotation="<block.items[0].name>" />
|
||||
<File name="Complex Path" annotation="<block.data.users[2].profile.email>" />
|
||||
</Files>
|
||||
|
||||
## Advanced Data Access Techniques
|
||||
|
||||
### Array Access
|
||||
|
||||
You can access array elements using square bracket notation:
|
||||
|
||||
```javascript
|
||||
// Access the first item in an array
|
||||
<block.items[0]>
|
||||
|
||||
// Access a specific property of an array item
|
||||
<block.items[2].name>
|
||||
|
||||
// Access the last item in an array (in Function blocks)
|
||||
const items = input.block.items;
|
||||
const lastItem = items[items.length - 1];
|
||||
```
|
||||
|
||||
### Object Property Access
|
||||
|
||||
Access object properties using dot notation:
|
||||
|
||||
```javascript
|
||||
// Access a simple property
|
||||
<block.content>
|
||||
|
||||
// Access a nested property
|
||||
<block.data.user.profile.name>
|
||||
|
||||
// Access a property with special characters (in Function blocks)
|
||||
const data = input.block.data;
|
||||
const specialProp = data['property-with-dashes'];
|
||||
```
|
||||
|
||||
### Dynamic References
|
||||
|
||||
Connection references are evaluated at runtime, allowing for dynamic data flow through your workflow:
|
||||
|
||||
```javascript
|
||||
// In a Function block, you can access connected data
|
||||
const userName = input.userBlock.name;
|
||||
const orderTotal = input.apiBlock.body.order.total;
|
||||
|
||||
// Process the data
|
||||
const discount = orderTotal > 100 ? 0.1 : 0;
|
||||
const finalPrice = orderTotal * (1 - discount);
|
||||
|
||||
// Return the result
|
||||
return {
|
||||
userName,
|
||||
originalTotal: orderTotal,
|
||||
discount: discount * 100 + '%',
|
||||
finalPrice
|
||||
};
|
||||
```
|
||||
|
||||
## Data Transformation
|
||||
|
||||
### Using Function Blocks
|
||||
|
||||
Function blocks are the most powerful way to transform data between connections:
|
||||
|
||||
```javascript
|
||||
// Example: Transform API response data
|
||||
const apiResponse = input.apiBlock.data;
|
||||
const transformedData = {
|
||||
users: apiResponse.results.map(user => ({
|
||||
id: user.id,
|
||||
fullName: `${user.firstName} ${user.lastName}`,
|
||||
email: user.email.toLowerCase(),
|
||||
isActive: user.status === 'active'
|
||||
})),
|
||||
totalCount: apiResponse.count,
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
|
||||
return transformedData;
|
||||
```
|
||||
|
||||
### String Interpolation
|
||||
|
||||
You can combine connection tags with static text:
|
||||
|
||||
```
|
||||
Hello, <userBlock.name>! Your order #<orderBlock.id> has been processed.
|
||||
```
|
||||
|
||||
### Conditional Content
|
||||
|
||||
In Function blocks, you can create conditional content based on connected data:
|
||||
|
||||
```javascript
|
||||
const user = input.userBlock;
|
||||
const orderTotal = input.orderBlock.total;
|
||||
|
||||
let message = `Thank you for your order, ${user.name}!`;
|
||||
|
||||
if (orderTotal > 100) {
|
||||
message += " You've qualified for free shipping!";
|
||||
} else {
|
||||
message += ` Add $${(100 - orderTotal).toFixed(2)} more to qualify for free shipping.`;
|
||||
}
|
||||
|
||||
return { message };
|
||||
```
|
||||
|
||||
## Handling Missing Data
|
||||
|
||||
It's important to handle cases where connected data might be missing or null:
|
||||
|
||||
<Callout type="warning">
|
||||
Always validate connected data before using it, especially when accessing nested properties or
|
||||
array elements.
|
||||
</Callout>
|
||||
|
||||
### Default Values
|
||||
|
||||
In Function blocks, you can provide default values for missing data:
|
||||
|
||||
```javascript
|
||||
const userName = input.userBlock?.name || 'Guest'
|
||||
const items = input.orderBlock?.items || []
|
||||
const total = input.orderBlock?.total ?? 0
|
||||
```
|
||||
|
||||
### Conditional Checks
|
||||
|
||||
Check if data exists before accessing nested properties:
|
||||
|
||||
```javascript
|
||||
let userEmail = 'No email provided'
|
||||
if (input.userBlock && input.userBlock.contact && input.userBlock.contact.email) {
|
||||
userEmail = input.userBlock.contact.email
|
||||
}
|
||||
```
|
||||
|
||||
### Optional Chaining
|
||||
|
||||
In Function blocks, use optional chaining to safely access nested properties:
|
||||
|
||||
```javascript
|
||||
const userCity = input.userBlock?.address?.city
|
||||
const firstItemName = input.orderBlock?.items?.[0]?.name
|
||||
```
|
||||
|
||||
## Debugging Connection Data
|
||||
|
||||
When troubleshooting connection issues, these techniques can help:
|
||||
|
||||
1. **Log Data**: In Function blocks, use `console.log()` to inspect connected data
|
||||
2. **Return Full Objects**: Return the full input object to see all available data
|
||||
3. **Check Types**: Verify the data types of connected values
|
||||
4. **Validate Paths**: Ensure you're using the correct path to access nested data
|
||||
|
||||
```javascript
|
||||
// Example debugging function
|
||||
function debugConnections() {
|
||||
console.log('All inputs:', input)
|
||||
console.log('User data type:', typeof input.userBlock)
|
||||
console.log('Order items:', input.orderBlock?.items)
|
||||
|
||||
return {
|
||||
debug: true,
|
||||
allInputs: input,
|
||||
userExists: !!input.userBlock,
|
||||
orderItemCount: input.orderBlock?.items?.length || 0,
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
title: Connection Basics
|
||||
description: Learn how connections work in Sim
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
|
||||
## How Connections Work
|
||||
|
||||
Connections are the pathways that allow data to flow between blocks in your workflow. When you connect two blocks in Sim, you're establishing a data flow relationship that defines how information passes from one block to another.
|
||||
|
||||
<Callout type="info">
|
||||
Each connection represents a directed relationship where data flows from a source block's output
|
||||
to a destination block's input.
|
||||
</Callout>
|
||||
|
||||
### Creating Connections
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Select Source Block</strong>: Click on the output port of the block you want to connect
|
||||
from
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Draw Connection</strong>: Drag to the input port of the destination block
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Confirm Connection</strong>: Release to create the connection
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Configure (Optional)</strong>: Some connections may require additional configuration
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### Connection Flow
|
||||
|
||||
The flow of data through connections follows these principles:
|
||||
|
||||
1. **Directional Flow**: Data always flows from outputs to inputs
|
||||
2. **Execution Order**: Blocks execute in order based on their connections
|
||||
3. **Data Transformation**: Data may be transformed as it passes between blocks
|
||||
4. **Conditional Paths**: Some blocks (like Router and Condition) can direct flow to different paths
|
||||
|
||||
### Connection Visualization
|
||||
|
||||
Connections are visually represented in the workflow editor:
|
||||
|
||||
- **Solid Lines**: Active connections that will pass data
|
||||
- **Animated Flow**: During execution, data flow is visualized along connections
|
||||
- **Color Coding**: Different connection types may have different colors
|
||||
- **Connection Tags**: Visual indicators showing what data is available
|
||||
|
||||
### Managing Connections
|
||||
|
||||
You can manage your connections in several ways:
|
||||
|
||||
- **Delete**: Click on a connection and press Delete or use the context menu
|
||||
- **Reroute**: Drag a connection to change its path
|
||||
- **Inspect**: Click on a connection to see details about the data being passed
|
||||
- **Disable**: Temporarily disable a connection without deleting it
|
||||
|
||||
<Callout type="warning">
|
||||
Deleting a connection will immediately stop data flow between the blocks. Make sure this is
|
||||
intended before removing connections.
|
||||
</Callout>
|
||||
|
||||
## Connection Compatibility
|
||||
|
||||
Not all blocks can be connected to each other. Compatibility depends on:
|
||||
|
||||
1. **Data Type Compatibility**: The output type must be compatible with the input type
|
||||
2. **Block Restrictions**: Some blocks may have restrictions on what they can connect to
|
||||
3. **Workflow Logic**: Connections must make logical sense in the context of your workflow
|
||||
|
||||
The editor will indicate when connections are invalid or incompatible.
|
||||
@@ -1,208 +0,0 @@
|
||||
---
|
||||
title: Connection Best Practices
|
||||
description: Recommended patterns for effective connection management
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
|
||||
## Workflow Organization
|
||||
|
||||
### Organize Your Connections
|
||||
|
||||
Keep your workflow clean and understandable by organizing connections logically:
|
||||
|
||||
- **Minimize crossing connections** when possible to reduce visual complexity
|
||||
- **Group related blocks together** to make data flow more intuitive
|
||||
- **Use consistent flow direction** (typically left-to-right or top-to-bottom)
|
||||
- **Label complex connections** with descriptive names
|
||||
|
||||
<Callout type="info">
|
||||
A well-organized workflow is easier to understand, debug, and maintain. Take time to arrange your
|
||||
blocks and connections in a logical manner.
|
||||
</Callout>
|
||||
|
||||
### Connection Naming Conventions
|
||||
|
||||
When working with multiple connections, consistent naming helps maintain clarity:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Use descriptive block names</strong>: Name blocks based on their function (e.g.,
|
||||
"UserDataFetcher", "ResponseGenerator")
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Be specific with connection references</strong>: Use clear variable names when
|
||||
referencing connections in code
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Document complex connections</strong>: Add comments explaining non-obvious data
|
||||
transformations
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Data Validation
|
||||
|
||||
### Validate Data Flow
|
||||
|
||||
Ensure that the data being passed between blocks is compatible:
|
||||
|
||||
- **Check that required fields are available** in the source block
|
||||
- **Verify data types match expectations** before using them
|
||||
- **Use Function blocks to transform data** when necessary
|
||||
- **Handle missing or null values** with default values or conditional logic
|
||||
|
||||
```javascript
|
||||
// Example: Validating and transforming data in a Function block
|
||||
function processUserData() {
|
||||
// Validate required fields
|
||||
if (!input.userBlock || !input.userBlock.id) {
|
||||
return { error: 'Missing user data', valid: false }
|
||||
}
|
||||
|
||||
// Transform and validate data types
|
||||
const userId = String(input.userBlock.id)
|
||||
const userName = input.userBlock.name || 'Unknown User'
|
||||
const userScore = Number(input.userBlock.score) || 0
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
user: {
|
||||
id: userId,
|
||||
name: userName,
|
||||
score: userScore,
|
||||
isHighScore: userScore > 100,
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
### Document Connection Purpose
|
||||
|
||||
Add comments or descriptions to clarify the purpose of connections, especially in complex workflows:
|
||||
|
||||
- **What data is being passed**: Document the key fields and their purpose
|
||||
- **Why this connection exists**: Explain the relationship between blocks
|
||||
- **Any transformations or conditions applied**: Note any data processing that occurs
|
||||
|
||||
```javascript
|
||||
// Example: Documenting connection purpose in a Function block
|
||||
/*
|
||||
* This function processes user data from the UserFetcher block
|
||||
* and order history from the OrderHistory block to generate
|
||||
* personalized product recommendations.
|
||||
*
|
||||
* Input:
|
||||
* - userBlock: User profile data (id, preferences, history)
|
||||
* - orderBlock: Recent order history (items, dates, amounts)
|
||||
*
|
||||
* Output:
|
||||
* - recommendations: Array of recommended product IDs
|
||||
* - userSegment: Calculated user segment for marketing
|
||||
* - conversionProbability: Estimated likelihood of purchase
|
||||
*/
|
||||
function generateRecommendations() {
|
||||
// Implementation...
|
||||
}
|
||||
```
|
||||
|
||||
## Testing and Debugging
|
||||
|
||||
### Test Connection References
|
||||
|
||||
Verify that connection references work as expected:
|
||||
|
||||
- **Test with different input values** to ensure robustness
|
||||
- **Check edge cases** (empty values, large datasets, special characters)
|
||||
- **Ensure error handling for missing or invalid data**
|
||||
- **Use console logging in Function blocks** to debug connection issues
|
||||
|
||||
```javascript
|
||||
// Example: Testing connection references with edge cases
|
||||
function testConnections() {
|
||||
console.log('Testing connections...')
|
||||
|
||||
// Log all inputs for debugging
|
||||
console.log('All inputs:', JSON.stringify(input, null, 2))
|
||||
|
||||
// Test for missing data
|
||||
const hasUserData = !!input.userBlock
|
||||
console.log('Has user data:', hasUserData)
|
||||
|
||||
// Test edge cases
|
||||
const items = input.orderBlock?.items || []
|
||||
console.log('Item count:', items.length)
|
||||
console.log('Empty items test:', items.length === 0 ? 'Passed' : 'Failed')
|
||||
|
||||
// Return test results
|
||||
return {
|
||||
tests: {
|
||||
hasUserData,
|
||||
hasItems: items.length > 0,
|
||||
hasLargeOrder: items.length > 10,
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Optimize Data Flow
|
||||
|
||||
Keep your workflows efficient by optimizing how data flows through connections:
|
||||
|
||||
- **Pass only necessary data** between blocks to reduce memory usage
|
||||
- **Use Function blocks to filter large datasets** before passing them on
|
||||
- **Consider caching results** for expensive operations
|
||||
- **Break complex workflows into smaller, reusable components**
|
||||
|
||||
```javascript
|
||||
// Example: Optimizing data flow by filtering
|
||||
function optimizeUserData() {
|
||||
const userData = input.userBlock
|
||||
|
||||
// Only pass necessary fields to downstream blocks
|
||||
return {
|
||||
id: userData.id,
|
||||
name: userData.name,
|
||||
email: userData.email,
|
||||
// Filter out unnecessary profile data, history, etc.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
### Secure Sensitive Data
|
||||
|
||||
Protect sensitive information when using connections:
|
||||
|
||||
- **Never expose API keys or credentials** in connection data
|
||||
- **Sanitize user input** before processing it
|
||||
- **Redact sensitive information** when logging connection data
|
||||
- **Use secure connections** for external API calls
|
||||
|
||||
<Callout type="warning">
|
||||
Be careful when logging connection data that might contain sensitive information. Always redact or
|
||||
mask sensitive fields like passwords, API keys, or personal information.
|
||||
</Callout>
|
||||
|
||||
## Advanced Patterns
|
||||
|
||||
### Conditional Connections
|
||||
|
||||
Use Condition blocks to create dynamic workflows:
|
||||
|
||||
- **Route data based on content** to different processing paths
|
||||
- **Implement fallback paths** for error handling
|
||||
- **Create decision trees** for complex business logic
|
||||
|
||||
### Feedback Loops
|
||||
|
||||
Create more sophisticated workflows with feedback connections:
|
||||
|
||||
- **Implement iterative processing** by connecting later blocks back to earlier ones
|
||||
- **Use Memory blocks** to store state between iterations
|
||||
- **Set termination conditions** to prevent infinite loops
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"title": "Connections",
|
||||
"pages": ["basics", "tags", "data-structure", "accessing-data", "best-practices"]
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
---
|
||||
title: Copilot
|
||||
description: Build and edit workflows with Sim Copilot
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { MessageCircle, Package, Zap, Infinity as InfinityIcon, Brain, BrainCircuit } from 'lucide-react'
|
||||
|
||||
## What is Copilot
|
||||
|
||||
Copilot is your in-editor assistant that helps you build, understand, and improve workflows. It can:
|
||||
|
||||
- **Explain**: Answer questions about Sim and your current workflow
|
||||
- **Guide**: Suggest edits and best practices
|
||||
- **Edit**: Make changes to blocks, connections, and settings when you approve
|
||||
|
||||
<Callout type="info">
|
||||
Copilot is a Sim-managed service. For self-hosted deployments, generate a Copilot API key in the hosted app (sim.ai → Settings → Copilot)
|
||||
1. Go to [sim.ai](https://sim.ai) → Settings → Copilot and generate a Copilot API key
|
||||
2. Set `COPILOT_API_KEY` in your self-hosted environment to that value
|
||||
3. Host Sim on a publicly available DNS and set `NEXT_PUBLIC_APP_URL` and `BETTER_AUTH_URL` to that value (e.g., using ngrok)
|
||||
</Callout>
|
||||
|
||||
## Modes
|
||||
|
||||
<Cards>
|
||||
<Card title="Ask">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<MessageCircle className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">
|
||||
Q&A mode for explanations, guidance, and suggestions without making changes to your workflow.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="Agent">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<Package className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">
|
||||
Build-and-edit mode. Copilot proposes specific edits (add blocks, wire variables, tweak settings) and applies them when you approve.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Depth Levels
|
||||
|
||||
<Cards>
|
||||
<Card title="Fast">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<Zap className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">Quickest and cheapest. Best for small edits, simple workflows, and minor tweaks.</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="Auto">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<InfinityIcon className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">Balanced speed and reasoning. Recommended default for most tasks.</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="Pro">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<Brain className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">More reasoning for larger workflows and complex edits while staying performant.</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="Max">
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/50 bg-muted/60">
|
||||
<BrainCircuit className="h-4 w-4 text-muted-foreground" />
|
||||
</span>
|
||||
<div>
|
||||
<p className="m-0 text-sm">Maximum reasoning for deep planning, debugging, and complex architectural changes.</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Cards>
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"title": "Copilot",
|
||||
"pages": ["index"]
|
||||
}
|
||||
@@ -1,22 +1,24 @@
|
||||
---
|
||||
title: Agent
|
||||
description: Create powerful AI agents using any LLM provider
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
The Agent block serves as the interface between your workflow and Large Language Models (LLMs). It executes inference requests against various AI providers, processes natural language inputs according to defined instructions, and generates structured or unstructured outputs for downstream consumption.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/agent-light.png"
|
||||
darkSrc="/static/dark/agent-dark.png"
|
||||
alt="Agent Block Configuration"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/agent.png"
|
||||
alt="Agent Block Configuration"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -68,7 +70,7 @@ The Agent block supports multiple LLM providers through a unified inference inte
|
||||
**Local Deployment**: Ollama-compatible models (self-hosted inference)
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<video autoPlay loop muted playsInline className="w-full -mb-2 rounded-lg" src="/models.mp4"></video>
|
||||
<Video src="models.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
### Temperature
|
||||
@@ -90,9 +92,9 @@ Control the creativity and randomness of responses:
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<p className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
||||
<div className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
||||
The temperature range (0-1 or 0-2) varies depending on the selected model.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
### API Key
|
||||
|
||||
@@ -108,7 +110,7 @@ Tools extend the agent's capabilities through external API integrations and serv
|
||||
3. Configure authentication parameters and operational constraints
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<video autoPlay loop muted playsInline className="w-full -mb-2 rounded-lg" src="/tools.mp4"></video>
|
||||
<Video src="tools.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
**Available Tool Categories**:
|
||||
@@ -124,7 +126,7 @@ Tools extend the agent's capabilities through external API integrations and serv
|
||||
- **None**: Tool definition available but excluded from model context
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<video autoPlay loop muted playsInline className="w-full -mb-2 rounded-lg" src="/granular-tool-control.mp4"></video>
|
||||
<Video src="granular-tool-control.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
### Response Format
|
||||
@@ -165,42 +167,41 @@ After an agent completes, you can access its outputs:
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Memory Integration
|
||||
### Memory + Agent: Conversation History
|
||||
|
||||
Agents can maintain context across interactions using the memory system:
|
||||
Use a `Memory` block with a consistent `id` (for example, `chat`) to persist messages between runs, and include that history in the Agent's prompt.
|
||||
|
||||
```javascript
|
||||
// In a Function block before the agent
|
||||
const memory = {
|
||||
conversation_history: previousMessages,
|
||||
user_preferences: userProfile,
|
||||
session_data: currentSession
|
||||
};
|
||||
- Add the user's message before the Agent
|
||||
- Read the conversation history for context
|
||||
- Append the Agent's reply after it runs
|
||||
|
||||
```yaml
|
||||
# 1) Add latest user message
|
||||
- Memory (operation: add)
|
||||
id: chat
|
||||
role: user
|
||||
content: {{input}}
|
||||
|
||||
# 2) Load conversation history
|
||||
- Memory (operation: get)
|
||||
id: chat
|
||||
|
||||
# 3) Run the agent with prior messages available
|
||||
- Agent
|
||||
System Prompt: ...
|
||||
User Prompt: |
|
||||
Use the conversation so far:
|
||||
{{memory_get.memories}}
|
||||
Current user message: {{input}}
|
||||
|
||||
# 4) Store the agent reply
|
||||
- Memory (operation: add)
|
||||
id: chat
|
||||
role: assistant
|
||||
content: {{agent.content}}
|
||||
```
|
||||
|
||||
### Structured Output Validation
|
||||
|
||||
Use JSON Schema to ensure consistent, machine-readable responses:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"analysis": {"type": "string"},
|
||||
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
||||
"categories": {"type": "array", "items": {"type": "string"}}
|
||||
},
|
||||
"required": ["analysis", "confidence"]
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
Agents automatically handle common errors:
|
||||
- API rate limits with exponential backoff
|
||||
- Invalid tool calls with retry logic
|
||||
- Network failures with connection recovery
|
||||
- Schema validation errors with fallback responses
|
||||
See the `Memory` block reference for details: [/tools/memory](/tools/memory).
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
@@ -265,10 +266,12 @@ Agents automatically handle common errors:
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Handle customer inquiries with database access</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>User submits support ticket via API block</li>
|
||||
<li>Agent processes inquiry with product database tools</li>
|
||||
<li>Agent generates response and creates follow-up ticket</li>
|
||||
<li>Response block sends reply to customer</li>
|
||||
<li>User submits a support ticket via the API block</li>
|
||||
<li>Agent checks orders/subscriptions in Postgres and searches the knowledge base for guidance</li>
|
||||
<li>If escalation is needed, the Agent creates a Linear issue with relevant context</li>
|
||||
<li>Agent drafts a clear email reply</li>
|
||||
<li>Gmail sends the reply to the customer</li>
|
||||
<li>Conversation is saved to Memory to maintain history for future messages</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
---
|
||||
title: API
|
||||
description: Connect to external services through API endpoints
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The API block enables you to connect your workflow to external services through HTTP requests. It supports various methods like GET, POST, PUT, DELETE, and PATCH, allowing you to interact with virtually any API endpoint.
|
||||
The API block enables you to connect your workflow to external services through API endpoints using HTTP requests. It supports various methods like GET, POST, PUT, DELETE, and PATCH, allowing you to interact with virtually any API endpoint.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/api-light.png"
|
||||
darkSrc="/static/dark/api-dark.png"
|
||||
alt="API Block"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/api.png"
|
||||
alt="API Block"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -37,6 +38,15 @@ The API block enables you to:
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The API block processes HTTP requests through a structured approach:
|
||||
|
||||
1. **Configure Request** - Set URL, method, headers, and body parameters
|
||||
2. **Execute Request** - Send HTTP request to the specified endpoint
|
||||
3. **Process Response** - Handle response data, status codes, and headers
|
||||
4. **Error Handling** - Manage timeouts, retries, and error conditions
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### URL
|
||||
@@ -202,18 +212,6 @@ if (<api.status> === 200) {
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Create Support Ticket
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Submit support request to ticketing system</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent analyzes user issue and generates ticket data</li>
|
||||
<li>API block POSTs ticket to support system</li>
|
||||
<li>Condition block checks if ticket was created successfully</li>
|
||||
<li>Response block confirms ticket creation with ID</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Payment Processing
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
@@ -222,7 +220,7 @@ if (<api.status> === 200) {
|
||||
<li>Function block validates payment data</li>
|
||||
<li>API block creates payment intent via Stripe</li>
|
||||
<li>Condition block handles payment success/failure</li>
|
||||
<li>Function block updates order status in database</li>
|
||||
<li>Supabase block updates order status in database</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
---
|
||||
title: Condition
|
||||
description: Create conditional logic and branching in your workflows
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The Condition block allows you to branch your workflow execution path based on boolean expressions. It evaluates conditions and routes the workflow accordingly, enabling you to create dynamic, responsive workflows with different execution paths.
|
||||
The Condition block allows you to branch your workflow execution path based on boolean expressions, enabling you to create dynamic, responsive workflows with different execution paths. It evaluates conditions and routes the workflow accordingly, letting you control execution flow based on data or logic without requiring an LLM.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/condition-light.png"
|
||||
darkSrc="/static/dark/condition-dark.png"
|
||||
alt="Condition Block"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/condition.png"
|
||||
alt="Condition Block"
|
||||
width={500}
|
||||
height={350}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Callout>
|
||||
Condition blocks enable deterministic decision-making without requiring an LLM, making them ideal
|
||||
199
apps/docs/content/docs/en/blocks/evaluator.mdx
Normal file
199
apps/docs/content/docs/en/blocks/evaluator.mdx
Normal file
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: Evaluator
|
||||
---
|
||||
|
||||
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 Evaluator block uses AI to score and assess content quality using customizable evaluation metrics that you define. Perfect for quality control, A/B testing, and ensuring your AI outputs meet specific standards.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/evaluator.png"
|
||||
alt="Evaluator Block Configuration"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
The Evaluator block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Score Content Quality</strong>: Use AI to evaluate content against custom metrics with numeric scores
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Define Custom Metrics</strong>: Create specific evaluation criteria tailored to your use case
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Automate Quality Control</strong>: Build workflows that automatically assess and filter content
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Track Performance</strong>: Monitor improvements and consistency over time with objective scoring
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The Evaluator block processes content through AI-powered assessment:
|
||||
|
||||
1. **Receive Content** - Takes input content from previous blocks in your workflow
|
||||
2. **Apply Metrics** - Evaluates content against your defined custom metrics
|
||||
3. **Generate Scores** - AI model assigns numeric scores for each metric
|
||||
4. **Provide Summary** - Returns detailed evaluation with scores and explanations
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Evaluation Metrics
|
||||
|
||||
Define custom metrics to evaluate content against. Each metric includes:
|
||||
|
||||
- **Name**: A short identifier for the metric
|
||||
- **Description**: A detailed explanation of what the metric measures
|
||||
- **Range**: The numeric range for scoring (e.g., 1-5, 0-10)
|
||||
|
||||
Example metrics:
|
||||
|
||||
```
|
||||
Accuracy (1-5): How factually accurate is the content?
|
||||
Clarity (1-5): How clear and understandable is the content?
|
||||
Relevance (1-5): How relevant is the content to the original query?
|
||||
```
|
||||
|
||||
### Content
|
||||
|
||||
The content to be evaluated. This can be:
|
||||
|
||||
- Directly provided in the block configuration
|
||||
- Connected from another block's output (typically an Agent block)
|
||||
- Dynamically generated during workflow execution
|
||||
|
||||
### Model Selection
|
||||
|
||||
Choose an AI model to perform the evaluation:
|
||||
|
||||
**OpenAI**: GPT-4o, o1, o3, o4-mini, gpt-4.1
|
||||
**Anthropic**: Claude 3.7 Sonnet
|
||||
**Google**: Gemini 2.5 Pro, Gemini 2.0 Flash
|
||||
**Other Providers**: Groq, Cerebras, xAI, DeepSeek
|
||||
**Local Models**: Any model running on Ollama
|
||||
|
||||
<div className="w-full max-w-2xl mx-auto overflow-hidden rounded-lg">
|
||||
<Video src="models.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
**Recommendation**: Use models with strong reasoning capabilities like GPT-4o or Claude 3.7 Sonnet for more accurate evaluations.
|
||||
|
||||
### API Key
|
||||
|
||||
Your API key for the selected LLM provider. This is securely stored and used for authentication.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. The Evaluator block takes the provided content and your custom metrics
|
||||
2. It generates a specialized prompt that instructs the LLM to evaluate the content
|
||||
3. The prompt includes clear guidelines on how to score each metric
|
||||
4. The LLM evaluates the content and returns numeric scores for each metric
|
||||
5. The Evaluator block formats these scores as structured output for use in your workflow
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### Content Quality Assessment
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Evaluate blog post quality before publication</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent block generates blog post content</li>
|
||||
<li>Evaluator assesses accuracy, readability, and engagement</li>
|
||||
<li>Condition block checks if scores meet minimum thresholds</li>
|
||||
<li>High scores → Publish, Low scores → Revise and retry</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### A/B Testing Content
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Compare multiple AI-generated responses</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Parallel block generates multiple response variations</li>
|
||||
<li>Evaluator scores each variation on clarity and relevance</li>
|
||||
<li>Function block selects highest-scoring response</li>
|
||||
<li>Response block returns the best result</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Customer Support Quality Control
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Ensure support responses meet quality standards</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Support agent generates response to customer inquiry</li>
|
||||
<li>Evaluator scores helpfulness, empathy, and accuracy</li>
|
||||
<li>Scores logged for training and performance monitoring</li>
|
||||
<li>Low scores trigger human review process</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables', 'Results']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Content</strong>: The text or structured data to evaluate
|
||||
</li>
|
||||
<li>
|
||||
<strong>Evaluation Metrics</strong>: Custom criteria with scoring ranges
|
||||
</li>
|
||||
<li>
|
||||
<strong>Model</strong>: AI model for evaluation analysis
|
||||
</li>
|
||||
<li>
|
||||
<strong>API Key</strong>: Authentication for selected LLM provider
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>evaluator.content</strong>: Summary of the evaluation
|
||||
</li>
|
||||
<li>
|
||||
<strong>evaluator.model</strong>: Model used for evaluation
|
||||
</li>
|
||||
<li>
|
||||
<strong>evaluator.tokens</strong>: Token usage statistics
|
||||
</li>
|
||||
<li>
|
||||
<strong>evaluator.cost</strong>: Cost summary for the evaluation call
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Metric Scores</strong>: Numeric scores for each defined metric
|
||||
</li>
|
||||
<li>
|
||||
<strong>Evaluation Summary</strong>: Detailed assessment with explanations
|
||||
</li>
|
||||
<li>
|
||||
<strong>Access</strong>: Available in blocks after the evaluator
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Use specific metric descriptions**: Clearly define what each metric measures to get more accurate evaluations
|
||||
- **Choose appropriate ranges**: Select scoring ranges that provide enough granularity without being overly complex
|
||||
- **Connect with Agent blocks**: Use Evaluator blocks to assess Agent block outputs and create feedback loops
|
||||
- **Use consistent metrics**: For comparative analysis, maintain consistent metrics across similar evaluations
|
||||
- **Combine multiple metrics**: Use several metrics to get a comprehensive evaluation
|
||||
156
apps/docs/content/docs/en/blocks/function.mdx
Normal file
156
apps/docs/content/docs/en/blocks/function.mdx
Normal file
@@ -0,0 +1,156 @@
|
||||
---
|
||||
title: Function
|
||||
---
|
||||
|
||||
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'
|
||||
|
||||
The Function block lets you execute custom JavaScript or TypeScript code in your workflows. Use it to transform data, perform calculations, or implement custom logic that isn't available in other blocks.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/function.png"
|
||||
alt="Function Block with Code Editor"
|
||||
width={500}
|
||||
height={350}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
The Function block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Transform data</strong>: Convert formats, parse text, manipulate arrays and objects
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Perform calculations</strong>: Math operations, statistics, financial calculations
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Implement custom logic</strong>: Complex conditionals, loops, and algorithms
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Process external data</strong>: Parse responses, format requests, handle authentication
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The Function block runs your code in a secure, isolated environment:
|
||||
|
||||
1. **Receive Input**: Access data from previous blocks via the `input` object
|
||||
2. **Execute Code**: Run your JavaScript/Python code
|
||||
3. **Return Results**: Use `return` to pass data to the next block
|
||||
4. **Handle Errors**: Built-in error handling and logging
|
||||
|
||||
## Remote Execution (E2B)
|
||||
|
||||
- **Languages**: Run JavaScript and Python in an isolated E2B sandbox.
|
||||
- **How to enable**: Toggle “Remote Code Execution” in the Function block.
|
||||
- **When to use**: Heavier logic, external libraries, or Python-specific code.
|
||||
- **Performance**: Slower than local JS due to sandbox startup and network overhead.
|
||||
- **Notes**: Requires `E2B_API_KEY` if running locally. For lowest latency, use natively local JS (Fast Mode).
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Code</strong>: Your JavaScript/Python code to execute
|
||||
</li>
|
||||
<li>
|
||||
<strong>Timeout</strong>: Maximum execution time (defaults to 30 seconds)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Input Data</strong>: All connected block outputs available via variables
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>function.result</strong>: The value returned from your function
|
||||
</li>
|
||||
<li>
|
||||
<strong>function.stdout</strong>: Console.log() output from your code
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### Data Processing Pipeline
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Transform API response into structured data</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>API block fetches raw customer data</li>
|
||||
<li>Function block processes and validates data</li>
|
||||
<li>Function block calculates derived metrics</li>
|
||||
<li>Response block returns formatted results</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Business Logic Implementation
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Calculate loyalty scores and tiers</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Agent retrieves customer purchase history</li>
|
||||
<li>Function block calculates loyalty metrics</li>
|
||||
<li>Function block determines customer tier</li>
|
||||
<li>Condition block routes based on tier level</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Data Validation and Sanitization
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Validate and clean user input</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>User input received from form submission</li>
|
||||
<li>Function block validates email format and phone numbers</li>
|
||||
<li>Function block sanitizes and normalizes data</li>
|
||||
<li>API block saves validated data to database</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Example: Loyalty Score Calculator
|
||||
|
||||
```javascript title="loyalty-calculator.js"
|
||||
// Process customer data and calculate loyalty score
|
||||
const { purchaseHistory, accountAge, supportTickets } = <agent>;
|
||||
|
||||
// Calculate metrics
|
||||
const totalSpent = purchaseHistory.reduce((sum, purchase) => sum + purchase.amount, 0);
|
||||
const purchaseFrequency = purchaseHistory.length / (accountAge / 365);
|
||||
const ticketRatio = supportTickets.resolved / supportTickets.total;
|
||||
|
||||
// Calculate loyalty score (0-100)
|
||||
const spendScore = Math.min(totalSpent / 1000 * 30, 30);
|
||||
const frequencyScore = Math.min(purchaseFrequency * 20, 40);
|
||||
const supportScore = ticketRatio * 30;
|
||||
|
||||
const loyaltyScore = Math.round(spendScore + frequencyScore + supportScore);
|
||||
|
||||
return {
|
||||
customer: <agent.name>,
|
||||
loyaltyScore,
|
||||
loyaltyTier: loyaltyScore >= 80 ? "Platinum" : loyaltyScore >= 60 ? "Gold" : "Silver",
|
||||
metrics: { spendScore, frequencyScore, supportScore }
|
||||
};
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Keep functions focused**: Write functions that do one thing well to improve maintainability and debugging
|
||||
- **Handle errors gracefully**: Use try/catch blocks to handle potential errors and provide meaningful error messages
|
||||
- **Test edge cases**: Ensure your code handles unusual inputs, null values, and boundary conditions correctly
|
||||
- **Optimize for performance**: Be mindful of computational complexity and memory usage for large datasets
|
||||
- **Use console.log() for debugging**: Leverage stdout output to debug and monitor function execution
|
||||
@@ -6,13 +6,12 @@ description: The building components of your AI workflows
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { BlockTypes } from '@/components/ui/block-types'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
Blocks are the building components you connect together to create AI workflows. Think of them as specialized modules that each handle a specific task—from chatting with AI models to making API calls or processing data.
|
||||
|
||||
<div className="w-full max-w-2xl mx-auto overflow-hidden rounded-lg">
|
||||
<Video src="connections.mp4" />
|
||||
<Video src="connections.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
## Core Block Types
|
||||
@@ -32,8 +31,6 @@ Sim provides seven core block types that handle the essential functions of AI wo
|
||||
### Output Blocks
|
||||
- **[Response](/blocks/response)** - Format and return final results from your workflow
|
||||
|
||||
<BlockTypes />
|
||||
|
||||
## How Blocks Work
|
||||
|
||||
Each block has three main components:
|
||||
@@ -63,7 +60,7 @@ You create workflows by connecting blocks together. The output of one block beco
|
||||
- **Branching paths**: Some blocks can route to different paths based on conditions
|
||||
|
||||
<div className="w-full max-w-2xl mx-auto overflow-hidden rounded-lg">
|
||||
<Video src="connections.mp4" />
|
||||
<Video src="connections.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
## Common Patterns
|
||||
@@ -1,22 +1,15 @@
|
||||
---
|
||||
title: Loop
|
||||
description: Create iterative workflows with loops that execute blocks repeatedly
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The Loop block is a container block in Sim that allows you to execute a group of blocks repeatedly. Loops enable iterative processing in your workflows.
|
||||
The Loop block is a container block in Sim that allows you to create iterative workflows by executing a group of blocks repeatedly. Loops enable iterative processing in your workflows.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/loop-light.png"
|
||||
darkSrc="/static/dark/loop-dark.png"
|
||||
alt="Loop Block"
|
||||
width={500}
|
||||
height={300}
|
||||
/>
|
||||
The Loop block supports two types of iteration:
|
||||
|
||||
<Callout type="info">
|
||||
Loop blocks are container nodes that can hold other blocks inside them. The blocks inside a loop will execute multiple times based on your configuration.
|
||||
@@ -33,8 +26,23 @@ The Loop block enables you to:
|
||||
<Step>
|
||||
<strong>Repeat operations</strong>: Execute blocks a fixed number of times
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Sequential processing</strong>: Handle data transformation in ordered iterations
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Aggregate results</strong>: Collect outputs from all loop iterations
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The Loop block executes contained blocks through sequential iteration:
|
||||
|
||||
1. **Initialize Loop** - Set up iteration parameters (count or collection)
|
||||
2. **Execute Iteration** - Run contained blocks for current iteration
|
||||
3. **Collect Results** - Store output from each iteration
|
||||
4. **Continue or Complete** - Move to next iteration or finish loop
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Loop Type
|
||||
@@ -43,7 +51,19 @@ Choose between two types of loops:
|
||||
|
||||
<Tabs items={['For Loop', 'ForEach Loop']}>
|
||||
<Tab>
|
||||
A numeric loop that executes a fixed number of times. Use this when you need to repeat an operation a specific number of times.
|
||||
**For Loop (Iterations)** - A numeric loop that executes a fixed number of times:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/loop-1.png"
|
||||
alt="For Loop with iterations"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Use this when you need to repeat an operation a specific number of times.
|
||||
|
||||
```
|
||||
Example: Run 5 times
|
||||
@@ -55,7 +75,19 @@ Choose between two types of loops:
|
||||
```
|
||||
</Tab>
|
||||
<Tab>
|
||||
A collection-based loop that iterates over each item in an array or object. Use this when you need to process a collection of items.
|
||||
**ForEach Loop (Collection)** - A collection-based loop that iterates over each item in an array or object:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/loop-2.png"
|
||||
alt="ForEach Loop with collection"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Use this when you need to process a collection of items.
|
||||
|
||||
```
|
||||
Example: Process ["apple", "banana", "orange"]
|
||||
@@ -1,22 +1,15 @@
|
||||
---
|
||||
title: Parallel
|
||||
description: Execute multiple blocks concurrently for faster workflow processing
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The Parallel block is a container block in Sim that allows you to execute multiple instances of blocks concurrently.
|
||||
The Parallel block is a container block in Sim that allows you to execute multiple instances of blocks concurrently for faster workflow processing.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/parallel-light.png"
|
||||
darkSrc="/static/dark/parallel-dark.png"
|
||||
alt="Parallel Block"
|
||||
width={500}
|
||||
height={300}
|
||||
/>
|
||||
The Parallel block supports two types of concurrent execution:
|
||||
|
||||
<Callout type="info">
|
||||
Parallel blocks are container nodes that execute their contents multiple times simultaneously, unlike loops which execute sequentially.
|
||||
@@ -49,7 +42,19 @@ Choose between two types of parallel execution:
|
||||
|
||||
<Tabs items={['Count-based', 'Collection-based']}>
|
||||
<Tab>
|
||||
Execute a fixed number of parallel instances. Use this when you need to run the same operation multiple times concurrently.
|
||||
**Count-based Parallel** - Execute a fixed number of parallel instances:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/parallel-1.png"
|
||||
alt="Count-based parallel execution"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Use this when you need to run the same operation multiple times concurrently.
|
||||
|
||||
```
|
||||
Example: Run 5 parallel instances
|
||||
@@ -61,7 +66,19 @@ Choose between two types of parallel execution:
|
||||
```
|
||||
</Tab>
|
||||
<Tab>
|
||||
Distribute a collection across parallel instances. Each instance processes one item from the collection simultaneously.
|
||||
**Collection-based Parallel** - Distribute a collection across parallel instances:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/parallel-2.png"
|
||||
alt="Collection-based parallel execution"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Each instance processes one item from the collection simultaneously.
|
||||
|
||||
```
|
||||
Example: Process ["task1", "task2", "task3"] in parallel
|
||||
@@ -105,8 +122,8 @@ After a parallel block completes, you can access aggregated results:
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Get responses from multiple AI models</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Count-based parallel set to 3 instances</li>
|
||||
<li>Inside parallel: Agent configured with different model per instance</li>
|
||||
<li>Collection-based parallel over a list of model IDs (e.g., ["gpt-4o", "claude-3.7-sonnet", "gemini-2.5-pro"])</li>
|
||||
<li>Inside parallel: Agent's model is set to the current item from the collection</li>
|
||||
<li>After parallel: Compare and select best response</li>
|
||||
</ol>
|
||||
</div>
|
||||
247
apps/docs/content/docs/en/blocks/response.mdx
Normal file
247
apps/docs/content/docs/en/blocks/response.mdx
Normal file
@@ -0,0 +1,247 @@
|
||||
---
|
||||
title: Response
|
||||
---
|
||||
|
||||
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'
|
||||
|
||||
The Response block is the final step in your workflow that formats and sends a structured response back to API calls. It's like the "return" statement for your entire workflow—it packages up results and sends them back.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/response.png"
|
||||
alt="Response Block Configuration"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Callout type="info">
|
||||
Response blocks are terminal blocks - they end the workflow execution and cannot connect to other blocks.
|
||||
</Callout>
|
||||
|
||||
## Overview
|
||||
|
||||
The Response block enables you to:
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Format API Responses</strong>: Structure workflow results into proper HTTP responses
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Set Status Codes</strong>: Configure appropriate HTTP status codes based on workflow outcomes
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Control Headers</strong>: Add custom headers for API responses and webhooks
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Transform Data</strong>: Convert workflow variables into client-friendly response formats
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## How It Works
|
||||
|
||||
The Response block finalizes workflow execution:
|
||||
|
||||
1. **Collect Data** - Gathers variables and outputs from previous blocks
|
||||
2. **Format Response** - Structures data according to your configuration
|
||||
3. **Set HTTP Details** - Applies status codes and headers
|
||||
4. **Send Response** - Returns the formatted response to the API caller
|
||||
|
||||
## When You Need Response Blocks
|
||||
|
||||
- **API Endpoints**: When your workflow is called via API, Response blocks format the return data
|
||||
- **Webhooks**: Return confirmation or data back to the calling system
|
||||
- **Testing**: See formatted results when testing your workflow
|
||||
|
||||
## Two Ways to Build Responses
|
||||
|
||||
### Builder Mode (Recommended)
|
||||
Visual interface for building response structure:
|
||||
- Drag and drop fields
|
||||
- Reference workflow variables easily
|
||||
- Visual preview of response structure
|
||||
|
||||
### Editor Mode (Advanced)
|
||||
Write JSON directly:
|
||||
- Full control over response format
|
||||
- Support for complex nested structures
|
||||
- Use `<variable.name>` syntax for dynamic values
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Response Data
|
||||
|
||||
The response data is the main content that will be sent back to the API caller. This should be formatted as JSON and can include:
|
||||
|
||||
- Static values
|
||||
- Dynamic references to workflow variables using the `<variable.name>` syntax
|
||||
- Nested objects and arrays
|
||||
- Any valid JSON structure
|
||||
|
||||
### Status Code
|
||||
|
||||
Set the HTTP status code for the response. Common status codes include:
|
||||
|
||||
<Tabs items={['Success (2xx)', 'Client Error (4xx)', 'Server Error (5xx)']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>200</strong>: OK - Standard success response</li>
|
||||
<li><strong>201</strong>: Created - Resource successfully created</li>
|
||||
<li><strong>204</strong>: No Content - Success with no response body</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>400</strong>: Bad Request - Invalid request parameters</li>
|
||||
<li><strong>401</strong>: Unauthorized - Authentication required</li>
|
||||
<li><strong>404</strong>: Not Found - Resource doesn't exist</li>
|
||||
<li><strong>422</strong>: Unprocessable Entity - Validation errors</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li><strong>500</strong>: Internal Server Error - Server-side error</li>
|
||||
<li><strong>502</strong>: Bad Gateway - External service error</li>
|
||||
<li><strong>503</strong>: Service Unavailable - Service temporarily down</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<div className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
||||
Default status code is 200 if not specified.
|
||||
</div>
|
||||
|
||||
### Response Headers
|
||||
|
||||
Configure additional HTTP headers to include in the response.
|
||||
|
||||
Headers are configured as key-value pairs:
|
||||
|
||||
| Key | Value |
|
||||
|-----|-------|
|
||||
| Content-Type | application/json |
|
||||
| Cache-Control | no-cache |
|
||||
| X-API-Version | 1.0 |
|
||||
|
||||
## Example Use Cases
|
||||
|
||||
### API Endpoint Response
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Return structured data from a search API</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Workflow processes search query and retrieves results</li>
|
||||
<li>Function block formats and paginates results</li>
|
||||
<li>Response block returns JSON with data, pagination, and metadata</li>
|
||||
<li>Client receives structured response with 200 status</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Webhook Confirmation
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Acknowledge webhook receipt and processing</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Webhook trigger receives external system data</li>
|
||||
<li>Workflow processes the incoming data</li>
|
||||
<li>Response block returns confirmation with processing status</li>
|
||||
<li>External system receives acknowledgment</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Error Response Handling
|
||||
|
||||
<div className="mb-4 rounded-md border p-4">
|
||||
<h4 className="font-medium">Scenario: Return appropriate error responses</h4>
|
||||
<ol className="list-decimal pl-5 text-sm">
|
||||
<li>Condition block detects validation failure or system error</li>
|
||||
<li>Router directs to error handling path</li>
|
||||
<li>Response block returns 400/500 status with error details</li>
|
||||
<li>Client receives structured error information</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables', 'Results']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Response Data</strong>: JSON structure for response body
|
||||
</li>
|
||||
<li>
|
||||
<strong>Status Code</strong>: HTTP status code (default: 200)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Headers</strong>: Custom HTTP headers as key-value pairs
|
||||
</li>
|
||||
<li>
|
||||
<strong>Mode</strong>: Builder or Editor mode for response construction
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>response.data</strong>: The structured response body
|
||||
</li>
|
||||
<li>
|
||||
<strong>response.status</strong>: HTTP status code sent
|
||||
</li>
|
||||
<li>
|
||||
<strong>response.headers</strong>: Headers included in response
|
||||
</li>
|
||||
<li>
|
||||
<strong>response.success</strong>: Boolean indicating successful completion
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>HTTP Response</strong>: Complete response sent to API caller
|
||||
</li>
|
||||
<li>
|
||||
<strong>Workflow Termination</strong>: Ends workflow execution
|
||||
</li>
|
||||
<li>
|
||||
<strong>Access</strong>: Response blocks are terminal - no subsequent blocks
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Variable References
|
||||
|
||||
Use the `<variable.name>` syntax to dynamically insert workflow variables into your response:
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"id": "<variable.userId>",
|
||||
"name": "<variable.userName>",
|
||||
"email": "<variable.userEmail>"
|
||||
},
|
||||
"query": "<variable.searchQuery>",
|
||||
"results": "<variable.searchResults>",
|
||||
"totalFound": "<variable.resultCount>",
|
||||
"processingTime": "<variable.executionTime>ms"
|
||||
}
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Variable names are case-sensitive and must match exactly with the variables available in your workflow.
|
||||
</Callout>
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Use meaningful status codes**: Choose appropriate HTTP status codes that accurately reflect the outcome of the workflow
|
||||
- **Structure your responses consistently**: Maintain a consistent JSON structure across all your API endpoints for better developer experience
|
||||
- **Include relevant metadata**: Add timestamps and version information to help with debugging and monitoring
|
||||
- **Handle errors gracefully**: Use conditional logic in your workflow to set appropriate error responses with descriptive messages
|
||||
- **Validate variable references**: Ensure all referenced variables exist and contain the expected data types before the Response block executes
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
---
|
||||
title: Router
|
||||
description: Route workflow execution based on specific conditions or logic
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
The Router block uses AI to intelligently decide which path your workflow should take next. Unlike Condition blocks that use simple rules, Router blocks can understand context and make smart routing decisions based on content analysis.
|
||||
The Router block uses AI to intelligently decide which path your workflow should take next, routing workflow execution based on specific conditions or logic. Unlike Condition blocks that use simple rules, Router blocks can understand context and make smart routing decisions based on content analysis.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/router-light.png"
|
||||
darkSrc="/static/dark/router-dark.png"
|
||||
alt="Router Block with Multiple Paths"
|
||||
width={350}
|
||||
height={175}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/router.png"
|
||||
alt="Router Block with Multiple Paths"
|
||||
width={500}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -104,7 +105,7 @@ Choose an AI model to power the routing decision:
|
||||
**Local Models**: Any model running on Ollama
|
||||
|
||||
<div className="w-full max-w-2xl mx-auto overflow-hidden rounded-lg">
|
||||
<Video src="router-model-dropdown.mp4" />
|
||||
<Video src="router-model-dropdown.mp4" width={500} height={350} />
|
||||
</div>
|
||||
|
||||
**Recommendation**: Use models with strong reasoning capabilities like GPT-4o or Claude 3.7 Sonnet for more accurate routing decisions.
|
||||
@@ -117,9 +118,10 @@ Your API key for the selected LLM provider. This is securely stored and used for
|
||||
|
||||
After a router makes a decision, you can access its outputs:
|
||||
|
||||
- **`<router.content>`**: Summary of the routing decision made
|
||||
- **`<router.prompt>`**: Summary of the routing prompt used
|
||||
- **`<router.selected_path>`**: Details of the chosen destination block
|
||||
- **`<router.tokens>`**: Token usage statistics from the LLM
|
||||
- **`<router.cost>`**: Cost summary for the routing call (input, output, total)
|
||||
- **`<router.model>`**: The model used for decision-making
|
||||
|
||||
## Advanced Features
|
||||
@@ -135,34 +137,9 @@ Target Block 2: "Billing inquiries, subscription changes, payment issues"
|
||||
Target Block 3: "General questions, feedback, feature requests"
|
||||
```
|
||||
|
||||
### Multi-Model Routing
|
||||
|
||||
Use different models for different routing scenarios:
|
||||
|
||||
```javascript
|
||||
// Fast routing for simple cases
|
||||
Model: GPT-4o-mini
|
||||
Criteria: Simple, common routing patterns
|
||||
|
||||
// Complex routing for nuanced decisions
|
||||
Model: Claude 3.7 Sonnet
|
||||
Criteria: Complex content analysis required
|
||||
```
|
||||
|
||||
### Fallback Handling
|
||||
|
||||
Implement robust fallback mechanisms:
|
||||
|
||||
```javascript
|
||||
// Router configuration
|
||||
Primary Targets: ["Support", "Sales", "Technical"]
|
||||
Fallback Target: "General" // Default when no specific match
|
||||
Confidence Threshold: 0.7 // Minimum confidence for routing
|
||||
```
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables', 'Results']}>
|
||||
<Tabs items={['Configuration', 'Variables']}>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
@@ -182,7 +159,7 @@ Confidence Threshold: 0.7 // Minimum confidence for routing
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>router.content</strong>: Summary of routing decision
|
||||
<strong>router.prompt</strong>: Summary of routing prompt used
|
||||
</li>
|
||||
<li>
|
||||
<strong>router.selected_path</strong>: Details of chosen destination
|
||||
@@ -190,24 +167,14 @@ Confidence Threshold: 0.7 // Minimum confidence for routing
|
||||
<li>
|
||||
<strong>router.tokens</strong>: Token usage statistics
|
||||
</li>
|
||||
<li>
|
||||
<strong>router.cost</strong>: Cost summary for the routing call (input, output, total)
|
||||
</li>
|
||||
<li>
|
||||
<strong>router.model</strong>: Model used for decision-making
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>Routing Decision</strong>: Primary path selection result
|
||||
</li>
|
||||
<li>
|
||||
<strong>Decision Context</strong>: Analysis summary and reasoning
|
||||
</li>
|
||||
<li>
|
||||
<strong>Access</strong>: Available in blocks after the router
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Example Use Cases
|
||||
@@ -1,22 +1,23 @@
|
||||
---
|
||||
title: Workflow
|
||||
description: Execute other workflows as reusable components within your current workflow
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The Workflow block allows you to execute other workflows as reusable components within your current workflow. This powerful feature enables modular design, code reuse, and the creation of complex nested workflows that can be composed from smaller, focused workflows.
|
||||
The Workflow block allows you to execute other workflows as reusable components within your current workflow. This enables modular design, code reuse, and the creation of complex nested workflows that can be composed from smaller, focused workflows.
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/light/workflow-light.png"
|
||||
darkSrc="/static/dark/workflow-dark.png"
|
||||
alt="Workflow Block"
|
||||
width={300}
|
||||
height={175}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/blocks/workflow.png"
|
||||
alt="Workflow Block"
|
||||
width={500}
|
||||
height={350}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Callout type="info">
|
||||
Workflow blocks enable modular design by allowing you to compose complex workflows from smaller, reusable components.
|
||||
@@ -46,9 +47,9 @@ The Workflow block serves as a bridge between workflows, enabling you to:
|
||||
The Workflow block:
|
||||
|
||||
1. Takes a reference to another workflow in your workspace
|
||||
2. Passes input data from the current workflow to the child workflow
|
||||
2. Passes input data from the current workflow to the child workflow (available via start.input)
|
||||
3. Executes the child workflow in an isolated context
|
||||
4. Returns the results back to the parent workflow for further processing
|
||||
4. Returns the result back to the parent workflow for further processing
|
||||
|
||||
## Configuration Options
|
||||
|
||||
@@ -60,26 +61,6 @@ Choose which workflow to execute from a dropdown list of available workflows in
|
||||
- Workflows shared with you by other team members
|
||||
- Both enabled and disabled workflows (though only enabled workflows can be executed)
|
||||
|
||||
### Input Data
|
||||
|
||||
Define the data to pass to the child workflow:
|
||||
|
||||
- **Single Variable Input**: Select a variable or block output to pass to the child workflow
|
||||
- **Variable References**: Use `<variable.name>` to reference workflow variables
|
||||
- **Block References**: Use `<blockName.field>` to reference outputs from previous blocks
|
||||
- **Automatic Mapping**: The selected data is automatically available as `start.input` in the child workflow
|
||||
- **Optional**: The input field is optional - child workflows can run without input data
|
||||
- **Type Preservation**: Variable types (strings, numbers, objects, etc.) are preserved when passed to the child workflow
|
||||
|
||||
### Accessing Results
|
||||
|
||||
After a workflow executes, you can access its outputs:
|
||||
|
||||
- **`<workflow.response>`**: The complete output from the child workflow
|
||||
- **`<workflow.name>`**: The name of the executed child workflow
|
||||
- **`<workflow.success>`**: Boolean indicating successful completion
|
||||
- **`<workflow.error>`**: Error details if the workflow failed
|
||||
- **`<workflow.execution_time>`**: Time taken to execute the workflow
|
||||
|
||||
### Execution Context
|
||||
|
||||
@@ -88,58 +69,12 @@ The child workflow executes with:
|
||||
- Its own isolated execution context
|
||||
- Access to the same workspace resources (API keys, environment variables)
|
||||
- Proper workspace membership and permission checks
|
||||
- Independent logging and monitoring
|
||||
|
||||
## Safety and Limitations
|
||||
|
||||
To prevent infinite recursion and ensure system stability, the Workflow block includes several safety mechanisms:
|
||||
- Nested tracespan in the execution log
|
||||
|
||||
<Callout type="warning">
|
||||
**Cycle Detection**: The system automatically detects and prevents circular dependencies between workflows to avoid infinite loops.
|
||||
</Callout>
|
||||
|
||||
- **Maximum Depth Limit**: Nested workflows are limited to a maximum depth of 10 levels
|
||||
- **Cycle Detection**: Automatic detection and prevention of circular workflow dependencies
|
||||
- **Timeout Protection**: Child workflows inherit timeout settings to prevent indefinite execution
|
||||
- **Resource Limits**: Memory and execution time limits apply to prevent resource exhaustion
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Dynamic Workflow Selection
|
||||
|
||||
Select workflows dynamically based on runtime conditions:
|
||||
|
||||
```javascript
|
||||
// In a Function block before the Workflow block
|
||||
const workflowId = <condition.result> ? 'premium-workflow' : 'standard-workflow';
|
||||
return { selectedWorkflow: workflowId };
|
||||
```
|
||||
|
||||
### Error Handling and Fallbacks
|
||||
|
||||
Implement robust error handling for child workflows:
|
||||
|
||||
```javascript
|
||||
// In a Function block after the Workflow block
|
||||
if (!<workflow.success>) {
|
||||
console.error('Child workflow failed:', <workflow.error>);
|
||||
// Implement fallback logic
|
||||
return { fallback: true, error: <workflow.error> };
|
||||
}
|
||||
return <workflow.response>;
|
||||
```
|
||||
|
||||
### Workflow Chaining
|
||||
|
||||
Chain multiple workflows together:
|
||||
|
||||
```javascript
|
||||
// Pass output from one workflow to another
|
||||
Workflow 1 Input: <start.input>
|
||||
Workflow 2 Input: <workflow1.response>
|
||||
Workflow 3 Input: <workflow2.response>
|
||||
```
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
<Tabs items={['Configuration', 'Variables', 'Results']}>
|
||||
@@ -158,20 +93,17 @@ Workflow 3 Input: <workflow2.response>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<ul className="list-disc space-y-2 pl-6">
|
||||
<li>
|
||||
<strong>workflow.response</strong>: Complete output from child workflow
|
||||
</li>
|
||||
<li>
|
||||
<strong>workflow.name</strong>: Name of executed child workflow
|
||||
</li>
|
||||
<li>
|
||||
<strong>workflow.success</strong>: Boolean indicating completion status
|
||||
</li>
|
||||
<li>
|
||||
<strong>workflow.error</strong>: Error details if workflow failed
|
||||
<strong>workflow.childWorkflowName</strong>: Name of executed child workflow
|
||||
</li>
|
||||
<li>
|
||||
<strong>workflow.execution_time</strong>: Time taken to execute
|
||||
<strong>workflow.result</strong>: Result returned by the child workflow
|
||||
</li>
|
||||
<li>
|
||||
<strong>workflow.error</strong>: Error details if workflow failed
|
||||
</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
@@ -228,32 +160,10 @@ Workflow 3 Input: <workflow2.response>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
### Example: Customer Validation Workflow
|
||||
|
||||
```javascript title="validation-workflow.js"
|
||||
// Main workflow passes customer data to validation workflow
|
||||
const customerData = <start.input>;
|
||||
|
||||
// Validation workflow processes the data
|
||||
const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(customerData.email);
|
||||
const phoneValid = /^\+?[1-9]\d{1,14}$/.test(customerData.phone);
|
||||
|
||||
return {
|
||||
customer: customerData,
|
||||
validation: {
|
||||
email: emailValid,
|
||||
phone: phoneValid,
|
||||
overall: emailValid && phoneValid
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Keep workflows focused**: Design child workflows to handle specific, well-defined tasks with clear inputs and outputs
|
||||
- **Minimize nesting depth**: Avoid deeply nested workflow hierarchies for better maintainability and performance
|
||||
- **Handle errors gracefully**: Implement proper error handling for child workflow failures and provide fallback mechanisms
|
||||
- **Document dependencies**: Clearly document which workflows depend on others and maintain dependency maps
|
||||
- **Test independently**: Ensure child workflows can be tested and validated independently from parent workflows
|
||||
- **Monitor performance**: Be aware that nested workflows can impact overall execution time and resource usage
|
||||
- **Use semantic naming**: Give workflows descriptive names that clearly indicate their purpose and functionality
|
||||
44
apps/docs/content/docs/en/connections/basics.mdx
Normal file
44
apps/docs/content/docs/en/connections/basics.mdx
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: Connection Basics
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
|
||||
## How Connections Work
|
||||
|
||||
Connections are the pathways that allow data to flow between blocks in your workflow. In Sim, connections define how information passes from one block to another, enabling data flow throughout your workflow.
|
||||
|
||||
<Callout type="info">
|
||||
Each connection represents a directed relationship where data flows from a source block's output
|
||||
to a destination block's input.
|
||||
</Callout>
|
||||
|
||||
### Creating Connections
|
||||
|
||||
<Steps>
|
||||
<Step>
|
||||
<strong>Select Source Block</strong>: Click on the output port of the block you want to connect
|
||||
from
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Draw Connection</strong>: Drag to the input port of the destination block
|
||||
</Step>
|
||||
<Step>
|
||||
<strong>Confirm Connection</strong>: Release to create the connection
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### Connection Flow
|
||||
|
||||
The flow of data through connections follows these principles:
|
||||
|
||||
1. **Directional Flow**: Data always flows from outputs to inputs
|
||||
2. **Execution Order**: Blocks execute in order based on their connections
|
||||
3. **Data Transformation**: Data may be transformed as it passes between blocks
|
||||
4. **Conditional Paths**: Some blocks (like Router and Condition) can direct flow to different paths
|
||||
|
||||
<Callout type="warning">
|
||||
Deleting a connection will immediately stop data flow between the blocks. Make sure this is
|
||||
intended before removing connections.
|
||||
</Callout>
|
||||
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: Connection Data Structure
|
||||
description: Understanding the data structure of different block outputs
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
|
||||
When you connect blocks, the output data structure from the source block determines what values are available in the destination block. Each block type produces a specific output structure that you can reference in downstream blocks.
|
||||
When you connect blocks, understanding the data structure of different block outputs is important because the output data structure from the source block determines what values are available in the destination block. Each block type produces a specific output structure that you can reference in downstream blocks.
|
||||
|
||||
<Callout type="info">
|
||||
Understanding these data structures is essential for effectively using connection tags and
|
||||
@@ -180,7 +179,7 @@ Some blocks may produce custom output structures based on their configuration:
|
||||
Many block outputs contain nested data structures. You can access these using dot notation in connection tags:
|
||||
|
||||
```
|
||||
<blockId.path.to.nested.data>
|
||||
<blockName.path.to.nested.data>
|
||||
```
|
||||
|
||||
For example:
|
||||
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: Connection Tags
|
||||
description: Using connection tags to reference data between blocks
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
Connection tags are visual representations of the data available from connected blocks. They provide an easy way to reference outputs from previous blocks in your workflow.
|
||||
Connection tags are visual representations of the data available from connected blocks, providing an easy way to reference data between blocks and outputs from previous blocks in your workflow.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="connections.mp4" />
|
||||
@@ -66,12 +65,12 @@ There are two primary ways to use connection tags in your workflows:
|
||||
Connection tags use a simple syntax to reference data:
|
||||
|
||||
```
|
||||
<blockId.path.to.data>
|
||||
<blockName.path.to.data>
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `blockId` is the identifier of the source block
|
||||
- `blockName` is the name of the source block
|
||||
- `path.to.data` is the path to the specific data field
|
||||
|
||||
For example:
|
||||
162
apps/docs/content/docs/en/copilot/index.mdx
Normal file
162
apps/docs/content/docs/en/copilot/index.mdx
Normal file
@@ -0,0 +1,162 @@
|
||||
---
|
||||
title: Copilot
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { MessageCircle, Package, Zap, Infinity as InfinityIcon, Brain, BrainCircuit } from 'lucide-react'
|
||||
|
||||
Copilot is your in-editor assistant that helps you build and edit workflows with Sim Copilot, as well as understand and improve them. It can:
|
||||
|
||||
- **Explain**: Answer questions about Sim and your current workflow
|
||||
- **Guide**: Suggest edits and best practices
|
||||
- **Edit**: Make changes to blocks, connections, and settings when you approve
|
||||
|
||||
<Callout type="info">
|
||||
Copilot is a Sim-managed service. For self-hosted deployments, generate a Copilot API key in the hosted app (sim.ai → Settings → Copilot)
|
||||
1. Go to [sim.ai](https://sim.ai) → Settings → Copilot and generate a Copilot API key
|
||||
2. Set `COPILOT_API_KEY` in your self-hosted environment to that value
|
||||
</Callout>
|
||||
|
||||
## Context Menu (@)
|
||||
|
||||
Use the `@` symbol to reference various resources and give Copilot more context about your workspace:
|
||||
|
||||
<Image
|
||||
src="/static/copilot/copilot-menu.png"
|
||||
alt="Copilot context menu showing available reference options"
|
||||
width={600}
|
||||
height={400}
|
||||
/>
|
||||
|
||||
The `@` menu provides access to:
|
||||
- **Chats**: Reference previous copilot conversations
|
||||
- **All workflows**: Reference any workflow in your workspace
|
||||
- **Workflow Blocks**: Reference specific blocks from workflows
|
||||
- **Blocks**: Reference block types and templates
|
||||
- **Knowledge**: Reference your uploaded documents and knowledgebase
|
||||
- **Docs**: Reference Sim documentation
|
||||
- **Templates**: Reference workflow templates
|
||||
- **Logs**: Reference execution logs and results
|
||||
|
||||
This contextual information helps Copilot provide more accurate and relevant assistance for your specific use case.
|
||||
|
||||
## Modes
|
||||
|
||||
<Cards>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<MessageCircle className="h-4 w-4 text-muted-foreground" />
|
||||
Ask
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">
|
||||
Q&A mode for explanations, guidance, and suggestions without making changes to your workflow.
|
||||
</div>
|
||||
</Card>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<Package className="h-4 w-4 text-muted-foreground" />
|
||||
Agent
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">
|
||||
Build-and-edit mode. Copilot proposes specific edits (add blocks, wire variables, tweak settings) and applies them when you approve.
|
||||
</div>
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Depth Levels
|
||||
|
||||
<Cards>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<Zap className="h-4 w-4 text-muted-foreground" />
|
||||
Fast
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">Quickest and cheapest. Best for small edits, simple workflows, and minor tweaks.</div>
|
||||
</Card>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<InfinityIcon className="h-4 w-4 text-muted-foreground" />
|
||||
Auto
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">Balanced speed and reasoning. Recommended default for most tasks.</div>
|
||||
</Card>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<Brain className="h-4 w-4 text-muted-foreground" />
|
||||
Advanced
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">More reasoning for larger workflows and complex edits while staying performant.</div>
|
||||
</Card>
|
||||
<Card
|
||||
title={
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<BrainCircuit className="h-4 w-4 text-muted-foreground" />
|
||||
Behemoth
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="m-0 text-sm">Maximum reasoning for deep planning, debugging, and complex architectural changes.</div>
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
### Mode Selection Interface
|
||||
|
||||
You can easily switch between different reasoning modes using the mode selector in the Copilot interface:
|
||||
|
||||
<Image
|
||||
src="/static/copilot/copilot-models.png"
|
||||
alt="Copilot mode selection showing Advanced mode with MAX toggle"
|
||||
width={600}
|
||||
height={300}
|
||||
/>
|
||||
|
||||
The interface allows you to:
|
||||
- **Select reasoning level**: Choose from Fast, Auto, Advanced, or Behemoth
|
||||
- **Enable MAX mode**: Toggle for maximum reasoning capabilities when you need the most thorough analysis
|
||||
- **See mode descriptions**: Understand what each mode is optimized for
|
||||
|
||||
Choose your mode based on the complexity of your task - use Fast for simple questions and Behemoth for complex architectural changes.
|
||||
|
||||
## Billing and Cost Calculation
|
||||
|
||||
### How Costs Are Calculated
|
||||
|
||||
Copilot usage is billed per token from the underlying LLM:
|
||||
|
||||
- **Input tokens**: billed at the provider's base rate (**at-cost**)
|
||||
- **Output tokens**: billed at **1.5×** the provider's base output rate
|
||||
|
||||
```javascript
|
||||
copilotCost = (inputTokens × inputPrice + outputTokens × (outputPrice × 1.5)) / 1,000,000
|
||||
```
|
||||
|
||||
| Component | Rate Applied |
|
||||
|----------|----------------------|
|
||||
| Input | inputPrice |
|
||||
| Output | outputPrice × 1.5 |
|
||||
|
||||
<Callout type="warning">
|
||||
Pricing shown reflects rates as of September 4, 2025. Check provider documentation for current pricing.
|
||||
</Callout>
|
||||
|
||||
<Callout type="info">
|
||||
Model prices are per million tokens. The calculation divides by 1,000,000 to get the actual cost. See <a href="/execution/costs">the Cost Calculation page</a> for background and examples.
|
||||
</Callout>
|
||||
|
||||
536
apps/docs/content/docs/en/execution/api.mdx
Normal file
536
apps/docs/content/docs/en/execution/api.mdx
Normal file
@@ -0,0 +1,536 @@
|
||||
---
|
||||
title: External API
|
||||
---
|
||||
|
||||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { CodeBlock } from 'fumadocs-ui/components/codeblock'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
Sim provides a comprehensive external API for querying workflow execution logs and setting up webhooks for real-time notifications when workflows complete.
|
||||
|
||||
## Authentication
|
||||
|
||||
All API requests require an API key passed in the `x-api-key` header:
|
||||
|
||||
```bash
|
||||
curl -H "x-api-key: YOUR_API_KEY" \
|
||||
https://sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID
|
||||
```
|
||||
|
||||
You can generate API keys from your user settings in the Sim dashboard.
|
||||
|
||||
## Logs API
|
||||
|
||||
All API responses include information about your workflow execution limits and usage:
|
||||
|
||||
```json
|
||||
"limits": {
|
||||
"workflowExecutionRateLimit": {
|
||||
"sync": {
|
||||
"limit": 60, // Max sync workflow executions per minute
|
||||
"remaining": 58, // Remaining sync workflow executions
|
||||
"resetAt": "..." // When the window resets
|
||||
},
|
||||
"async": {
|
||||
"limit": 60, // Max async workflow executions per minute
|
||||
"remaining": 59, // Remaining async workflow executions
|
||||
"resetAt": "..." // When the window resets
|
||||
}
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": 1.234, // Current billing period usage in USD
|
||||
"limit": 10, // Usage limit in USD
|
||||
"plan": "pro", // Current subscription plan
|
||||
"isExceeded": false // Whether limit is exceeded
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** The rate limits in the response body are for workflow executions. The rate limits for calling this API endpoint are in the response headers (`X-RateLimit-*`).
|
||||
|
||||
### Query Logs
|
||||
|
||||
Query workflow execution logs with extensive filtering options.
|
||||
|
||||
<Tabs items={['Request', 'Response']}>
|
||||
<Tab value="Request">
|
||||
```http
|
||||
GET /api/v1/logs
|
||||
```
|
||||
|
||||
**Required Parameters:**
|
||||
- `workspaceId` - Your workspace ID
|
||||
|
||||
**Optional Filters:**
|
||||
- `workflowIds` - Comma-separated workflow IDs
|
||||
- `folderIds` - Comma-separated folder IDs
|
||||
- `triggers` - Comma-separated trigger types: `api`, `webhook`, `schedule`, `manual`, `chat`
|
||||
- `level` - Filter by level: `info`, `error`
|
||||
- `startDate` - ISO timestamp for date range start
|
||||
- `endDate` - ISO timestamp for date range end
|
||||
- `executionId` - Exact execution ID match
|
||||
- `minDurationMs` - Minimum execution duration in milliseconds
|
||||
- `maxDurationMs` - Maximum execution duration in milliseconds
|
||||
- `minCost` - Minimum execution cost
|
||||
- `maxCost` - Maximum execution cost
|
||||
- `model` - Filter by AI model used
|
||||
|
||||
**Pagination:**
|
||||
- `limit` - Results per page (default: 100)
|
||||
- `cursor` - Cursor for next page
|
||||
- `order` - Sort order: `desc`, `asc` (default: desc)
|
||||
|
||||
**Detail Level:**
|
||||
- `details` - Response detail level: `basic`, `full` (default: basic)
|
||||
- `includeTraceSpans` - Include trace spans (default: false)
|
||||
- `includeFinalOutput` - Include final output (default: false)
|
||||
</Tab>
|
||||
<Tab value="Response">
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "log_abc123",
|
||||
"workflowId": "wf_xyz789",
|
||||
"executionId": "exec_def456",
|
||||
"level": "info",
|
||||
"trigger": "api",
|
||||
"startedAt": "2025-01-01T12:34:56.789Z",
|
||||
"endedAt": "2025-01-01T12:34:57.123Z",
|
||||
"totalDurationMs": 334,
|
||||
"cost": {
|
||||
"total": 0.00234
|
||||
},
|
||||
"files": null
|
||||
}
|
||||
],
|
||||
"nextCursor": "eyJzIjoiMjAyNS0wMS0wMVQxMjozNDo1Ni43ODlaIiwiaWQiOiJsb2dfYWJjMTIzIn0",
|
||||
"limits": {
|
||||
"workflowExecutionRateLimit": {
|
||||
"sync": {
|
||||
"limit": 60,
|
||||
"remaining": 58,
|
||||
"resetAt": "2025-01-01T12:35:56.789Z"
|
||||
},
|
||||
"async": {
|
||||
"limit": 60,
|
||||
"remaining": 59,
|
||||
"resetAt": "2025-01-01T12:35:56.789Z"
|
||||
}
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": 1.234,
|
||||
"limit": 10,
|
||||
"plan": "pro",
|
||||
"isExceeded": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Get Log Details
|
||||
|
||||
Retrieve detailed information about a specific log entry.
|
||||
|
||||
<Tabs items={['Request', 'Response']}>
|
||||
<Tab value="Request">
|
||||
```http
|
||||
GET /api/v1/logs/{id}
|
||||
```
|
||||
</Tab>
|
||||
<Tab value="Response">
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"id": "log_abc123",
|
||||
"workflowId": "wf_xyz789",
|
||||
"executionId": "exec_def456",
|
||||
"level": "info",
|
||||
"trigger": "api",
|
||||
"startedAt": "2025-01-01T12:34:56.789Z",
|
||||
"endedAt": "2025-01-01T12:34:57.123Z",
|
||||
"totalDurationMs": 334,
|
||||
"workflow": {
|
||||
"id": "wf_xyz789",
|
||||
"name": "My Workflow",
|
||||
"description": "Process customer data"
|
||||
},
|
||||
"executionData": {
|
||||
"traceSpans": [...],
|
||||
"finalOutput": {...}
|
||||
},
|
||||
"cost": {
|
||||
"total": 0.00234,
|
||||
"tokens": {
|
||||
"prompt": 123,
|
||||
"completion": 456,
|
||||
"total": 579
|
||||
},
|
||||
"models": {
|
||||
"gpt-4o": {
|
||||
"input": 0.001,
|
||||
"output": 0.00134,
|
||||
"total": 0.00234,
|
||||
"tokens": {
|
||||
"prompt": 123,
|
||||
"completion": 456,
|
||||
"total": 579
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"limits": {
|
||||
"workflowExecutionRateLimit": {
|
||||
"sync": {
|
||||
"limit": 60,
|
||||
"remaining": 58,
|
||||
"resetAt": "2025-01-01T12:35:56.789Z"
|
||||
},
|
||||
"async": {
|
||||
"limit": 60,
|
||||
"remaining": 59,
|
||||
"resetAt": "2025-01-01T12:35:56.789Z"
|
||||
}
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": 1.234,
|
||||
"limit": 10,
|
||||
"plan": "pro",
|
||||
"isExceeded": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Get Execution Details
|
||||
|
||||
Retrieve execution details including the workflow state snapshot.
|
||||
|
||||
<Tabs items={['Request', 'Response']}>
|
||||
<Tab value="Request">
|
||||
```http
|
||||
GET /api/v1/logs/executions/{executionId}
|
||||
```
|
||||
</Tab>
|
||||
<Tab value="Response">
|
||||
```json
|
||||
{
|
||||
"executionId": "exec_def456",
|
||||
"workflowId": "wf_xyz789",
|
||||
"workflowState": {
|
||||
"blocks": {...},
|
||||
"edges": [...],
|
||||
"loops": {...},
|
||||
"parallels": {...}
|
||||
},
|
||||
"executionMetadata": {
|
||||
"trigger": "api",
|
||||
"startedAt": "2025-01-01T12:34:56.789Z",
|
||||
"endedAt": "2025-01-01T12:34:57.123Z",
|
||||
"totalDurationMs": 334,
|
||||
"cost": {...}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Webhook Subscriptions
|
||||
|
||||
Get real-time notifications when workflow executions complete. Webhooks are configured through the Sim UI in the workflow editor.
|
||||
|
||||
### Configuration
|
||||
|
||||
Webhooks can be configured for each workflow through the workflow editor UI. Click the webhook icon in the control bar to set up your webhook subscriptions.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="configure-webhook.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
**Available Configuration Options:**
|
||||
- `url`: Your webhook endpoint URL
|
||||
- `secret`: Optional secret for HMAC signature verification
|
||||
- `includeFinalOutput`: Include the workflow's final output in the payload
|
||||
- `includeTraceSpans`: Include detailed execution trace spans
|
||||
- `includeRateLimits`: Include the workflow owner's rate limit information
|
||||
- `includeUsageData`: Include the workflow owner's usage and billing data
|
||||
- `levelFilter`: Array of log levels to receive (`info`, `error`)
|
||||
- `triggerFilter`: Array of trigger types to receive (`api`, `webhook`, `schedule`, `manual`, `chat`)
|
||||
- `active`: Enable/disable the webhook subscription
|
||||
|
||||
### Webhook Payload
|
||||
|
||||
When a workflow execution completes, Sim sends a POST request to your webhook URL:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "evt_123",
|
||||
"type": "workflow.execution.completed",
|
||||
"timestamp": 1735925767890,
|
||||
"data": {
|
||||
"workflowId": "wf_xyz789",
|
||||
"executionId": "exec_def456",
|
||||
"status": "success",
|
||||
"level": "info",
|
||||
"trigger": "api",
|
||||
"startedAt": "2025-01-01T12:34:56.789Z",
|
||||
"endedAt": "2025-01-01T12:34:57.123Z",
|
||||
"totalDurationMs": 334,
|
||||
"cost": {
|
||||
"total": 0.00234,
|
||||
"tokens": {
|
||||
"prompt": 123,
|
||||
"completion": 456,
|
||||
"total": 579
|
||||
},
|
||||
"models": {
|
||||
"gpt-4o": {
|
||||
"input": 0.001,
|
||||
"output": 0.00134,
|
||||
"total": 0.00234,
|
||||
"tokens": {
|
||||
"prompt": 123,
|
||||
"completion": 456,
|
||||
"total": 579
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": null,
|
||||
"finalOutput": {...}, // Only if includeFinalOutput=true
|
||||
"traceSpans": [...], // Only if includeTraceSpans=true
|
||||
"rateLimits": {...}, // Only if includeRateLimits=true
|
||||
"usage": {...} // Only if includeUsageData=true
|
||||
},
|
||||
"links": {
|
||||
"log": "/v1/logs/log_abc123",
|
||||
"execution": "/v1/logs/executions/exec_def456"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Webhook Headers
|
||||
|
||||
Each webhook request includes these headers:
|
||||
|
||||
- `sim-event`: Event type (always `workflow.execution.completed`)
|
||||
- `sim-timestamp`: Unix timestamp in milliseconds
|
||||
- `sim-delivery-id`: Unique delivery ID for idempotency
|
||||
- `sim-signature`: HMAC-SHA256 signature for verification (if secret configured)
|
||||
- `Idempotency-Key`: Same as delivery ID for duplicate detection
|
||||
|
||||
### Signature Verification
|
||||
|
||||
If you configure a webhook secret, verify the signature to ensure the webhook is from Sim:
|
||||
|
||||
<Tabs items={['Node.js', 'Python']}>
|
||||
<Tab value="Node.js">
|
||||
```javascript
|
||||
import crypto from 'crypto';
|
||||
|
||||
function verifyWebhookSignature(body, signature, secret) {
|
||||
const [timestampPart, signaturePart] = signature.split(',');
|
||||
const timestamp = timestampPart.replace('t=', '');
|
||||
const expectedSignature = signaturePart.replace('v1=', '');
|
||||
|
||||
const signatureBase = `${timestamp}.${body}`;
|
||||
const hmac = crypto.createHmac('sha256', secret);
|
||||
hmac.update(signatureBase);
|
||||
const computedSignature = hmac.digest('hex');
|
||||
|
||||
return computedSignature === expectedSignature;
|
||||
}
|
||||
|
||||
// In your webhook handler
|
||||
app.post('/webhook', (req, res) => {
|
||||
const signature = req.headers['sim-signature'];
|
||||
const body = JSON.stringify(req.body);
|
||||
|
||||
if (!verifyWebhookSignature(body, signature, process.env.WEBHOOK_SECRET)) {
|
||||
return res.status(401).send('Invalid signature');
|
||||
}
|
||||
|
||||
// Process the webhook...
|
||||
});
|
||||
```
|
||||
</Tab>
|
||||
<Tab value="Python">
|
||||
```python
|
||||
import hmac
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
def verify_webhook_signature(body: str, signature: str, secret: str) -> bool:
|
||||
timestamp_part, signature_part = signature.split(',')
|
||||
timestamp = timestamp_part.replace('t=', '')
|
||||
expected_signature = signature_part.replace('v1=', '')
|
||||
|
||||
signature_base = f"{timestamp}.{body}"
|
||||
computed_signature = hmac.new(
|
||||
secret.encode(),
|
||||
signature_base.encode(),
|
||||
hashlib.sha256
|
||||
).hexdigest()
|
||||
|
||||
return hmac.compare_digest(computed_signature, expected_signature)
|
||||
|
||||
# In your webhook handler
|
||||
@app.route('/webhook', methods=['POST'])
|
||||
def webhook():
|
||||
signature = request.headers.get('sim-signature')
|
||||
body = json.dumps(request.json)
|
||||
|
||||
if not verify_webhook_signature(body, signature, os.environ['WEBHOOK_SECRET']):
|
||||
return 'Invalid signature', 401
|
||||
|
||||
# Process the webhook...
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Retry Policy
|
||||
|
||||
Failed webhook deliveries are retried with exponential backoff and jitter:
|
||||
|
||||
- Maximum attempts: 5
|
||||
- Retry delays: 5 seconds, 15 seconds, 1 minute, 3 minutes, 10 minutes
|
||||
- Jitter: Up to 10% additional delay to prevent thundering herd
|
||||
- Only HTTP 5xx and 429 responses trigger retries
|
||||
- Deliveries timeout after 30 seconds
|
||||
|
||||
<Callout type="info">
|
||||
Webhook deliveries are processed asynchronously and don't affect workflow execution performance.
|
||||
</Callout>
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Polling Strategy**: When polling for logs, use cursor-based pagination with `order=asc` and `startDate` to fetch new logs efficiently.
|
||||
|
||||
2. **Webhook Security**: Always configure a webhook secret and verify signatures to ensure requests are from Sim.
|
||||
|
||||
3. **Idempotency**: Use the `Idempotency-Key` header to detect and handle duplicate webhook deliveries.
|
||||
|
||||
4. **Privacy**: By default, `finalOutput` and `traceSpans` are excluded from responses. Only enable these if you need the data and understand the privacy implications.
|
||||
|
||||
5. **Rate Limiting**: Implement exponential backoff when you receive 429 responses. Check the `Retry-After` header for the recommended wait time.
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
The API implements rate limiting to ensure fair usage:
|
||||
|
||||
- **Free plan**: 10 requests per minute
|
||||
- **Pro plan**: 30 requests per minute
|
||||
- **Team plan**: 60 requests per minute
|
||||
- **Enterprise plan**: Custom limits
|
||||
|
||||
Rate limit information is included in response headers:
|
||||
- `X-RateLimit-Limit`: Maximum requests per window
|
||||
- `X-RateLimit-Remaining`: Requests remaining in current window
|
||||
- `X-RateLimit-Reset`: ISO timestamp when the window resets
|
||||
|
||||
## Example: Polling for New Logs
|
||||
|
||||
```javascript
|
||||
let cursor = null;
|
||||
const workspaceId = 'YOUR_WORKSPACE_ID';
|
||||
const startDate = new Date().toISOString();
|
||||
|
||||
async function pollLogs() {
|
||||
const params = new URLSearchParams({
|
||||
workspaceId,
|
||||
startDate,
|
||||
order: 'asc',
|
||||
limit: '100'
|
||||
});
|
||||
|
||||
if (cursor) {
|
||||
params.append('cursor', cursor);
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
`https://sim.ai/api/v1/logs?${params}`,
|
||||
{
|
||||
headers: {
|
||||
'x-api-key': 'YOUR_API_KEY'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
|
||||
// Process new logs
|
||||
for (const log of data.data) {
|
||||
console.log(`New execution: ${log.executionId}`);
|
||||
}
|
||||
|
||||
// Update cursor for next poll
|
||||
if (data.nextCursor) {
|
||||
cursor = data.nextCursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Poll every 30 seconds
|
||||
setInterval(pollLogs, 30000);
|
||||
```
|
||||
|
||||
## Example: Processing Webhooks
|
||||
|
||||
```javascript
|
||||
import express from 'express';
|
||||
import crypto from 'crypto';
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
app.post('/sim-webhook', (req, res) => {
|
||||
// Verify signature
|
||||
const signature = req.headers['sim-signature'];
|
||||
const body = JSON.stringify(req.body);
|
||||
|
||||
if (!verifyWebhookSignature(body, signature, process.env.WEBHOOK_SECRET)) {
|
||||
return res.status(401).send('Invalid signature');
|
||||
}
|
||||
|
||||
// Check timestamp to prevent replay attacks
|
||||
const timestamp = parseInt(req.headers['sim-timestamp']);
|
||||
const fiveMinutesAgo = Date.now() - (5 * 60 * 1000);
|
||||
|
||||
if (timestamp < fiveMinutesAgo) {
|
||||
return res.status(401).send('Timestamp too old');
|
||||
}
|
||||
|
||||
// Process the webhook
|
||||
const event = req.body;
|
||||
|
||||
switch (event.type) {
|
||||
case 'workflow.execution.completed':
|
||||
const { workflowId, executionId, status, cost } = event.data;
|
||||
|
||||
if (status === 'error') {
|
||||
console.error(`Workflow ${workflowId} failed: ${executionId}`);
|
||||
// Handle error...
|
||||
} else {
|
||||
console.log(`Workflow ${workflowId} completed: ${executionId}`);
|
||||
console.log(`Cost: $${cost.total}`);
|
||||
// Process successful execution...
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Return 200 to acknowledge receipt
|
||||
res.status(200).send('OK');
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Webhook server listening on port 3000');
|
||||
});
|
||||
```
|
||||
132
apps/docs/content/docs/en/execution/basics.mdx
Normal file
132
apps/docs/content/docs/en/execution/basics.mdx
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Execution Basics
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Image } from '@/components/ui/image'
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
Understanding how workflows execute in Sim is key to building efficient and reliable automations. The execution engine automatically handles dependencies, concurrency, and data flow to ensure your workflows run smoothly and predictably.
|
||||
|
||||
## How Workflows Execute
|
||||
|
||||
Sim's execution engine processes workflows intelligently by analyzing dependencies and running blocks in the most efficient order possible.
|
||||
|
||||
### Concurrent Execution by Default
|
||||
|
||||
Multiple blocks run concurrently when they don't depend on each other. This parallel execution dramatically improves performance without requiring manual configuration.
|
||||
|
||||
<Image
|
||||
src="/static/execution/concurrency.png"
|
||||
alt="Multiple blocks running concurrently after the Start block"
|
||||
width={800}
|
||||
height={500}
|
||||
/>
|
||||
|
||||
In this example, both the Customer Support and Deep Researcher agent blocks execute simultaneously after the Start block, maximizing efficiency.
|
||||
|
||||
### Automatic Output Combination
|
||||
|
||||
When blocks have multiple dependencies, the execution engine automatically waits for all dependencies to complete, then provides their combined outputs to the next block. No manual combining required.
|
||||
|
||||
<Image
|
||||
src="/static/execution/combination.png"
|
||||
alt="Function block automatically receiving outputs from multiple previous blocks"
|
||||
width={800}
|
||||
height={500}
|
||||
/>
|
||||
|
||||
The Function block receives outputs from both agent blocks as soon as they complete, allowing you to process the combined results.
|
||||
|
||||
### Smart Routing
|
||||
|
||||
Workflows can branch in multiple directions using routing blocks. The execution engine supports both deterministic routing (with Condition blocks) and AI-powered routing (with Router blocks).
|
||||
|
||||
<Image
|
||||
src="/static/execution/routing.png"
|
||||
alt="Workflow showing both conditional and router-based branching"
|
||||
width={800}
|
||||
height={500}
|
||||
/>
|
||||
|
||||
This workflow demonstrates how execution can follow different paths based on conditions or AI decisions, with each path executing independently.
|
||||
|
||||
## Block Types
|
||||
|
||||
Sim provides different types of blocks that serve specific purposes in your workflows:
|
||||
|
||||
<Cards>
|
||||
<Card title="Triggers" href="/triggers">
|
||||
**Starter blocks** initiate workflows and **Webhook blocks** respond to external events. Every workflow needs a trigger to begin execution.
|
||||
</Card>
|
||||
|
||||
<Card title="Processing Blocks" href="/blocks">
|
||||
**Agent blocks** interact with AI models, **Function blocks** run custom code, and **API blocks** connect to external services. These blocks transform and process your data.
|
||||
</Card>
|
||||
|
||||
<Card title="Control Flow" href="/blocks">
|
||||
**Router blocks** use AI to choose paths, **Condition blocks** branch based on logic, and **Loop/Parallel blocks** handle iterations and concurrency.
|
||||
</Card>
|
||||
|
||||
<Card title="Output & Response" href="/blocks">
|
||||
**Response blocks** format final outputs for APIs and chat interfaces, returning structured results from your workflows.
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
All blocks execute automatically based on their dependencies - you don't need to manually manage execution order or timing.
|
||||
|
||||
## Execution Triggers
|
||||
|
||||
Workflows can be triggered in several ways, depending on your use case:
|
||||
|
||||
### Manual Testing
|
||||
Click "Run" in the workflow editor to test your workflow during development. Perfect for debugging and validation.
|
||||
|
||||
### Scheduled Execution
|
||||
Set up recurring executions using cron expressions. Great for regular data processing, reports, or maintenance tasks.
|
||||
|
||||
### API Deployment
|
||||
Deploy workflows as HTTP endpoints that can be called programmatically from your applications.
|
||||
|
||||
### Webhook Integration
|
||||
Respond to events from external services like GitHub, Stripe, or custom systems in real-time.
|
||||
|
||||
### Chat Interface
|
||||
Create conversational interfaces hosted on custom subdomains for user-facing AI applications.
|
||||
|
||||
<Callout type="info">
|
||||
Learn more about each trigger type in the [Triggers section](/triggers) of the documentation.
|
||||
</Callout>
|
||||
|
||||
## Execution Monitoring
|
||||
|
||||
When workflows run, Sim provides real-time visibility into the execution process:
|
||||
|
||||
- **Live Block States**: See which blocks are currently executing, completed, or failed
|
||||
- **Execution Logs**: Detailed logs appear in real-time showing inputs, outputs, and any errors
|
||||
- **Performance Metrics**: Track execution time and costs for each block
|
||||
- **Path Visualization**: Understand which execution paths were taken through your workflow
|
||||
|
||||
<Callout type="info">
|
||||
All execution details are captured and available for review even after workflows complete, helping with debugging and optimization.
|
||||
</Callout>
|
||||
|
||||
## Key Execution Principles
|
||||
|
||||
Understanding these core principles will help you build better workflows:
|
||||
|
||||
1. **Dependency-Based Execution**: Blocks only run when all their dependencies have completed
|
||||
2. **Automatic Parallelization**: Independent blocks run concurrently without configuration
|
||||
3. **Smart Data Flow**: Outputs flow automatically to connected blocks
|
||||
4. **Error Handling**: Failed blocks stop their execution path but don't affect independent paths
|
||||
5. **State Persistence**: All block outputs and execution details are preserved for debugging
|
||||
|
||||
## Next Steps
|
||||
|
||||
Now that you understand execution basics, explore:
|
||||
- **[Block Types](/blocks)** - Learn about specific block capabilities
|
||||
- **[Logging](/execution/logging)** - Monitor workflow executions and debug issues
|
||||
- **[Cost Calculation](/execution/costs)** - Understand and optimize workflow costs
|
||||
- **[Triggers](/triggers)** - Set up different ways to run your workflows
|
||||
182
apps/docs/content/docs/en/execution/costs.mdx
Normal file
182
apps/docs/content/docs/en/execution/costs.mdx
Normal file
@@ -0,0 +1,182 @@
|
||||
---
|
||||
title: Cost Calculation
|
||||
---
|
||||
|
||||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
Sim automatically calculates costs for all workflow executions, providing transparent pricing based on AI model usage and execution charges. Understanding these costs helps you optimize workflows and manage your budget effectively.
|
||||
|
||||
## How Costs Are Calculated
|
||||
|
||||
Every workflow execution includes two cost components:
|
||||
|
||||
**Base Execution Charge**: $0.001 per execution
|
||||
|
||||
**AI Model Usage**: Variable cost based on token consumption
|
||||
```javascript
|
||||
modelCost = (inputTokens × inputPrice + outputTokens × outputPrice) / 1,000,000
|
||||
totalCost = baseExecutionCharge + modelCost
|
||||
```
|
||||
|
||||
<Callout type="info">
|
||||
AI model prices are per million tokens. The calculation divides by 1,000,000 to get the actual cost. Workflows without AI blocks only incur the base execution charge.
|
||||
</Callout>
|
||||
|
||||
## Model Breakdown in Logs
|
||||
|
||||
For workflows using AI blocks, you can view detailed cost information in the logs:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/logs/logs-cost.png"
|
||||
alt="Model Breakdown"
|
||||
width={600}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
The model breakdown shows:
|
||||
- **Token Usage**: Input and output token counts for each model
|
||||
- **Cost Breakdown**: Individual costs per model and operation
|
||||
- **Model Distribution**: Which models were used and how many times
|
||||
- **Total Cost**: Aggregate cost for the entire workflow execution
|
||||
|
||||
## Pricing Options
|
||||
|
||||
<Tabs items={['Hosted Models', 'Bring Your Own API Key']}>
|
||||
<Tab>
|
||||
**Hosted Models** - Sim provides API keys with a 2.5x pricing multiplier:
|
||||
|
||||
| Model | Base Price (Input/Output) | Hosted Price (Input/Output) |
|
||||
|-------|---------------------------|----------------------------|
|
||||
| GPT-4o | $2.50 / $10.00 | $6.25 / $25.00 |
|
||||
| GPT-4.1 | $2.00 / $8.00 | $5.00 / $20.00 |
|
||||
| o1 | $15.00 / $60.00 | $37.50 / $150.00 |
|
||||
| o3 | $2.00 / $8.00 | $5.00 / $20.00 |
|
||||
| Claude 3.5 Sonnet | $3.00 / $15.00 | $7.50 / $37.50 |
|
||||
| Claude Opus 4.0 | $15.00 / $75.00 | $37.50 / $187.50 |
|
||||
|
||||
*The 2.5x multiplier covers infrastructure and API management costs.*
|
||||
</Tab>
|
||||
|
||||
<Tab>
|
||||
**Your Own API Keys** - Use any model at base pricing:
|
||||
|
||||
| Provider | Models | Input / Output |
|
||||
|----------|---------|----------------|
|
||||
| Google | Gemini 2.5 | $0.15 / $0.60 |
|
||||
| Deepseek | V3, R1 | $0.75 / $1.00 |
|
||||
| xAI | Grok 4, Grok 3 | $5.00 / $25.00 |
|
||||
| Groq | Llama 4 Scout | $0.40 / $0.60 |
|
||||
| Cerebras | Llama 3.3 70B | $0.94 / $0.94 |
|
||||
| Ollama | Local models | Free |
|
||||
|
||||
*Pay providers directly with no markup*
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Callout type="warning">
|
||||
Pricing shown reflects rates as of September 10, 2025. Check provider documentation for current pricing.
|
||||
</Callout>
|
||||
|
||||
## Cost Optimization Strategies
|
||||
|
||||
<Accordions>
|
||||
<Accordion title="Model Selection">
|
||||
Choose models based on task complexity. Simple tasks can use GPT-4.1-nano ($0.10/$0.40) while complex reasoning might need o1 or Claude Opus.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Prompt Engineering">
|
||||
Well-structured, concise prompts reduce token usage without sacrificing quality.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Local Models">
|
||||
Use Ollama for non-critical tasks to eliminate API costs entirely.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Caching and Reuse">
|
||||
Store frequently used results in variables or files to avoid repeated AI model calls.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Batch Processing">
|
||||
Process multiple items in a single AI request rather than making individual calls.
|
||||
</Accordion>
|
||||
</Accordions>
|
||||
|
||||
## Usage Monitoring
|
||||
|
||||
Monitor your usage and billing in Settings → Subscription:
|
||||
|
||||
- **Current Usage**: Real-time usage and costs for the current period
|
||||
- **Usage Limits**: Plan limits with visual progress indicators
|
||||
- **Billing Details**: Projected charges and minimum commitments
|
||||
- **Plan Management**: Upgrade options and billing history
|
||||
|
||||
### Programmatic Usage Tracking
|
||||
|
||||
You can query your current usage and limits programmatically using the API:
|
||||
|
||||
**Endpoint:**
|
||||
```text
|
||||
GET /api/users/me/usage-limits
|
||||
```
|
||||
|
||||
**Authentication:**
|
||||
- Include your API key in the `X-API-Key` header
|
||||
|
||||
**Example Request:**
|
||||
```bash
|
||||
curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" https://sim.ai/api/users/me/usage-limits
|
||||
```
|
||||
|
||||
**Example Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"rateLimit": {
|
||||
"sync": { "isLimited": false, "limit": 10, "remaining": 10, "resetAt": "2025-09-08T22:51:55.999Z" },
|
||||
"async": { "isLimited": false, "limit": 50, "remaining": 50, "resetAt": "2025-09-08T22:51:56.155Z" },
|
||||
"authType": "api"
|
||||
},
|
||||
"usage": {
|
||||
"currentPeriodCost": 12.34,
|
||||
"limit": 100,
|
||||
"plan": "pro"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response Fields:**
|
||||
- `currentPeriodCost` reflects usage in the current billing period
|
||||
- `limit` is derived from individual limits (Free/Pro) or pooled organization limits (Team/Enterprise)
|
||||
- `plan` is the highest-priority active plan associated with your user
|
||||
|
||||
## Plan Limits
|
||||
|
||||
Different subscription plans have different usage limits:
|
||||
|
||||
| Plan | Monthly Usage Limit | Rate Limits (per minute) |
|
||||
|------|-------------------|-------------------------|
|
||||
| **Free** | $10 | 5 sync, 10 async |
|
||||
| **Pro** | $100 | 10 sync, 50 async |
|
||||
| **Team** | $500 (pooled) | 50 sync, 100 async |
|
||||
| **Enterprise** | Custom | Custom |
|
||||
|
||||
## Cost Management Best Practices
|
||||
|
||||
1. **Monitor Regularly**: Check your usage dashboard frequently to avoid surprises
|
||||
2. **Set Budgets**: Use plan limits as guardrails for your spending
|
||||
3. **Optimize Workflows**: Review high-cost executions and optimize prompts or model selection
|
||||
4. **Use Appropriate Models**: Match model complexity to task requirements
|
||||
5. **Batch Similar Tasks**: Combine multiple requests when possible to reduce overhead
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Review your current usage in [Settings → Subscription](https://sim.ai/settings/subscription)
|
||||
- Learn about [Logging](/execution/logging) to track execution details
|
||||
- Explore the [External API](/execution/api) for programmatic cost monitoring
|
||||
- Check out [workflow optimization techniques](/blocks) to reduce costs
|
||||
@@ -1,12 +1,11 @@
|
||||
---
|
||||
title: Execution
|
||||
description: Understand how workflows are executed in Sim
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
|
||||
Sim's execution engine brings your workflows to life by processing blocks in the correct order, managing data flow, and handling errors gracefully.
|
||||
Sim's execution engine brings your workflows to life by processing blocks in the correct order, managing data flow, and handling errors gracefully, so you can understand exactly how workflows are executed in Sim.
|
||||
|
||||
<Callout type="info">
|
||||
Every workflow execution follows a deterministic path based on your block connections and logic, ensuring predictable and reliable results.
|
||||
@@ -20,8 +19,16 @@ Sim's execution engine brings your workflows to life by processing blocks in the
|
||||
workflow
|
||||
</Card>
|
||||
|
||||
<Card title="Logging and Cost Calculation" href="/execution/advanced">
|
||||
Understand workflow logs and how execution costs are calculated in Sim
|
||||
<Card title="Logging" href="/execution/logging">
|
||||
Monitor workflow executions with comprehensive logging and real-time visibility
|
||||
</Card>
|
||||
|
||||
<Card title="Cost Calculation" href="/execution/costs">
|
||||
Understand how workflow execution costs are calculated and optimized
|
||||
</Card>
|
||||
|
||||
<Card title="External API" href="/execution/api">
|
||||
Access execution logs and set up webhooks programmatically via REST API
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
@@ -125,4 +132,4 @@ const result = await client.executeWorkflow('workflow-id', {
|
||||
|
||||
## What's Next?
|
||||
|
||||
Start with [Execution Basics](/execution/basics) to understand how workflows run, then explore [Logging and Cost Calculation](/execution/advanced) to monitor and optimize your executions.
|
||||
Start with [Execution Basics](/execution/basics) to understand how workflows run, then explore [Logging](/execution/logging) to monitor your executions and [Cost Calculation](/execution/costs) to optimize your spending.
|
||||
150
apps/docs/content/docs/en/execution/logging.mdx
Normal file
150
apps/docs/content/docs/en/execution/logging.mdx
Normal file
@@ -0,0 +1,150 @@
|
||||
---
|
||||
title: Logging
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
Sim provides comprehensive logging for all workflow executions, giving you complete visibility into how your workflows run, what data flows through them, and where issues might occur.
|
||||
|
||||
## Logging System
|
||||
|
||||
Sim offers two complementary logging interfaces to match different workflows and use cases:
|
||||
|
||||
### Real-Time Console
|
||||
|
||||
During manual or chat workflow execution, logs appear in real-time in the Console panel on the right side of the workflow editor:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/logs/console.png"
|
||||
alt="Real-time Console Panel"
|
||||
width={400}
|
||||
height={300}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
The console shows:
|
||||
- Block execution progress with active block highlighting
|
||||
- Real-time outputs as blocks complete
|
||||
- Execution timing for each block
|
||||
- Success/error status indicators
|
||||
|
||||
### Logs Page
|
||||
|
||||
All workflow executions—whether triggered manually, via API, Chat, Schedule, or Webhook—are logged to the dedicated Logs page:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/logs/logs.png"
|
||||
alt="Logs Page"
|
||||
width={600}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
The Logs page provides:
|
||||
- Comprehensive filtering by time range, status, trigger type, folder, and workflow
|
||||
- Search functionality across all logs
|
||||
- Live mode for real-time updates
|
||||
- 7-day log retention (upgradeable for longer retention)
|
||||
|
||||
## Log Details Sidebar
|
||||
|
||||
Clicking on any log entry opens a detailed sidebar view:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/logs/logs-sidebar.png"
|
||||
alt="Logs Sidebar Details"
|
||||
width={600}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
### Block Input/Output
|
||||
|
||||
View the complete data flow for each block with tabs to switch between:
|
||||
|
||||
<Tabs items={['Output', 'Input']}>
|
||||
<Tab>
|
||||
**Output Tab** shows the block's execution result:
|
||||
- Structured data with JSON formatting
|
||||
- Markdown rendering for AI-generated content
|
||||
- Copy button for easy data extraction
|
||||
</Tab>
|
||||
|
||||
<Tab>
|
||||
**Input Tab** displays what was passed to the block:
|
||||
- Resolved variable values
|
||||
- Referenced outputs from other blocks
|
||||
- Environment variables used
|
||||
- API keys are automatically redacted for security
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Execution Timeline
|
||||
|
||||
For workflow-level logs, view detailed execution metrics:
|
||||
- Start and end timestamps
|
||||
- Total workflow duration
|
||||
- Individual block execution times
|
||||
- Performance bottleneck identification
|
||||
|
||||
## Workflow Snapshots
|
||||
|
||||
For any logged execution, click "View Snapshot" to see the exact workflow state at execution time:
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/logs/logs-frozen-canvas.png"
|
||||
alt="Workflow Snapshot"
|
||||
width={600}
|
||||
height={400}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
The snapshot provides:
|
||||
- Frozen canvas showing the workflow structure
|
||||
- Block states and connections as they were during execution
|
||||
- Click any block to see its inputs and outputs
|
||||
- Useful for debugging workflows that have since been modified
|
||||
|
||||
<Callout type="info">
|
||||
Workflow snapshots are only available for executions after the enhanced logging system was introduced. Older migrated logs show a "Logged State Not Found" message.
|
||||
</Callout>
|
||||
|
||||
## Log Retention
|
||||
|
||||
- **Free Plan**: 7 days of log retention
|
||||
- **Pro Plan**: 30 days of log retention
|
||||
- **Team Plan**: 90 days of log retention
|
||||
- **Enterprise Plan**: Custom retention periods available
|
||||
|
||||
## Best Practices
|
||||
|
||||
### For Development
|
||||
- Use the real-time console for immediate feedback during testing
|
||||
- Check block inputs and outputs to verify data flow
|
||||
- Use workflow snapshots to compare working vs. broken versions
|
||||
|
||||
### For Production
|
||||
- Monitor the Logs page regularly for errors or performance issues
|
||||
- Set up filters to focus on specific workflows or time periods
|
||||
- Use live mode during critical deployments to watch executions in real-time
|
||||
|
||||
### For Debugging
|
||||
- Always check the execution timeline to identify slow blocks
|
||||
- Compare inputs between working and failing executions
|
||||
- Use workflow snapshots to see the exact state when issues occurred
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Learn about [Cost Calculation](/execution/costs) to understand workflow pricing
|
||||
- Explore the [External API](/execution/api) for programmatic log access
|
||||
- Set up [Webhook notifications](/execution/api#webhook-subscriptions) for real-time alerts
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
title: Getting Started
|
||||
description: Build your first AI workflow in 5 minutes
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
@@ -8,7 +7,6 @@ import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { File, Files, Folder } from 'fumadocs-ui/components/files'
|
||||
import { Step, Steps } from 'fumadocs-ui/components/steps'
|
||||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
|
||||
import { ThemeImage } from '@/components/ui/theme-image'
|
||||
import {
|
||||
AgentIcon,
|
||||
ApiIcon,
|
||||
@@ -24,6 +22,7 @@ import {
|
||||
SlackIcon,
|
||||
} from '@/components/icons'
|
||||
import { Video } from '@/components/ui/video'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
This tutorial will guide you through building your first AI workflow in Sim. We'll create a people research agent that can find information about individuals using state-of-the-art LLM-Search tools.
|
||||
|
||||
@@ -40,9 +39,8 @@ A people research agent that:
|
||||
4. Extracts structured information using a response format
|
||||
5. Returns comprehensive data about the person
|
||||
|
||||
<ThemeImage
|
||||
lightSrc="/static/examples/started/started-1.png"
|
||||
darkSrc="/static/examples/started/started-1.png"
|
||||
<Image
|
||||
src="/static/getting-started/started-1.png"
|
||||
alt="Getting Started Example"
|
||||
width={800}
|
||||
height={500}
|
||||
@@ -64,7 +62,7 @@ A people research agent that:
|
||||
- **User Prompt**: Drag the connection from the Start block's output into this field (this connects `<start.input>` to the user prompt)
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="examples/started-2.mp4" />
|
||||
<Video src="getting-started/started-2.mp4" width={700} height={450} />
|
||||
</div>
|
||||
</Step>
|
||||
|
||||
@@ -78,7 +76,7 @@ A people research agent that:
|
||||
- Add your API keys for both tools (this allows the agent to search the web and access additional information)
|
||||
|
||||
<div className="mx-auto w-3/5 overflow-hidden rounded-lg">
|
||||
<Video src="examples/started-3.mp4" />
|
||||
<Video src="getting-started/started-3.mp4" width={700} height={450} />
|
||||
</div>
|
||||
</Step>
|
||||
|
||||
@@ -93,7 +91,7 @@ A people research agent that:
|
||||
You should see the agent's response analyzing the person described in your text.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="examples/started-4.mp4" />
|
||||
<Video src="getting-started/started-4.mp4" width={700} height={450} />
|
||||
</div>
|
||||
</Step>
|
||||
|
||||
@@ -106,7 +104,7 @@ A people research agent that:
|
||||
- The AI will generate a JSON schema for you automatically
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="examples/started-5.mp4" />
|
||||
<Video src="getting-started/started-5.mp4" width={700} height={450} />
|
||||
</div>
|
||||
</Step>
|
||||
|
||||
@@ -121,7 +119,7 @@ A people research agent that:
|
||||
You should now see structured JSON output with the person's information organized into location, profession, and education fields.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="examples/started-6.mp4" />
|
||||
<Video src="getting-started/started-6.mp4" width={700} height={450} />
|
||||
</div>
|
||||
</Step>
|
||||
</Steps>
|
||||
60
apps/docs/content/docs/en/index.mdx
Normal file
60
apps/docs/content/docs/en/index.mdx
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: Documentation
|
||||
---
|
||||
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
|
||||
# Sim Documentation
|
||||
|
||||
Welcome to Sim, a visual workflow builder for AI applications. Build powerful AI agents, automation workflows, and data processing pipelines by connecting blocks on a canvas.
|
||||
|
||||
## Quick Start
|
||||
|
||||
<Cards>
|
||||
<Card title="Introduction" href="/introduction">
|
||||
Learn what you can build with Sim
|
||||
</Card>
|
||||
<Card title="Getting Started" href="/getting-started">
|
||||
Create your first workflow in 10 minutes
|
||||
</Card>
|
||||
<Card title="Workflow Blocks" href="/blocks">
|
||||
Learn about the building blocks
|
||||
</Card>
|
||||
<Card title="Tools & Integrations" href="/tools">
|
||||
Explore 80+ built-in integrations
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Core Concepts
|
||||
|
||||
<Cards>
|
||||
<Card title="Connections" href="/connections">
|
||||
Understand how data flows between blocks
|
||||
</Card>
|
||||
<Card title="Variables" href="/variables">
|
||||
Work with workflow and environment variables
|
||||
</Card>
|
||||
<Card title="Execution" href="/execution">
|
||||
Monitor workflow runs and manage costs
|
||||
</Card>
|
||||
<Card title="Triggers" href="/triggers">
|
||||
Start workflows via API, webhooks, or schedules
|
||||
</Card>
|
||||
</Cards>
|
||||
|
||||
## Advanced Features
|
||||
|
||||
<Cards>
|
||||
<Card title="Team Management" href="/permissions/roles-and-permissions">
|
||||
Set up workspace roles and permissions
|
||||
</Card>
|
||||
<Card title="YAML Configuration" href="/yaml">
|
||||
Define workflows as code
|
||||
</Card>
|
||||
<Card title="MCP Integration" href="/mcp">
|
||||
Connect external services with Model Context Protocol
|
||||
</Card>
|
||||
<Card title="SDKs" href="/sdks">
|
||||
Integrate Sim into your applications
|
||||
</Card>
|
||||
</Cards>
|
||||
85
apps/docs/content/docs/en/introduction/index.mdx
Normal file
85
apps/docs/content/docs/en/introduction/index.mdx
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
title: Introduction
|
||||
---
|
||||
|
||||
import { Card, Cards } from 'fumadocs-ui/components/card'
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
Sim is a visual workflow builder for AI applications that lets you build AI agent workflows visually. Create powerful AI agents, automation workflows, and data processing pipelines by connecting blocks on a canvas—no coding required.
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Image
|
||||
src="/static/introduction.png"
|
||||
alt="Sim visual workflow canvas"
|
||||
width={700}
|
||||
height={450}
|
||||
className="my-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
## What You Can Build
|
||||
|
||||
**AI Assistants & Chatbots**
|
||||
Create intelligent agents that can search the web, access your calendar, send emails, and interact with your business tools.
|
||||
|
||||
**Business Process Automation**
|
||||
Automate repetitive tasks like data entry, report generation, customer support responses, and content creation.
|
||||
|
||||
**Data Processing & Analysis**
|
||||
Extract insights from documents, analyze datasets, generate reports, and sync data between systems.
|
||||
|
||||
**API Integration Workflows**
|
||||
Connect multiple services into unified endpoints, orchestrate complex business logic, and handle event-driven automation.
|
||||
|
||||
## How It Works
|
||||
|
||||
**Visual Canvas**
|
||||
Drag and drop blocks to build workflows. Connect AI models, databases, APIs, and business tools with simple point-and-click connections.
|
||||
|
||||
**Smart Blocks**
|
||||
Choose from processing blocks (AI agents, APIs, functions), logic blocks (conditions, loops, routers), and output blocks (responses, evaluators).
|
||||
|
||||
**Multiple Triggers**
|
||||
Start workflows via chat interface, REST API, webhooks, scheduled jobs, or external events from services like Slack and GitHub.
|
||||
|
||||
**Team Collaboration**
|
||||
Work simultaneously with team members on the same workflow with real-time editing and permissions management.
|
||||
|
||||
## Built-in Integrations
|
||||
|
||||
Sim connects to 80+ services out of the box:
|
||||
|
||||
- **AI Models**: OpenAI, Anthropic, Google, Groq, Cerebras, local Ollama models
|
||||
- **Communication**: Gmail, Slack, Teams, Telegram, WhatsApp
|
||||
- **Productivity**: Notion, Google Sheets, Airtable, Monday.com
|
||||
- **Development**: GitHub, Jira, Linear, browser automation
|
||||
- **Search & Web**: Google Search, Perplexity, Firecrawl, Exa AI
|
||||
- **Databases**: PostgreSQL, MySQL, Supabase, Pinecone, Qdrant
|
||||
|
||||
Need something custom? Use our [MCP integration](/mcp) to connect any external service.
|
||||
|
||||
## Deployment Options
|
||||
|
||||
**Cloud-hosted**: Get started instantly at [sim.ai](https://sim.ai) with managed infrastructure, automatic scaling, and built-in monitoring.
|
||||
|
||||
**Self-hosted**: Deploy on your own infrastructure using Docker, with support for local AI models via Ollama for complete data privacy.
|
||||
|
||||
## Next Steps
|
||||
|
||||
Ready to build your first AI workflow?
|
||||
|
||||
<Cards>
|
||||
<Card title="Getting Started" href="/getting-started">
|
||||
Create your first workflow in 10 minutes
|
||||
</Card>
|
||||
<Card title="Workflow Blocks" href="/blocks">
|
||||
Learn about the building blocks
|
||||
</Card>
|
||||
<Card title="Tools & Integrations" href="/tools">
|
||||
Explore 60+ built-in integrations
|
||||
</Card>
|
||||
<Card title="Team Permissions" href="/permissions/roles-and-permissions">
|
||||
Set up workspace roles and permissions
|
||||
</Card>
|
||||
</Cards>
|
||||
113
apps/docs/content/docs/en/knowledgebase/index.mdx
Normal file
113
apps/docs/content/docs/en/knowledgebase/index.mdx
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
title: Knowledgebase
|
||||
---
|
||||
|
||||
import { Video } from '@/components/ui/video'
|
||||
import { Image } from '@/components/ui/image'
|
||||
|
||||
The knowledgebase allows you to upload, process, and search through your documents with intelligent vector search and chunking. Documents of various types are automatically processed, embedded, and made searchable. Your documents are intelligently chunked, and you can view, edit, and search through them using natural language queries.
|
||||
|
||||
## Upload and Processing
|
||||
|
||||
Simply upload your documents to get started. Sim automatically processes them in the background, extracting text, creating embeddings, and breaking them into searchable chunks.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="knowledgebase-1.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
The system handles the entire processing pipeline for you:
|
||||
|
||||
1. **Text Extraction**: Content is extracted from your documents using specialized parsers for each file type
|
||||
2. **Intelligent Chunking**: Documents are broken into meaningful chunks with configurable size and overlap
|
||||
3. **Embedding Generation**: Vector embeddings are created for semantic search capabilities
|
||||
4. **Processing Status**: Track the progress as your documents are processed
|
||||
|
||||
## Supported File Types
|
||||
|
||||
Sim supports PDF, Word (DOC/DOCX), plain text (TXT), Markdown (MD), HTML, Excel (XLS/XLSX), PowerPoint (PPT/PPTX), and CSV files. Files can be up to 100MB each, with optimal performance for files under 50MB. You can upload multiple documents simultaneously, and PDF files include OCR processing for scanned documents.
|
||||
|
||||
## Viewing and Editing Chunks
|
||||
|
||||
Once your documents are processed, you can view and edit the individual chunks. This gives you full control over how your content is organized and searched.
|
||||
|
||||
<Image src="/static/knowledgebase/knowledgebase.png" alt="Document chunks view showing processed content" width={800} height={500} />
|
||||
|
||||
### Chunk Configuration
|
||||
- **Default chunk size**: 1,024 characters
|
||||
- **Configurable range**: 100-4,000 characters per chunk
|
||||
- **Smart overlap**: 200 characters by default for context preservation
|
||||
- **Hierarchical splitting**: Respects document structure (sections, paragraphs, sentences)
|
||||
|
||||
### Editing Capabilities
|
||||
- **Edit chunk content**: Modify the text content of individual chunks
|
||||
- **Adjust chunk boundaries**: Merge or split chunks as needed
|
||||
- **Add metadata**: Enhance chunks with additional context
|
||||
- **Bulk operations**: Manage multiple chunks efficiently
|
||||
|
||||
## Advanced PDF Processing
|
||||
|
||||
For PDF documents, Sim offers enhanced processing capabilities:
|
||||
|
||||
### OCR Support
|
||||
When configured with Azure or [Mistral OCR](https://docs.mistral.ai/ocr/):
|
||||
- **Scanned document processing**: Extract text from image-based PDFs
|
||||
- **Mixed content handling**: Process PDFs with both text and images
|
||||
- **High accuracy**: Advanced AI models ensure accurate text extraction
|
||||
|
||||
## Using The Knowledge Block in Workflows
|
||||
|
||||
Once your documents are processed, you can use them in your AI workflows through the Knowledge block. This enables Retrieval-Augmented Generation (RAG), allowing your AI agents to access and reason over your document content to provide more accurate, contextual responses.
|
||||
|
||||
<Image src="/static/knowledgebase/knowledgebase-2.png" alt="Using Knowledge Block in Workflows" width={800} height={500} />
|
||||
|
||||
### Knowledge Block Features
|
||||
- **Semantic search**: Find relevant content using natural language queries
|
||||
- **Context integration**: Automatically include relevant chunks in agent prompts
|
||||
- **Dynamic retrieval**: Search happens in real-time during workflow execution
|
||||
- **Relevance scoring**: Results ranked by semantic similarity
|
||||
|
||||
### Integration Options
|
||||
- **System prompts**: Provide context to your AI agents
|
||||
- **Dynamic context**: Search and include relevant information during conversations
|
||||
- **Multi-document search**: Query across your entire knowledgebase
|
||||
- **Filtered search**: Combine with tags for precise content retrieval
|
||||
|
||||
## Vector Search Technology
|
||||
|
||||
Sim uses vector search powered by [pgvector](https://github.com/pgvector/pgvector) to understand the meaning and context of your content:
|
||||
|
||||
### Semantic Understanding
|
||||
- **Contextual search**: Finds relevant content even when exact keywords don't match
|
||||
- **Concept-based retrieval**: Understands relationships between ideas
|
||||
- **Multi-language support**: Works across different languages
|
||||
- **Synonym recognition**: Finds related terms and concepts
|
||||
|
||||
### Search Capabilities
|
||||
- **Natural language queries**: Ask questions in plain English
|
||||
- **Similarity search**: Find conceptually similar content
|
||||
- **Hybrid search**: Combines vector and traditional keyword search
|
||||
- **Configurable results**: Control the number and relevance threshold of results
|
||||
|
||||
## Document Management
|
||||
|
||||
### Organization Features
|
||||
- **Bulk upload**: Upload multiple files at once via the asynchronous API
|
||||
- **Processing status**: Real-time updates on document processing
|
||||
- **Search and filter**: Find documents quickly in large collections
|
||||
- **Metadata tracking**: Automatic capture of file information and processing details
|
||||
|
||||
### Security and Privacy
|
||||
- **Secure storage**: Documents stored with enterprise-grade security
|
||||
- **Access control**: Workspace-based permissions
|
||||
- **Processing isolation**: Each workspace has isolated document processing
|
||||
- **Data retention**: Configure document retention policies
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. **Navigate to your knowledgebase**: Access from your workspace sidebar
|
||||
2. **Upload documents**: Drag and drop or select files to upload
|
||||
3. **Monitor processing**: Watch as documents are processed and chunked
|
||||
4. **Explore chunks**: View and edit the processed content
|
||||
5. **Add to workflows**: Use the Knowledge block to integrate with your AI agents
|
||||
|
||||
The knowledgebase transforms your static documents into an intelligent, searchable resource that your AI workflows can leverage for more informed and contextual responses.
|
||||
108
apps/docs/content/docs/en/knowledgebase/tags.mdx
Normal file
108
apps/docs/content/docs/en/knowledgebase/tags.mdx
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
title: Tags and Filtering
|
||||
---
|
||||
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
Tags provide a powerful way to organize your documents and create precise filtering for your vector searches. By combining tag-based filtering with semantic search, you can retrieve exactly the content you need from your knowledgebase.
|
||||
|
||||
## Adding Tags to Documents
|
||||
|
||||
You can add custom tags to any document in your knowledgebase to organize and categorize your content for easier retrieval.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="knowledgebase-tag.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
### Tag Management
|
||||
- **Custom tags**: Create your own tag system that fits your workflow
|
||||
- **Multiple tags per document**: Apply as many tags as needed to each document, there are 7 tag slots available per knowledgebase that are shared by all documents in the knowledgebase
|
||||
- **Tag organization**: Group related documents with consistent tagging
|
||||
|
||||
### Tag Best Practices
|
||||
- **Consistent naming**: Use standardized tag names across your documents
|
||||
- **Descriptive tags**: Use clear, meaningful tag names
|
||||
- **Regular cleanup**: Remove unused or outdated tags periodically
|
||||
|
||||
## Using Tags in Knowledge Blocks
|
||||
|
||||
Tags become powerful when combined with the Knowledge block in your workflows. You can filter your searches to specific tagged content, ensuring your AI agents get the most relevant information.
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="knowledgebase-tag2.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
## Search Modes
|
||||
|
||||
The Knowledge block supports three different search modes depending on what you provide:
|
||||
|
||||
### 1. Tag-Only Search
|
||||
When you **only provide tags** (no search query):
|
||||
- **Direct retrieval**: Fetches all documents that have the specified tags
|
||||
- **No vector search**: Results are based purely on tag matching
|
||||
- **Fast performance**: Quick retrieval without semantic processing
|
||||
- **Exact matching**: Only documents with all specified tags are returned
|
||||
|
||||
**Use case**: When you need all documents from a specific category or project
|
||||
|
||||
### 2. Vector Search Only
|
||||
When you **only provide a search query** (no tags):
|
||||
- **Semantic search**: Finds content based on meaning and context
|
||||
- **Full knowledgebase**: Searches across all documents
|
||||
- **Relevance ranking**: Results ordered by semantic similarity
|
||||
- **Natural language**: Use questions or phrases to find relevant content
|
||||
|
||||
**Use case**: When you need the most relevant content regardless of organization
|
||||
|
||||
### 3. Combined Tag Filtering + Vector Search
|
||||
When you **provide both tags and a search query**:
|
||||
1. **First**: Filter documents to only those with the specified tags
|
||||
2. **Then**: Perform vector search within that filtered subset
|
||||
3. **Result**: Semantically relevant content from your tagged documents only
|
||||
|
||||
**Use case**: When you need relevant content from a specific category or project
|
||||
|
||||
### Search Configuration
|
||||
|
||||
#### Tag Filtering
|
||||
- **Multiple tags**: Use multiple tags for OR logic (document must have one or more of the tags)
|
||||
- **Tag combinations**: Mix different tag types for precise filtering
|
||||
- **Case sensitivity**: Tag matching is case-insensitive
|
||||
- **Partial matching**: Exact tag name matching required
|
||||
|
||||
#### Vector Search Parameters
|
||||
- **Query complexity**: Natural language questions work best
|
||||
- **Result limits**: Configure how many chunks to retrieve
|
||||
- **Relevance threshold**: Set minimum similarity scores
|
||||
- **Context window**: Adjust chunk size for your use case
|
||||
|
||||
## Integration with Workflows
|
||||
|
||||
### Knowledge Block Configuration
|
||||
1. **Select knowledgebase**: Choose which knowledgebase to search
|
||||
2. **Add tags**: Specify filtering tags (optional)
|
||||
3. **Enter query**: Add your search query (optional)
|
||||
4. **Configure results**: Set number of chunks to retrieve
|
||||
5. **Test search**: Preview results before using in workflow
|
||||
|
||||
### Dynamic Tag Usage
|
||||
- **Variable tags**: Use workflow variables as tag values
|
||||
- **Conditional filtering**: Apply different tags based on workflow logic
|
||||
- **Context-aware search**: Adjust tags based on conversation context
|
||||
- **Multi-step filtering**: Refine searches through workflow steps
|
||||
|
||||
### Performance Optimization
|
||||
- **Efficient filtering**: Tag filtering happens before vector search for better performance
|
||||
- **Caching**: Frequently used tag combinations are cached for speed
|
||||
- **Parallel processing**: Multiple tag searches can run simultaneously
|
||||
- **Resource management**: Automatic optimization of search resources
|
||||
|
||||
## Getting Started with Tags
|
||||
|
||||
1. **Plan your tag structure**: Decide on consistent naming conventions
|
||||
2. **Start tagging**: Add relevant tags to your existing documents
|
||||
3. **Test combinations**: Experiment with tag + search query combinations
|
||||
4. **Integrate into workflows**: Use the Knowledge block with your tagging strategy
|
||||
5. **Refine over time**: Adjust your tagging approach based on search results
|
||||
|
||||
Tags transform your knowledgebase from a simple document store into a precisely organized, searchable intelligence system that your AI workflows can navigate with surgical precision.
|
||||
140
apps/docs/content/docs/en/mcp/index.mdx
Normal file
140
apps/docs/content/docs/en/mcp/index.mdx
Normal file
@@ -0,0 +1,140 @@
|
||||
---
|
||||
title: MCP (Model Context Protocol)
|
||||
---
|
||||
|
||||
import { Video } from '@/components/ui/video'
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
|
||||
The Model Context Protocol ([MCP](https://modelcontextprotocol.com/)) allows you to connect external tools and services using a standardized protocol, enabling you to integrate APIs and services directly into your workflows. With MCP, you can extend Sim's capabilities by adding custom integrations that work seamlessly with your agents and workflows.
|
||||
|
||||
## What is MCP?
|
||||
|
||||
MCP is an open standard that enables AI assistants to securely connect to external data sources and tools. It provides a standardized way to:
|
||||
|
||||
- Connect to databases, APIs, and file systems
|
||||
- Access real-time data from external services
|
||||
- Execute custom tools and scripts
|
||||
- Maintain secure, controlled access to external resources
|
||||
|
||||
## Adding MCP Servers
|
||||
|
||||
MCP servers provide collections of tools that your agents can use. You can add MCP servers in two ways:
|
||||
|
||||
### From Workspace Settings
|
||||
|
||||
Configure MCP servers at the workspace level so all team members can use them:
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="mcp-1.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
1. Navigate to your workspace settings
|
||||
2. Go to the **MCP Servers** section
|
||||
3. Click **Add MCP Server**
|
||||
4. Enter the server configuration details
|
||||
5. Save the configuration
|
||||
|
||||
<Callout type="info">
|
||||
MCP servers configured in workspace settings are available to all workspace members based on their permission levels.
|
||||
</Callout>
|
||||
|
||||
### From Agent Configuration
|
||||
|
||||
You can also add and configure MCP servers directly from within an agent block:
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="mcp-2.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
This is useful when you need to quickly set up a specific integration for a particular workflow.
|
||||
|
||||
## Using MCP Tools in Agents
|
||||
|
||||
Once MCP servers are configured, their tools become available within your agent blocks:
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="mcp-3.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
1. Open an **Agent** block
|
||||
2. In the **Tools** section, you'll see available MCP tools
|
||||
3. Select the tools you want the agent to use
|
||||
4. The agent can now access these tools during execution
|
||||
|
||||
## Standalone MCP Tool Block
|
||||
|
||||
For more granular control, you can use the dedicated MCP Tool block to execute specific MCP tools:
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="mcp-4.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
The MCP Tool block allows you to:
|
||||
- Execute any configured MCP tool directly
|
||||
- Pass specific parameters to the tool
|
||||
- Use the tool's output in subsequent workflow steps
|
||||
- Chain multiple MCP tools together
|
||||
|
||||
### When to Use MCP Tool vs Agent
|
||||
|
||||
**Use Agent with MCP tools when:**
|
||||
- You want the AI to decide which tools to use
|
||||
- You need complex reasoning about when and how to use tools
|
||||
- You want natural language interaction with the tools
|
||||
|
||||
**Use MCP Tool block when:**
|
||||
- You need deterministic tool execution
|
||||
- You want to execute a specific tool with known parameters
|
||||
- You're building structured workflows with predictable steps
|
||||
|
||||
## Permission Requirements
|
||||
|
||||
MCP functionality requires specific workspace permissions:
|
||||
|
||||
| Action | Required Permission |
|
||||
|--------|-------------------|
|
||||
| Configure MCP servers in settings | **Admin** |
|
||||
| Use MCP tools in agents | **Write** or **Admin** |
|
||||
| View available MCP tools | **Read**, **Write**, or **Admin** |
|
||||
| Execute MCP Tool blocks | **Write** or **Admin** |
|
||||
|
||||
## Common Use Cases
|
||||
|
||||
### Database Integration
|
||||
Connect to databases to query, insert, or update data within your workflows.
|
||||
|
||||
### API Integrations
|
||||
Access external APIs and web services that don't have built-in Sim integrations.
|
||||
|
||||
### File System Access
|
||||
Read, write, and manipulate files on local or remote file systems.
|
||||
|
||||
### Custom Business Logic
|
||||
Execute custom scripts or tools specific to your organization's needs.
|
||||
|
||||
### Real-time Data Access
|
||||
Fetch live data from external systems during workflow execution.
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- MCP servers run with the permissions of the user who configured them
|
||||
- Always verify MCP server sources before installation
|
||||
- Use environment variables for sensitive configuration data
|
||||
- Review MCP server capabilities before granting access to agents
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### MCP Server Not Appearing
|
||||
- Verify the server configuration is correct
|
||||
- Check that you have the required permissions
|
||||
- Ensure the MCP server is running and accessible
|
||||
|
||||
### Tool Execution Failures
|
||||
- Verify tool parameters are correctly formatted
|
||||
- Check MCP server logs for error messages
|
||||
- Ensure required authentication is configured
|
||||
|
||||
### Permission Errors
|
||||
- Confirm your workspace permission level
|
||||
- Check if the MCP server requires additional authentication
|
||||
- Verify the server is properly configured for your workspace
|
||||
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"title": "Sim Documentation",
|
||||
"pages": [
|
||||
"---Introduction---",
|
||||
"./introduction/index",
|
||||
"./getting-started/index",
|
||||
"---Create---",
|
||||
"---Building Workflows---",
|
||||
"triggers",
|
||||
"blocks",
|
||||
"tools",
|
||||
"---Connections---",
|
||||
"connections",
|
||||
"mcp",
|
||||
"copilot",
|
||||
"knowledgebase",
|
||||
"---Configuration---",
|
||||
"variables",
|
||||
"---Execution---",
|
||||
"execution",
|
||||
"---Copilot---",
|
||||
"copilot",
|
||||
"---Advanced---",
|
||||
"./variables/index",
|
||||
"permissions",
|
||||
"yaml",
|
||||
"---SDKs---",
|
||||
"./sdks/python",
|
||||
"./sdks/typescript"
|
||||
"sdks"
|
||||
],
|
||||
"defaultOpen": true
|
||||
"defaultOpen": false
|
||||
}
|
||||
161
apps/docs/content/docs/en/permissions/roles-and-permissions.mdx
Normal file
161
apps/docs/content/docs/en/permissions/roles-and-permissions.mdx
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
title: "Roles and Permissions"
|
||||
---
|
||||
|
||||
import { Video } from '@/components/ui/video'
|
||||
|
||||
When you invite team members to your organization or workspace, you'll need to choose what level of access to give them. This guide explains what each permission level allows users to do, helping you understand team roles and what access each permission level provides.
|
||||
|
||||
## How to Invite Someone to a Workspace
|
||||
|
||||
<div className="mx-auto w-full overflow-hidden rounded-lg">
|
||||
<Video src="invitations.mp4" width={700} height={450} />
|
||||
</div>
|
||||
|
||||
## Workspace Permission Levels
|
||||
|
||||
When inviting someone to a workspace, you can assign one of three permission levels:
|
||||
|
||||
| Permission | What They Can Do |
|
||||
|------------|------------------|
|
||||
| **Read** | View workflows, see execution results, but cannot make any changes |
|
||||
| **Write** | Create and edit workflows, run workflows, manage environment variables |
|
||||
| **Admin** | Everything Write can do, plus invite/remove users and manage workspace settings |
|
||||
|
||||
## What Each Permission Level Can Do
|
||||
|
||||
Here's a detailed breakdown of what users can do with each permission level:
|
||||
|
||||
### Read Permission
|
||||
**Perfect for:** Stakeholders, observers, or team members who need visibility but shouldn't make changes
|
||||
|
||||
**What they can do:**
|
||||
- View all workflows in the workspace
|
||||
- See workflow execution results and logs
|
||||
- Browse workflow configurations and settings
|
||||
- View environment variables (but not edit them)
|
||||
|
||||
**What they cannot do:**
|
||||
- Create, edit, or delete workflows
|
||||
- Run or deploy workflows
|
||||
- Change any workspace settings
|
||||
- Invite other users
|
||||
|
||||
### Write Permission
|
||||
**Perfect for:** Developers, content creators, or team members actively working on automation
|
||||
|
||||
**What they can do:**
|
||||
- Everything Read users can do, plus:
|
||||
- Create, edit, and delete workflows
|
||||
- Run and deploy workflows
|
||||
- Add, edit, and delete workspace environment variables
|
||||
- Use all available tools and integrations
|
||||
- Collaborate in real-time on workflow editing
|
||||
|
||||
**What they cannot do:**
|
||||
- Invite or remove users from the workspace
|
||||
- Change workspace settings
|
||||
- Delete the workspace
|
||||
|
||||
### Admin Permission
|
||||
**Perfect for:** Team leads, project managers, or technical leads who need to manage the workspace
|
||||
|
||||
**What they can do:**
|
||||
- Everything Write users can do, plus:
|
||||
- Invite new users to the workspace with any permission level
|
||||
- Remove users from the workspace
|
||||
- Manage workspace settings and integrations
|
||||
- Configure external tool connections
|
||||
- Delete workflows created by other users
|
||||
|
||||
**What they cannot do:**
|
||||
- Delete the workspace (only the workspace owner can do this)
|
||||
- Remove the workspace owner from the workspace
|
||||
|
||||
---
|
||||
|
||||
## Workspace Owner vs Admin
|
||||
|
||||
Every workspace has one **Owner** (the person who created it) plus any number of **Admins**.
|
||||
|
||||
### Workspace Owner
|
||||
- Has all Admin permissions
|
||||
- Can delete the workspace
|
||||
- Cannot be removed from the workspace
|
||||
- Can transfer ownership to another user
|
||||
|
||||
### Workspace Admin
|
||||
- Can do everything except delete the workspace or remove the owner
|
||||
- Can be removed from the workspace by the owner or other admins
|
||||
|
||||
---
|
||||
|
||||
## Common Scenarios
|
||||
|
||||
### Adding a New Developer to Your Team
|
||||
1. **Organization level**: Invite them as an **Organization Member**
|
||||
2. **Workspace level**: Give them **Write** permission so they can create and edit workflows
|
||||
|
||||
### Adding a Project Manager
|
||||
1. **Organization level**: Invite them as an **Organization Member**
|
||||
2. **Workspace level**: Give them **Admin** permission so they can manage the team and see everything
|
||||
|
||||
### Adding a Stakeholder or Client
|
||||
1. **Organization level**: Invite them as an **Organization Member**
|
||||
2. **Workspace level**: Give them **Read** permission so they can see progress but not make changes
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Users can create two types of environment variables:
|
||||
|
||||
### Personal Environment Variables
|
||||
- Only visible to the individual user
|
||||
- Available in all workflows they run
|
||||
- Managed in user settings
|
||||
|
||||
### Workspace Environment Variables
|
||||
- **Read permission**: Can see variable names and values
|
||||
- **Write/Admin permission**: Can add, edit, and delete variables
|
||||
- Available to all workspace members
|
||||
- If a personal variable has the same name as a workspace variable, the personal one takes priority
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Start with Minimal Permissions
|
||||
Give users the lowest permission level they need to do their job. You can always increase permissions later.
|
||||
|
||||
### Use Organization Structure Wisely
|
||||
- Make trusted team leads **Organization Admins**
|
||||
- Most team members should be **Organization Members**
|
||||
- Reserve workspace **Admin** permissions for people who need to manage users
|
||||
|
||||
### Review Permissions Regularly
|
||||
Periodically review who has access to what, especially when team members change roles or leave the company.
|
||||
|
||||
### Environment Variable Security
|
||||
- Use personal environment variables for sensitive API keys
|
||||
- Use workspace environment variables for shared configuration
|
||||
- Regularly audit who has access to sensitive variables
|
||||
|
||||
---
|
||||
|
||||
## Organization Roles
|
||||
|
||||
When inviting someone to your organization, you can assign one of two roles:
|
||||
|
||||
### Organization Admin
|
||||
**What they can do:**
|
||||
- Invite and remove team members from the organization
|
||||
- Create new workspaces
|
||||
- Manage billing and subscription settings
|
||||
- Access all workspaces within the organization
|
||||
|
||||
### Organization Member
|
||||
**What they can do:**
|
||||
- Access workspaces they've been specifically invited to
|
||||
- View the list of organization members
|
||||
- Cannot invite new people or manage organization settings
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
title: Python SDK
|
||||
description: The official Python SDK for Sim
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
@@ -8,7 +7,7 @@ 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 Python SDK for Sim allows you to execute workflows programmatically from your Python applications.
|
||||
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.
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
title: TypeScript/JavaScript SDK
|
||||
description: The official TypeScript/JavaScript SDK for Sim
|
||||
---
|
||||
|
||||
import { Callout } from 'fumadocs-ui/components/callout'
|
||||
@@ -8,7 +7,7 @@ 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 allows you to execute workflows programmatically from your Node.js applications, web applications, and other JavaScript environments.
|
||||
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.
|
||||
|
||||
<Callout type="info">
|
||||
The TypeScript SDK provides full type safety and supports both Node.js and browser environments. All workflow executions are currently synchronous.
|
||||
@@ -57,7 +57,7 @@ In Sim, the Airtable integration enables your agents to interact with your Airta
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Airtable functionality to manage table records. List, get, create,
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ In Sim, the ArXiv integration enables your agents to programmatically search, re
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Search for academic papers, retrieve metadata, download papers, and access the vast collection of scientific research on ArXiv.
|
||||
Integrates ArXiv into the workflow. Can search for papers, get paper details, and get author papers. Does not require OAuth or an API key.
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ In Sim, the BrowserUse integration allows your agents to interact with the web a
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Execute browser automation tasks with BrowserUse to navigate the web, scrape data, and perform actions as if a real user was interacting with the browser. The task runs asynchronously and the block will poll for completion before returning results.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ In Sim, the Clay integration allows your agents to push structured data into Cla
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Populate Clay workbook with data using a JSON or plain text. Enables direct communication and notifications with channel confirmation.
|
||||
Integrate Clay into the workflow. Can populate a table with data. Requires an API Key.
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ In Sim, the Confluence integration enables your agents to access and leverage yo
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Connect to Confluence workspaces to retrieve and search documentation. Access page content, metadata, and integrate Confluence documentation into your workflows.
|
||||
Integrate Confluence into the workflow. Can read and update a page. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
<g>
|
||||
<path
|
||||
d='M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z'
|
||||
fill='#5865F2'
|
||||
fill='currentColor'
|
||||
fillRule='nonzero'
|
||||
/>
|
||||
</g>
|
||||
@@ -57,7 +57,7 @@ Discord components in Sim use efficient lazy loading, only fetching data when ne
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Connect to Discord to send messages, manage channels, and interact with servers. Automate notifications, community management, and integrate Discord into your workflows.
|
||||
Integrate Discord into the workflow. Can send and get messages, get server information, and get a user’s information. Requires bot API key.
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ In Sim, the ElevenLabs integration enables your agents to convert text to lifeli
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Generate realistic speech from text using ElevenLabs voices.
|
||||
Integrate ElevenLabs into the workflow. Can convert text to speech. Requires API key.
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ In Sim, the Exa integration allows your agents to search the web for information
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Search the web, retrieve content, find similar links, and answer questions using Exa's powerful AI search capabilities.
|
||||
Integrate Exa into the workflow. Can search, get contents, find similar links, answer a question, and perform research. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ The File Parser tool is particularly useful for scenarios where your agents need
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Upload and extract contents from structured file formats including PDFs, CSV spreadsheets, and Word documents (DOCX). You can either provide a URL to a file or upload files directly. Specialized parsers extract text and metadata from each format. You can upload multiple files at once and access them individually or as a combined document.
|
||||
Integrate File into the workflow. Can upload a file manually or insert a file url.
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ This allows your agents to gather information from websites, extract structured
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Extract content from any website with advanced web scraping or search the web for information. Retrieve clean, structured data from web pages with options to focus on main content, or intelligently search for information across the web.
|
||||
Integrate Firecrawl into the workflow. Can search, scrape, or crawl websites. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Webhook
|
||||
description: Receive webhooks from any service
|
||||
description: Receive webhooks from any service by configuring a custom webhook.
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
@@ -35,7 +35,7 @@ In Sim, the GitHub integration enables your agents to interact directly with Git
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Access GitHub repositories, pull requests, and comments through the GitHub API. Automate code reviews, PR management, and repository interactions within your workflow. Trigger workflows from GitHub events like push, pull requests, and issues.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ In Sim, the Gmail integration enables your agents to send, read, and search emai
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Comprehensive Gmail integration with OAuth authentication. Send email messages, read email content, and trigger workflows from Gmail events like new emails and label changes.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ In Sim, the Google Calendar integration enables your agents to programmatically
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Calendar functionality to create, read, update, and list calendar events within your workflow. Automate scheduling, check availability, and manage events using OAuth authentication. Email invitations are sent asynchronously and delivery depends on recipients' Google Calendar settings.
|
||||
Integrate Google Calendar into the workflow. Can create, read, update, and list calendar events. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ In Sim, the Google Docs integration enables your agents to interact directly wit
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Docs functionality to manage documents. Read content from existing documents, write to documents, and create new documents using OAuth authentication. Supports text content manipulation for document creation and editing.
|
||||
Integrate Google Docs into the workflow. Can read, write, and create documents. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ In Sim, the Google Drive integration enables your agents to interact directly wi
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Drive functionality to manage files and folders. Upload new files, get content from existing files, create new folders, and list contents of folders using OAuth authentication. Supports file operations with custom MIME types and folder organization.
|
||||
Integrate Google Drive into the workflow. Can create, upload, and list files. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
86
apps/docs/content/docs/en/tools/google_forms.mdx
Normal file
86
apps/docs/content/docs/en/tools/google_forms.mdx
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: Google Forms
|
||||
description: Read responses from a Google Form
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="google_forms"
|
||||
color="#E0E0E0"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon" xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 65' fill='none'>
|
||||
<path
|
||||
d='M29.583 0H4.438C1.997 0 0 1.997 0 4.438v56.208C0 63.086 1.997 65.083 4.438 65.083h38.458c2.44 0 4.437-1.997 4.437-4.437V17.75L36.979 10.354 29.583 0Z'
|
||||
fill='#673AB7'
|
||||
/>
|
||||
<path
|
||||
d='M29.583 0v10.354c0 2.45 1.986 4.438 4.438 4.438h13.312L36.979 10.354 29.583 0Z'
|
||||
fill='#B39DDB'
|
||||
/>
|
||||
<path
|
||||
d='M19.229 50.292h16.271v-2.959H19.229v2.959Zm0-17.75v2.958h16.271v-2.958H19.229Zm-3.698 1.479c0 1.224-0.995 2.219-2.219 2.219s-2.219-0.995-2.219-2.219c0-1.224 0.995-2.219 2.219-2.219s2.219 0.995 2.219 2.219Zm0 7.396c0 1.224-0.995 2.219-2.219 2.219s-2.219-0.995-2.219-2.219c0-1.224 0.995-2.219 2.219-2.219s2.219 0.995 2.219 2.219Zm0 7.396c0 1.224-0.995 2.219-2.219 2.219s-2.219-0.995-2.219-2.219c0-1.224 0.995-2.219 2.219-2.219s2.219 0.995 2.219 2.219Zm3.698-5.917h16.271v-2.959H19.229v2.959Z'
|
||||
fill='#F1F1F1'
|
||||
/>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id='gf-gradient'
|
||||
x1='30.881'
|
||||
y1='16.452'
|
||||
x2='47.333'
|
||||
y2='32.9'
|
||||
gradientUnits='userSpaceOnUse'
|
||||
>
|
||||
<stop stopColor='#9575CD' />
|
||||
<stop offset='1' stopColor='#7E57C2' />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
[Google Forms](https://forms.google.com) is Google's online survey and form tool that allows users to create forms, collect responses, and analyze results. As part of Google's productivity suite, Google Forms makes it easy to gather information, feedback, and data from users.
|
||||
|
||||
Learn how to integrate the Google Forms tool in Sim to automatically read and process form responses in your workflows. This tutorial walks you through connecting Google Forms, retrieving responses, and using collected data to power automation. Perfect for syncing survey results, registrations, or feedback with your agents in real-time.
|
||||
|
||||
With Google Forms, you can:
|
||||
|
||||
- **Create surveys and forms**: Design custom forms for feedback, registration, quizzes, and more
|
||||
- **Collect responses automatically**: Gather data from users in real-time
|
||||
- **Analyze results**: View responses in Google Forms or export to Google Sheets for further analysis
|
||||
- **Collaborate easily**: Share forms and work with others to build and review questions
|
||||
- **Integrate with other Google services**: Connect with Google Sheets, Drive, and more
|
||||
|
||||
In Sim, the Google Forms integration enables your agents to programmatically access form responses. This allows for powerful automation scenarios such as processing survey data, triggering workflows based on new submissions, and syncing form results with other tools. Your agents can fetch all responses for a form, retrieve a specific response, and use the data to drive intelligent automation. By connecting Sim with Google Forms, you can automate data collection, streamline feedback processing, and incorporate form responses into your agent's capabilities.
|
||||
{/* MANUAL-CONTENT-END */}
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Forms into your workflow. Provide a Form ID to list responses, or specify a Response ID to fetch a single response. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
## Tools
|
||||
|
||||
### `google_forms_get_responses`
|
||||
|
||||
#### Input
|
||||
|
||||
| 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
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `data` | json | Response or list of responses |
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `google_forms`
|
||||
@@ -58,7 +58,7 @@ In Sim, the Google Search integration enables your agents to search the web prog
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Searches the web using the Google Custom Search API, which provides high-quality search results from the entire internet or a specific site defined by a custom search engine ID.
|
||||
Integrate Google Search into the workflow. Can search the web. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ In Sim, the Google Sheets integration enables your agents to interact directly w
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate Google Sheets functionality to manage spreadsheet data. Read data from specific ranges, write new data, update existing cells, and append data to the end of sheets using OAuth authentication. Supports various input and output formats for flexible data handling.
|
||||
Integrate Google Sheets into the workflow. Can read, write, append, and update data. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ In Sim, the HuggingFace integration enables your agents to programmatically gene
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Generate completions using Hugging Face Inference API with access to various open-source models. Leverage cutting-edge AI models for chat completions, content generation, and AI-powered conversations with customizable parameters.
|
||||
Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ In Sim, the Hunter.io integration enables your agents to programmatically search
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Search for email addresses, verify their deliverability, discover companies, and enrich contact data using Hunter.io's powerful email finding capabilities.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ In Sim, the DALL-E integration enables your agents to generate images programmat
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Create high-quality images using OpenAI's image generation models. Configure resolution, quality, style, and other parameters to get exactly the image you need.
|
||||
Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ This integration is particularly valuable for building agents that need to gathe
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Transform web content into clean, readable text using Jina AI's advanced extraction capabilities. Extract meaningful content from websites while preserving important information and optionally gathering links.
|
||||
Integrate Jina into the workflow. Extracts content from websites. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ In Sim, the Jira integration allows your agents to seamlessly interact with your
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Connect to Jira workspaces to read, write, and update issues. Access content, metadata, and integrate Jira documentation into your workflows.
|
||||
Integrate Jira into the workflow. Can read, write, and update issues. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ Retrieve detailed information about a specific Jira issue
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `domain` | string | Yes | Your Jira domain \(e.g., yourcompany.atlassian.net\) |
|
||||
| `projectId` | string | No | Jira project ID to retrieve issues from. If not provided, all issues will be retrieved. |
|
||||
| `projectId` | string | No | Jira project ID \(optional; not required to retrieve a single issue\). |
|
||||
| `issueKey` | string | Yes | Jira issue key to retrieve \(e.g., PROJ-123\) |
|
||||
| `cloudId` | string | No | Jira Cloud ID for the instance. If not provided, it will be fetched using the domain. |
|
||||
|
||||
@@ -49,7 +49,7 @@ In Sim, the Knowledge Base block enables your agents to perform intelligent sema
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Perform semantic vector search across knowledge bases, upload individual chunks to existing documents, or create new documents from text content. Uses advanced AI embeddings to understand meaning and context for search operations.
|
||||
Integrate Knowledge into the workflow. Can search, upload chunks, and create documents.
|
||||
|
||||
|
||||
|
||||
@@ -10,11 +10,8 @@ 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
|
||||
@@ -42,7 +39,7 @@ In Sim, the Linear integration allows your agents to seamlessly interact with yo
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate with Linear to fetch, filter, and create issues directly from your workflow.
|
||||
Integrate Linear into the workflow. Can read and create issues. Requires OAuth.
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ To implement Linkup in your agent, simply add the tool to your agent's configura
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Linkup Search allows you to search and retrieve up-to-date information from the web with source attribution.
|
||||
Integrate Linkup into the workflow. Can search the web. Requires API Key.
|
||||
|
||||
|
||||
|
||||
70
apps/docs/content/docs/en/tools/mail.mdx
Normal file
70
apps/docs/content/docs/en/tools/mail.mdx
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: Mail
|
||||
description: Send emails using the internal mail service
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="mail"
|
||||
color="#181C1E"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
|
||||
|
||||
viewBox='0 0 30 24'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<path
|
||||
d='M2.35742 5.83288L11.7674 12.1071C13.0656 12.9712 13.7141 13.404 14.4151 13.5725C15.0352 13.7208 15.681 13.7208 16.2998 13.5725C17.0008 13.404 17.6492 12.9712 18.9475 12.1071L28.3574 5.83288M8.82844 21.7219H21.8864C24.1513 21.7219 25.2837 21.7219 26.1492 21.2811C26.9097 20.8931 27.5278 20.2744 27.9152 19.5137C28.3574 18.6482 28.3574 17.5158 28.3574 15.2509V7.97102C28.3574 5.70616 28.3574 4.57373 27.9166 3.70823C27.5288 2.94727 26.9102 2.32858 26.1492 1.94084C25.2837 1.5 24.1513 1.5 21.8864 1.5H8.82844C6.56358 1.5 5.43115 1.5 4.56566 1.94084C3.80519 2.32881 3.187 2.94747 2.79961 3.70823C2.35742 4.57373 2.35742 5.70616 2.35742 7.97102V15.2509C2.35742 17.5158 2.35742 18.6482 2.79826 19.5137C3.186 20.2747 3.80469 20.8933 4.56566 21.2811C5.43115 21.7219 6.56358 21.7219 8.82844 21.7219Z'
|
||||
stroke='currentColor'
|
||||
strokeWidth='2.5'
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
/>
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
The Mail block allows you to send emails directly from your workflows using Sim's own mail sending infrastructure powered by [Resend](https://resend.com/). This integration enables you to programmatically deliver notifications, alerts, and other important information to users' email addresses without requiring any external configuration or OAuth.
|
||||
|
||||
Our internal mail service is designed for reliability and ease of use, making it ideal for automating communications and ensuring your messages reach recipients efficiently.
|
||||
{/* MANUAL-CONTENT-END */}
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Send emails directly using the internal mail service. Uses MAIL_BLOCK_FROM_ADDRESS if configured, otherwise falls back to FROM_EMAIL_ADDRESS. No external configuration or OAuth required. Perfect for sending notifications, alerts, or general purpose emails from your workflows. Supports HTML formatting.
|
||||
|
||||
|
||||
|
||||
## Tools
|
||||
|
||||
### `mail_send`
|
||||
|
||||
Send an email using the internal mail service without requiring OAuth or external configuration
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `to` | string | Yes | Recipient email address |
|
||||
| `subject` | string | Yes | Email subject |
|
||||
| `body` | string | Yes | Email body content |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `success` | boolean | Whether the email was sent successfully |
|
||||
| `to` | string | Recipient email address |
|
||||
| `subject` | string | Email subject |
|
||||
| `body` | string | Email body content |
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `mail`
|
||||
40
apps/docs/content/docs/en/tools/mcp.mdx
Normal file
40
apps/docs/content/docs/en/tools/mcp.mdx
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: MCP Tool
|
||||
description: Execute tools from Model Context Protocol (MCP) servers
|
||||
---
|
||||
|
||||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="mcp"
|
||||
color="#181C1E"
|
||||
icon={true}
|
||||
iconSvg={`<svg className="block-icon"
|
||||
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
viewBox='0 0 24 24'
|
||||
fill='none'
|
||||
stroke='currentColor'
|
||||
strokeWidth='2'
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
>
|
||||
<rect x='2' y='2' rx='2' ry='2' />
|
||||
<rect x='2' y='14' rx='2' ry='2' />
|
||||
<line x1='6' x2='6.01' y1='6' y2='6' />
|
||||
<line x1='6' x2='6.01' y1='18' y2='18' />
|
||||
</svg>`}
|
||||
/>
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Integrate MCP into the workflow. Can execute tools from MCP servers. Requires MCP servers in workspace settings.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Category: `tools`
|
||||
- Type: `mcp`
|
||||
@@ -44,7 +44,7 @@ In Sim, the Mem0 integration enables your agents to maintain persistent memory a
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Add, search, retrieve, and delete memories using Mem0. Store conversation history, user preferences, and context across workflow executions for enhanced AI agent capabilities.
|
||||
Integrate Mem0 into the workflow. Can add, search, and retrieve memories. Requires API Key.
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Create persistent storage for data that needs to be accessed across multiple workflow steps. Store and retrieve information throughout your workflow execution to maintain context and state.
|
||||
Integrate Memory into the workflow. Can add, get a memory, get all memories, and delete memories.
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"google_calendar",
|
||||
"google_docs",
|
||||
"google_drive",
|
||||
"google_forms",
|
||||
"google_search",
|
||||
"google_sheets",
|
||||
"huggingface",
|
||||
@@ -27,12 +28,15 @@
|
||||
"knowledge",
|
||||
"linear",
|
||||
"linkup",
|
||||
"mail",
|
||||
"mcp",
|
||||
"mem0",
|
||||
"memory",
|
||||
"microsoft_excel",
|
||||
"microsoft_planner",
|
||||
"microsoft_teams",
|
||||
"mistral_parse",
|
||||
"mongodb",
|
||||
"mysql",
|
||||
"notion",
|
||||
"onedrive",
|
||||
@@ -49,6 +53,7 @@
|
||||
"serper",
|
||||
"sharepoint",
|
||||
"slack",
|
||||
"sms",
|
||||
"stagehand",
|
||||
"stagehand_agent",
|
||||
"supabase",
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user