* fix(verbiage): more explicit verbiage on some dialog menus, google drive updates, advanved to additional fields, remove general settings store sync in favor of tanstack
* updated docs
* nested tag dropdown, more well-defined nested outputs, keyboard nav for context menus, etc
* cleanup
* allow cannonical toggle even if depends on not satisfied
* remove smooth scroll in tag drop
* fix selection
* fix
---------
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* improvement(tools): added visibility for tools that were missing it, added new google tools
* fixed the name for google forms
* revert schema enrichers change
* fixed block ordering
* improvement(deployed-mcp): added the ability to make the visibility for deployed mcp tools public, updated UX
* use reactquery
* migrated chats to use reactquery, upgraded entire deploymodal to use reactquery instead of manual state management
* added hooks for chat chats and updated callers to all use reactquery
* fix
* updated comments
* consolidated utils
* fix(webflow): fix collection & site dropdown in webflow triggers
* added form submission trigger to webflow
* fix(webflow): added form submission trigger and scope
* fixed function signatures
* improvement(presence): show presence for the same user in another tab, fix z-index of multiplayer cursor to fall behind panel,terminal,sidebar but above blocks, improved connection detection
* upsert users into presence list
* improvement(permissions): added ability to auto-add new org members to existing permission group, disallow disabling of start block
* ran migrations
* add deploy modal tabs config to perm groups
* fix ordering of access control listings
* prep staging merge
* regen migrations
---------
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* feat(workflow-controls): added action bar for picker/hand/undo/redo/zoom workflow controls, added general setting to disable
* added util for fit to zoom that accounts for sidebar, terminal, and panel
* ack PR comments
* remove dead state variable, add logs
* improvement(ui/ux): action bar, panel, tooltip, dragging, invite modal
* added fit to view in canvas context menu
* fix(theme): dark mode flash
* fix: duplicate fit to view
* refactor: popovers; improvement: notifications, diff controls, action bar
* improvement(action-bar): ui/ux
* refactor(action-bar): renamed to workflow controls
* ran migrations
* fix: deleted migration
---------
Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
* added back trace spans to notifications
* fixed double verification code
* fix dashboard
* updated welcome email
* added link to cal for team
* update dashboard stats route
* added react grab URL to CSP if FF is enabled, removed dead db hook
* fix failing test
* ensure MCP add server tool is centered
* updated A2A copy button and MCP location, and default description matching
* updated button on chat page
* added vite version override
* fix
* fix(agent-tools): added special handling for workflow tool in agent tool input, added react grab
* FF react grab
* ack comments
* updated to account for workflow input tool on top of just workflow as well
* fix(triggers): package lemlist data, cleanup trigger outputs formatting, fix display name issues
* cleanup trigger outputs
* fix tests
* more test fixes
* remove branch field for ones where it's not relevant
* remove branch from unrelated ops
* fix)comparison): add condition to prevent duplicate identical edges, ignore from workflow change detection
* fix failing test
* added back store check
* feat(tool): added introspection tools for all db integrations
* added sanitization for sql schema
* ack pr comments, with clarifying comments
* moved util
* feat(tools): added workflow tools to agent tools dropdown for discoverability, enforce perms on client for redeploying via the agent
* added perms enforcement to workflow block header as well
* improvement(response): only allow singleton
* respect singleton triggers and blocks in copilot
* don't show dup button for response
* fix error message
* feat(permission-groups): integration/model access controls for enterprise
* feat: enterprise gating for BYOK, SSO, credential sets with org admin/owner checks
* execution time enforcement of mcp and custom tools
* add admin routes to cleanup permission group data
* fix not being on enterprise checks
* separate out orgs from billing system
* update the docs
* add custom tool blockers based on perm configs
* add migrations
* fix
* address greptile comments
* regen migrations
* fix default model picking based on user config
* cleaned up UI
* feat(sidebar): context menu for nav items in sidebar
* added toolbar context menu, fixed incorrect access pattern in old context menus and added docs for missing blocks
* fixed links
* fix(tools): fixed wrokflow tool for agent to respect user provided params, inject at runtime like all other tools
* ack comments
* remove redunant if-else
* added tests
* improvement(billng): team upgrade + session management
* remove comments
* session updates should be atomic
* make consistent for onSubscritionUpdate
* plan upgrade to refresh session
* fix var name
* remove dead code
* preserve params
* progress on cred sets
* fix credential set system
* return data to render credential set in block preview
* progress
* invite flow
* simplify code
* fix ui
* fix tests
* fix types
* fix
* fix icon for outlook
* fix cred set name not showing up for owner
* fix rendering of credential set name
* fix outlook well known folder id resolution
* fix perms for creating cred set
* add to docs and simplify ui
* consolidate webhook code better
* fix tests
* fix credential collab logic issue
* fix ui
* fix lint
* feat(fireflies): added fireflies tools and trigger
* finished fireflies
* added wandConfig to all timestamp subblocks on the platform
* added current time to timestamp wand generation
* fix file upload subblock styling, tested all fireflies ops
* removed dropdown for trigger for fireflies
* updated docs
* added fireflies to formatWebhookInput
* added more wandConfigs
* feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date
* removed unused params, cleaned up redundant utils
* fix(parallel): add parallel sentinel to make parallel-parallel and parallel-loop work correctly
* fix regular -> parallel + copilot nested subflows
* add tests
* consolidate to always explode parallel dag at runtime
* improvement(schedules): use tanstack query to fetch schedule data, cleanup ui on schedule info component
* update trigger-save UI, increase auto disable to 100 consecutive from 10
* updated docs
* consolidate consts
* improvement(variables): update workflows to use deployed variables, not local ones to align with the rest of the canvas components
* update change detection to ignore trigger id since it is runtime metadata and not actually required to be redeployed
* improvement(logs): state machine of workflow execution
* cleanup more code
* fallback consistency
* fix labels
* backfill in migration correctly
* make streaming stop in chat window correctly
* improvement(usage-limit): update usage in real time, fix token output object
* updated tokenBreakdown to tokens, standardized input/output/total token object type across providers
* update remaining references
* ack PR comment
* remove singleton query client instance from hooks, leave only in zustand
* fixed logs for parallel and loop execution flow
* Fix array check for collection
* fixed for empty loop and paralle blocks and showing input on dashboard
* extracted utility functions
* fixed the refrencing errors and making sure it propogates to the console
* fix parallel
* fix tests'
---------
Co-authored-by: priyanshu.solanki <priyanshu.solanki@saviynt.com>
Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* fix(search): removed full text param from built-in search, anthropic provider streaming fix
* rewrite gemini provider with official sdk + add thinking capability
* vertex gemini consolidation
* never silently use different model
* pass oauth client through the googleAuthOptions param directly
* make server side provider registry
* remove comments
* take oauth selector below model selector
---------
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Reddit API requires User-Agent header for all requests including OAuth
token refresh. Without it, requests fail with 403 error after the
initial token expires.
Fixes#1822
* improvement(pricing): increase free user limit to 20 usd
* make gemini pricing accurate
* generate migration for db constant
* update docs
* test notif data
* fix(vars): add socket persistence when variable names are changed, update variable name normalization to match block name normalization, added space constraint on envvar names
* removed redundant queueing, removed unused immediate flag from sockets ops
* ack PR comments
* creating boolean, number and date tags with different equality matchings
* feat: add UI for tag field types with filter operators
- Update base-tags-modal with field type selector dropdown
- Update document-tags-modal with different input types per fieldType
- Update knowledge-tag-filters with operator dropdown and type-specific inputs
- Update search routes to support all tag slot types
- Update hook to use AllTagSlot type
* feat: add field type support to document-tag-entry component
- Add dropdown with all field types (Text, Number, Date, Boolean)
- Render different value inputs based on field type
- Update slot counting to include all field types (28 total)
* fix: resolve MAX_TAG_SLOTS error and z-index dropdown issue
- Replace MAX_TAG_SLOTS with totalSlots in document-tag-entry
- Add z-index to SelectContent in base-tags-modal for proper layering
* fix: handle non-text columns in getTagUsage query
- Only apply empty string check for text columns (tag1-tag7)
- Numeric/date/boolean columns only check IS NOT NULL
- Cast values to text for consistent output
* refactor: use EMCN components for KB UI
- Replace @/components/ui imports with @/components/emcn
- Use Combobox instead of Select for dropdowns
- Use EMCN Switch, Button, Input, Label components
- Remove unsupported 'size' prop from EMCN Button
* fix: layout for delete button next to date picker
- Change delete button from absolute to inline positioning
- Add proper column width (w-10) for delete button
- Add empty header cell for delete column
- Apply fix to both document-tag-entry and knowledge-tag-filters
* fix: clear value when switching tag field type
- Reset value to empty when changing type (e.g., boolean to text)
- Reset value when tag name changes and type differs
- Prevents 'true'/'false' from sticking in text inputs
* feat: add full support for number/date/boolean tag filtering in KB search
- Copy all tag types (number, date, boolean) from document to embedding records
- Update processDocumentTags to handle all field types with proper type conversion
- Add number/date/boolean columns to document queries in checkDocumentWriteAccess
- Update chunk creation to inherit all tag types from parent document
- Add getSearchResultFields helper for consistent query result selection
- Support structured filters with operators (eq, gt, lt, between, etc.)
- Fix search queries to include all 28 tag fields in results
* fixing tags import issue
* fix rm file
* reduced number to 3 and date to 2
* fixing lint
* fixed the prop size issue
* increased number from 3 to 5 and boolean from 7 to 2
* fixed number the sql stuff
* progress
* fix document tag and kb tag modals
* update datepicker emcn component
* fix ui
* progress on KB block tags UI
* fix issues with date filters
* fix execution parsing of types for KB tags
* remove migration before merge
* regen migrations
* fix tests and types
* address greptile comments
* fix more greptile comments
* fix filtering logic for multiple of same row
* fix tests
---------
Co-authored-by: priyanshu.solanki <priyanshu.solanki@saviynt.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
* fix(subflow): prevent auto-connect across subflow edges with keyboard shortcut block additions, make positioning for auto-drop smarter
* stronger typing
* fix(autofill): add dummy inputs to prevent browser autofill for various fields, prevent having 0 workflows in workspace
* cleanup
* ack PR comments
* fix failing test
* feat(og): add opengraph images for templates, blogs, and updated existing opengraph image for all other pages
* added to workspace templates page as well
* ack PR comments
* fix(oauth): updated oauth providers that had unstable reference IDs leading to duplicate oauth records (#2441)
* fix(oauth): updated oauth providers that had unstable reference IDs leading to duplicate oauth records
* ack PR comments
* ack PR comments
* cleanup salesforce refresh logic
* ack more PR comments
* feat(compare-schema): ci check to make sure schema.ts never goes out of sync with migrations
* test out of sync [do not merge]
* Revert "test out of sync [do not merge]"
This reverts commit 9771f66b84.
* fix(condition): used isolated vms for condition block RCE
* ack PR comment
* one more
* remove inputForm from sched, update loop condition to also use isolated vm
* hide servicenow
* feat(vertex): added vertex to list of supported providers
* added utils files for each provider, consolidated gemini utils, added dynamic verbosity and reasoning fetcher
* feat(service-now): added service now block
* fix: bun lock
* improvement: fixed @trigger.dev/sdk imports and removal of sentry blocks
* improvement: fixed @trigger.dev/sdk import
* improvement: fixed @trigger.dev/sdk import
* fix(servicenow): save accessTokenExpiresAt on initial OAuth account creation
* docs(servicenow): add ServiceNow tool documentation and icon mapping
* fixing bun lint issues
* fixing username/password fields
* fixing test file for refreshaccesstoken to support instance uri
* removing basic auth and fixing undo-redo/store.ts
* removed import set api code, changed CRUD operations to CRUD_record and added wand configuration to help users to generate JSON Arrays
---------
Co-authored-by: priyanshu.solanki <priyanshu.solanki@saviynt.com>
* make creator profile required
* fix grafana tag dropdown / outputs mismatch
* fix grafana annotations to make dashboard id required
* fix fal ai
* fix fal ai
* fix zep
* fix(tools): fix perplexity & parallel ai tag dropdown inaccuracies
* fixed stt, tts and added output conditions to conditionally display tag dropdown values based on other subblock values
* updated exa to match latest API
* feat(folders): add the ability to create a folder within a folder in popover (#2287)
* fix(agent): filter out empty params to ensure LLM can set tool params at runtime (#2288)
* fix(mcp): added backfill effect to add missing descriptions for mcp tools (#2290)
* fix(redis): cleanup access pattern across callsites (#2289)
* fix(redis): cleanup access pattern across callsites
* swap redis command to be non blocking
* improvement(log-details): polling, trace spans (#2292)
---------
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
* fix(custom-bot-slack): dependsOn incorrectly set for bot_token"
* fix other references to be compatible
* fix dependsOn for things depending on authMethod"
* feat(tools): added rds tools/block
* feat(tools): added rds, dynamodb, background color gradient
* changed conditions for WHERE condition to be json conditions instead of raw string
* fix(team-plans): track departed member usage so value not lost
* reset usage to 0 when they leave team
* prep merge with stagig
* regen migrations
* fix org invite + ws selection'
---------
Co-authored-by: Waleed <walif6@gmail.com>
* feat(agent): added workflow, kb, and function as a tool for agent block
* fix keyboard nav and keyboard selection in tool-inp
* ack PR comments
* remove custom tool changes
* fixed kb tools for agent
* cleanup
* feat(tools): added speech to text with openai whisper, elevenlabs, and deepgram
* added new file icons, implemented ffmpeg
* updated docs
* revert environment
* added blacksmith optimizations to workflows and dockerfiles to enhance performance. please review before pushing to production
* remove cache from and cache to directives from docker based actions, per blacksmith docs
---------
Co-authored-by: Connor Mulholland <connormul@Connors-MacBook-Pro.local>
* fix(subflows): add loops/parallels to accessible list of blocks in the tag dropdown when contained withitn a subflow
* remove currentIteration in loop
* improvement(docs): remove copy page from mobile view on docs
* bring title and pagenav lower on mobile
* added cursor pointer to clickable components in docs
* fix(triggers): dedup + not surfacing deployment status log
* fix ms teams
* change to microsoftteams
* Revert "change to microsoftteams"
This reverts commit 217f808641.
* fix
* fix
* fix provider name
* fix oauth for msteams
* feat(billing): add notif for first failed payment, added upgrade email from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect
* fix build
* ack PR comments
* fix(custom-tools): updates to existing tools
* don't reorder custom tools in modal based on edit time
* restructure custom tools to persist copilot generated tools
* fix tests
* fix(templates): view current ui
* update UI to be less cluttered
* make state management for creating user profile smoother
* fix autoselect logic
* fix lint
* improvement(docs): added new platform ss
* rename approval to human in the loop
* cleanup
* remove yml
* removed other languages large sections
* fix icons
* Add helm for copilot
* Remove otel and log level
* Change repo name
* improvement(helm): enhance copilot chart with HA support and validation
* refactor(helm): consolidate copilot secrets and fix postgres volume mount
* feat(tools): added 10 new github triggers
* feat(tools): added 48 new github tools, 12 triggers
* fix(logging): make logging safe start an upsert to prevent insertions of duplicate execution id records, remove layout from github block
* feat(schedules): move schedule configuration out of modals into subblocks
* added more timezones
* added simple in-memory rate limiting to update schedule, validation on numeric values for date and time, fix update schedule behavior
* fix failing tests, ack PR comments
* surface better errors
* improvement(variables): add error context for duplicate variable names, only check for collision when focus is lost
* disallow empty variable names, performance optimizations
* safety guard against empty variables names
* feat(triggers): make triggers use existing subblock system, need to still fix webhook URL on multiselect and add script in text subblock for google form
* minimize added subblocks, cleanup code, make triggers first-class subblock users
* remove multi select dropdown and add props to existing dropdown instead
* cleanup dropdown
* add socket op to delete external webhook connections on block delete
* establish external webhook before creating webhook DB record, surface better errors for ones that require external connections
* fix copy button in short-input
* revert environment.ts, cleanup
* add triggers registry, update copilot tool to reflect new trigger setup
* update trigger-save subblock
* clean
* cleanup
* remove unused subblock store op, update search modal to reflect list of triggers
* add init from workflow to subblock store to populate new subblock format from old triggers
* fix mapping of old names to new ones
* added debug logging
* remove all extraneous debug logging and added mapping for triggerConfig field names that were changed
* fix trigger config for triggers w/ multiple triggers
* edge cases for effectiveTriggerId
* cleaned up
* fix dropdown multiselect
* fix multiselect
* updated short-input copy button
* duplicate blocks in trigger mode
* ack PR comments
* feat(cost): added hidden cost breakdown component to settings > subscription, start collecting current period copilot cost and last period copilot cost
* don't rerender envvars when switching between workflows in the same workspace
* feat(envvars): use cache for envvar dropdown key names, prevent autofill & suggestions in the settings
* add the same prevention for autocomplete and suggestions to sso and webhook
* fix(kb): fix mistral parse and kb uploads, include userId in internal auth
* update updated_at for kb when adding a new doc via knowledge block
* update tests
* Add variables block
* Add wait block
* While loop v1
* While loop v1
* Do while loops
* Copilot user input rerender fix
* Fix while and dowhile
* Vars block dropdown
* While loop docs
* Remove vars block coloring
* Fix lint
* Link docs to wait
* Fix build fail
* remove extraneous text from careers app
* feat(kb): added sort order to kb
* updated styles of workspace selector and delete button to match theme of rest of knowledgebase
* added google forms scope and google drive scope
* added back file scope
---------
Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: Adam Gough <adamgough@Mac-530.lan>
* fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data
* apps/sim
* renaming
* remove relative import
* feat(supabase): added vector search tool and updated docs
* exclude generic webhook from docs gen
* change items to pages in meta.json for tools directory in the docs
* feat(webhooks): added optioanl input format to webhooks, added support for file uploads
* feat(webhooks): added input format component to generic webhook trigger, added file support
* consolidated execution files utils, extended presigned URL duration for async tasks
* fix(input-format): allow value field to be cleared
* don't let value field be detected as deployment change
* fix zep icon in docs
* exclude collapsed state
* improvement(response-copilot): make it use builder mode over editor mode to prevent json formatting issues
* change placeholder text
* fix conversion between builder and editor mode
* fix(chat-subs): always use next public app url env
* use getBaseUrl everywhere
* move remaining uses
* fix test
* change auth.ts and make getBaseUrl() call not top level for emails
* change remaining uses
* revert csp
* cleanup
* fix
* feat(mistal): added mistral as a provider, updated model prices
* remove the ability for a block to reference its own outluts
* fixed order of responses for guardrails block
* fix(webhooks): use next public app url instead of request origin for webhook registration
* ack PR comments
* ci: pin Bun to v1.2.22 to avoid Bun 1.3 breaking changes
* feat(deployed-chat): updated chat panel UI, deployed chat and API can now accept files
* added nested tag dropdown for files
* added duplicate file validation to chat panel
* update docs & SDKs
* fixed build
* rm extraneous comments
* ack PR comments, cut multiple DB roundtrips for permissions & api key checks in api/workflows
* allow read-only users to access deployment info, but not take actions
* add downloadable file to logs for files passed in via API
* protect files/serve route that is only used client-side
---------
Co-authored-by: waleed <waleed>
* feat(billing): bill by threshold to prevent cancellation edge case
* fix org billing
* fix idempotency key issue
* small optimization for team checks
* remove console log
* remove unused type
* fix error handling
* feat(chat-stream): updated workflow id execute route to support streaming via API
* enable streaming via api
* added only text stream option
* cleanup deployed preview componnet
* updated selectedOutputIds to selectedOutput
* updated TS and Python SDKs with async, rate limits, usage, and streaming API routes
* stream non-streaming blocks when streaming is specified
* fix(chat-panel): add onBlockComplete handler to chat panel to stream back blocks as they complete
* update docs
* cleanup
* ack PR comments
* updated next config
* removed getAssetUrl in favor of local assets
* resolve merge conflicts
* remove extra logic to create sensitive result
* simplify internal auth
* remove vercel blob from CSP + next config
* fix: enable database connection pooling in production
* debug: add diagnostic endpoints to test NODE_ENV and database pooling
* test: add connection testing endpoint to diagnose production delay
* redeuce num of concurrent connections
* add state sending capability
* progress
* add ability to add title and description to workflow state
* progress in language
* fix
* cleanup code
* fix type issue
* fix subflow deletion case
* Workflow console tool
* fix lint
---------
Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com>
* improvement(performance): remove writes to workflow updated_at on position updates for blocks, edges, & subflows
* update query pattern for logs routes
* improvement(var-resolution): resolve variables with block name check and consolidate code
* fix tests
* fix type error
* fix var highlighting in kb tags
* fix kb tags
* improvement(autolayout): use live block heights / widths for autolayout to prevent overlaps
* improve layering algo for multiple trigger setting
* remove console logs
* add type annotation
* feat(permissions): allow admin workspace users to deploy workflows in workspaces they don't own
* fixed failing test
* added additional routes
* remove overly complex, unecessary test and fixed docs formatting
* follow DRY
* first push pre testing
* toosl working
* progress
* bun run lint
* added doc
* changed google client ID and secret back
* cleaned up oauth
* removed comment
* removed any and added manual content
---------
Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
* improvement(usage): bar execution if limits cannot be determined, init user stats record on user creation instead of in stripe plugin
* upsert user stats record in execution logger
* added add list items
(cherry picked from commit df6ea35d5bb975c03c7ec0c787bd915f34890ac0)
* bun run lint
* minor changes
---------
Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: Adam Gough <adamgough@Adams-MacBook-Pro.local>
* update infra and remove railway
* feat(signup): added back to login functionalityfrom OTP page
* remove placeholders from docker commands, simplified login flow
* Revert "update infra and remove railway"
This reverts commit abfa2f8d51.
* improvement(code-structure): move db into separate package
* make db separate package
* remake bun lock
* update imports to not maintain two separate ones
* fix CI for tests by adding dummy url
* vercel build fix attempt
* update bun lock
* regenerate bun lock
* fix mocks
* remove db commands from apps/sim package json
* update infra and remove railway
* improvement(landing): insert prompt into copilot panel from landing, open panel on entry
* Revert "update infra and remove railway"
This reverts commit abfa2f8d51.
* fixes
* remove debug logs
* go back to old env
2025-09-17 12:28:22 -07:00
6072 changed files with 1328595 additions and 230274 deletions
description: Create a block configuration for a Sim integration with proper subBlocks, conditions, and tool wiring
argument-hint: <service-name>
---
# Add Block Skill
You are an expert at creating block configurations for Sim. You understand the serializer, subBlock types, conditions, dependsOn, modes, and all UI patterns.
## Your Task
When the user asks you to create a block:
1. Create the block file in `apps/sim/blocks/blocks/{service}.ts`
2. Configure all subBlocks with proper types, conditions, and dependencies
See the `/add-trigger` skill for creating triggers.
## Icon Requirement
If the icon doesn't already exist in `@/components/icons.tsx`, **do NOT search for it yourself**. After completing the block, ask the user to provide the SVG:
```
The block is complete, but I need an icon for {Service}.
Please provide the SVG and I'll convert it to a React component.
You can usually find this in the service's brand/press kit page, or copy it from their website.
```
## Checklist Before Finishing
- [ ] All subBlocks have `id`, `title` (except switch), and `type`
-`canonicalParamId` must NOT match any other subblock's `id`, must be unique per block, and should only be used to link basic/advanced alternatives for the same parameter.
-`mode` only controls UI visibility, NOT serialization. Without `canonicalParamId`, both basic and advanced field values would be sent.
- Every subblock `id` must be unique within the block. Duplicate IDs cause conflicts even with different conditions.
description: Create tool configurations for a Sim integration by reading API docs
argument-hint: <service-name> [api-docs-url]
---
# Add Tools Skill
You are an expert at creating tool configurations for Sim integrations. Your job is to read API documentation and create properly structured tool files.
## Your Task
When the user asks you to create tools for a service:
1. Use Context7 or WebFetch to read the service's API documentation
2. Create the tools directory structure
3. Generate properly typed tool configurations
## Directory Structure
Create files in `apps/sim/tools/{service}/`:
```
tools/{service}/
├── index.ts # Barrel export
├── types.ts # Parameter & response types
└── {action}.ts # Individual tool files (one per operation)
description: Create webhook triggers for a Sim integration using the generic trigger builder
argument-hint: <service-name>
---
# Add Trigger Skill
You are an expert at creating webhook triggers for Sim. You understand the trigger system, the generic `buildTriggerSubBlocks` helper, and how triggers connect to blocks.
## Your Task
When the user asks you to create triggers for a service:
1. Research what webhook events the service supports
2. Create the trigger files using the generic builder
3. Register triggers and connect them to the block
In the block file (`apps/sim/blocks/blocks/{service}.ts`):
```typescript
import{{Service}Icon}from'@/components/icons'
import{getTrigger}from'@/triggers'
importtype{BlockConfig}from'@/blocks/types'
exportconst{Service}Block: BlockConfig={
type:'{service}',
name:'{Service}',
// ... other config ...
// Enable triggers and list available trigger IDs
triggers:{
enabled: true,
available:[
'{service}_event_a',
'{service}_event_b',
'{service}_event_c',
'{service}_webhook',
],
},
subBlocks:[
// Regular tool subBlocks first
{id:'operation',/* ... */},
{id:'credential',/* ... */},
// ... other tool fields ...
// Then spread ALL trigger subBlocks
...getTrigger('{service}_event_a').subBlocks,
...getTrigger('{service}_event_b').subBlocks,
...getTrigger('{service}_event_c').subBlocks,
...getTrigger('{service}_webhook').subBlocks,
],
// ... tools config ...
}
```
## Automatic Webhook Registration (Preferred)
If the service's API supports programmatic webhook creation, implement automatic webhook registration instead of requiring users to manually configure webhooks. This provides a much better user experience.
### When to Use Automatic Registration
Check the service's API documentation for endpoints like:
-`POST /webhooks` or `POST /hooks` - Create webhook
-`DELETE /webhooks/{id}` - Delete webhook
Services that support this pattern include: Grain, Lemlist, Calendly, Airtable, Webflow, Typeform, etc.
### Implementation Steps
#### 1. Add API Key to Extra Fields
Update your `build{Service}ExtraFields` function to include an API key field:
1.**Dropdown** (only if `includeDropdown: true`) - Trigger type selector
2.**Webhook URL** - Read-only field with copy button
3.**Extra Fields** - Your service-specific fields (filters, options, etc.)
4.**Save Button** - Activates the trigger
5.**Instructions** - Setup guide for users
All fields automatically have:
-`mode: 'trigger'` - Only shown in trigger mode
-`condition: { field: 'selectedTriggerId', value: triggerId }` - Only shown when this trigger is selected
## Trigger Outputs & Webhook Input Formatting
### Important: Two Sources of Truth
There are two related but separate concerns:
1.**Trigger `outputs`** - Schema/contract defining what fields SHOULD be available. Used by UI for tag dropdown.
2.**`formatWebhookInput`** - Implementation that transforms raw webhook payload into actual data. Located in `apps/sim/lib/webhooks/utils.server.ts`.
**These MUST be aligned.** The fields returned by `formatWebhookInput` should match what's defined in trigger `outputs`. If they differ:
- Tag dropdown shows fields that don't exist (broken variable resolution)
- Or actual data has fields not shown in dropdown (users can't discover them)
### When to Add a formatWebhookInput Handler
- **Simple providers**: If the raw webhook payload structure already matches your outputs, you don't need a handler. The generic fallback returns `body` directly.
- **Complex providers**: If you need to transform, flatten, extract nested data, compute fields, or handle conditional logic, add a handler.
### Adding a Handler
In `apps/sim/lib/webhooks/utils.server.ts`, add a handler block:
```typescript
if(foundWebhook.provider==='{service}'){
// Transform raw webhook body to match trigger outputs
return{
eventType: body.type,
resourceId: body.data?.id||'',
timestamp: body.created_at,
resource: body.data,
}
}
```
**Key rules:**
- Return fields that match your trigger `outputs` definition exactly
- No wrapper objects like `webhook: { data: ... }` or `{service}: { ... }`
- No duplication (don't spread body AND add individual fields)
- Use `null` for missing optional data, not empty objects with empty strings
### Verify Alignment
Run the alignment checker:
```bash
bunx scripts/check-trigger-alignment.ts {service}
```
## Trigger Outputs
Trigger outputs use the same schema as block outputs (NOT tool outputs).
This directory contains configuration files for Visual Studio Code Dev Containers / GitHub Codespaces. Dev containers provide a consistent, isolated development environment for this project.
Development container configuration for VS Code Dev Containers and GitHub Codespaces.
## Contents
-`devcontainer.json` - The main configuration file that defines the development container settings
-`Dockerfile` - Defines the container image and development environment
-`docker-compose.yml` - Sets up the application and database containers
-`post-create.sh` - Script that runs when the container is created
-`.bashrc` - Custom shell configuration with helpful aliases
## Usage
### Prerequisites
## Prerequisites
- Visual Studio Code
- Docker installation:
-Docker Desktop (Windows/macOS)
- Docker Engine (Linux)
- VS Code Remote - Containers extension
- Docker Desktop or Podman Desktop
-VS Code Dev Containers extension
### Getting Started
## Getting Started
1. Open this project in Visual Studio Code
2.When prompted, click "Reopen in Container"
- Alternatively, press `F1` and select "Remote-Containers: Reopen in Container"
1. Open this project in VS Code
2.Click "Reopen in Container" when prompted (or press `F1` → "Dev Containers: Reopen in Container")
3. Wait for the container to build and initialize
4.The post-creation script will automatically:
4.Start developing with `sim-start`
- Install dependencies
- Set up environment variables
- Run database migrations
- Configure helpful aliases
The setup script will automatically install dependencies and run migrations.
5. Start the application with `sim-start` (alias for `bun run dev`)
## Development Commands
### Development Commands
### Running Services
The development environment includes these helpful aliases:
You have two options for running the development environment:
**Option 1: Run everything together (recommended for most development)**
```bash
sim-start # Runs both app and socket server using concurrently
```
**Option 2: Run services separately (useful for debugging individual services)**
- In the **app** container terminal: `sim-app` (starts Next.js app on port 3000)
- In the **realtime** container terminal: `sim-sockets` (starts socket server on port 3002)
### Other Commands
-`sim-start` - Start the development server
-`sim-migrate` - Push schema changes to the database
-`sim-generate` - Generate new migrations
-`sim-rebuild` - Build and start the production version
-`pgc` - Connect to the PostgreSQL database
-`check-db` - List all databases
### Using GitHub Codespaces
This project is also configured for GitHub Codespaces. To use it:
1. Go to the GitHub repository
2. Click the "Code" button
3. Select the "Codespaces" tab
4. Click "Create codespace on main"
This will start a new Codespace with the development environment already set up.
## Customization
You can customize the development environment by:
- Modifying `devcontainer.json` to add VS Code extensions or settings
- Updating the `Dockerfile` to install additional packages
- Editing `docker-compose.yml` to add services or change configuration
- Modifying `.bashrc` to add custom aliases or configurations
-`build` - Build the application
-`pgc` - Connect to PostgreSQL database
## Troubleshooting
If you encounter issues:
**Build errors**: Rebuild the container with `F1` → "Dev Containers: Rebuild Container"
1. Rebuild the container: `F1` → "Remote-Containers: Rebuild Container"
2. Check Docker logs for build errors
3. Verify Docker Desktop is running
4. Ensure all prerequisites are installed
**Port conflicts**: Ensure ports 3000, 3002, and 5432 are available
For more information, see the [VS Code Remote Development documentation](https://code.visualstudio.com/docs/remote/containers).
**Container runtime issues**: Verify Docker Desktop or Podman Desktop is running
## Technical Details
Services:
- **App container** (8GB memory limit) - Main Next.js application
- **Realtime container** (4GB memory limit) - Socket.io server for real-time features
- **Database** - PostgreSQL with pgvector extension
- **Migrations** - Runs automatically on container creation
You can develop with services running together or independently.
### Personalization
**Project commands** (`sim-start`, `sim-app`, etc.) are automatically available via `/workspace/.devcontainer/sim-commands.sh`.
**Personal shell customization** (aliases, prompts, etc.) should use VS Code's dotfiles feature:
1. Create a dotfiles repository (e.g., `github.com/youruser/dotfiles`)
2. Add your `.bashrc`, `.zshrc`, or other configs
3. Configure in VS Code Settings:
```json
{
"dotfiles.repository": "youruser/dotfiles",
"dotfiles.installCommand": "install.sh"
}
```
This separates project-specific commands from personal preferences, following VS Code best practices.
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.
Automated weekly translation updates for documentation.
This PR was automatically created by the scheduled weekly i18n workflow, updating translations for all supported languages using Lingo.dev AI translation engine.
See the [README](https://github.com/simstudio/sim/tree/main/packages/python-sdk) for usage instructions.
See the [README](https://github.com/simstudioai/sim/tree/main/packages/python-sdk) or the [docs](https://docs.sim.ai/sdks/python) for more information.
See the [README](https://github.com/simstudio/sim/tree/main/packages/ts-sdk) for usage instructions.
See the [README](https://github.com/simstudioai/sim/tree/main/packages/ts-sdk) or the [docs](https://docs.sim.ai/sdks/typescript) for more information.
ERRORS="${ERRORS}\n❌ Feature flags must not be hardcoded to boolean literals!\n\nFound hardcoded flags:\n${HARDCODED}\n\nFeature flags should derive their values from environment variables.\n"
fi
echo "Checking feature flag naming conventions..."
# Check that all export const (except functions) start with 'is'
# This finds exports like "export const someFlag" that don't start with "is" or "get"
ERRORS="${ERRORS}\n❌ Feature flags must use 'is' prefix for boolean flags!\n\nFound incorrectly named flags:\n${BAD_NAMES}\n\nExample: 'hostedMode' should be 'isHostedMode'\n"
fi
if [ -n "$ERRORS" ]; then
echo ""
echo -e "$ERRORS"
exit 1
fi
echo "✅ All feature flags are properly configured"
cd packages/db &&bunx drizzle-kit migrate --config=./drizzle.config.ts
```
5. Start the development servers:
**Recommended approach - run both servers together (from project root):**
5. Start development servers:
```bash
bun run dev:full
bun run dev:full# Starts both Next.js app and realtime socket server
```
This starts both the main Next.js application and the realtime socket server required for full functionality.
**Alternative - run servers separately:**
Next.js app (from project root):
```bash
bun run dev
```
Realtime socket server (from `apps/sim` directory in a separate terminal):
```bash
cd apps/sim
bun run dev:sockets
```
Or run separately: `bun run dev` (Next.js) and `cd apps/sim && bun run dev:sockets` (realtime).
## Copilot API Keys
@@ -161,6 +157,46 @@ 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` environment variable in your self-hosted apps/sim/.env file to that value
## Environment Variables
Key environment variables for self-hosted deployments. See [`.env.example`](apps/sim/.env.example) for defaults or [`env.ts`](apps/sim/lib/core/config/env.ts) for the full list.
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.',
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.
## Documentation Overview
This file provides an overview of our documentation. For full content of all pages, see ${baseUrl}/llms-full.txt
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Agent-Block verbindet deinen Workflow mit Large Language Models (LLMs). Er verarbeitet natürlichsprachliche Eingaben, ruft externe Tools auf und generiert strukturierte oder unstrukturierte Ausgaben.
<div className="flex justify-center">
<Image
src="/static/blocks/agent.png"
alt="Agent-Block-Konfiguration"
width={500}
height={400}
className="my-6"
/>
</div>
## Konfigurationsoptionen
### System-Prompt
Der System-Prompt legt die Betriebsparameter und Verhaltenseinschränkungen des Agenten fest. Diese Konfiguration definiert die Rolle des Agenten, die Antwortmethodik und die Verarbeitungsgrenzen für alle eingehenden Anfragen.
```markdown
You are a helpful assistant that specializes in financial analysis.
Always provide clear explanations and cite sources when possible.
When responding to questions about investments, include risk disclaimers.
```
### Benutzer-Prompt
Der Benutzer-Prompt stellt die primären Eingabedaten für die Inferenzverarbeitung dar. Dieser Parameter akzeptiert natürlichsprachlichen Text oder strukturierte Daten, die der Agent analysieren und auf die er reagieren wird. Zu den Eingabequellen gehören:
- **Statische Konfiguration**: Direkte Texteingabe, die in der Block-Konfiguration angegeben ist
- **Dynamische Eingabe**: Daten, die von vorgelagerten Blöcken über Verbindungsschnittstellen übergeben werden
- **Laufzeitgenerierung**: Programmatisch generierte Inhalte während der Workflow-Ausführung
### Modellauswahl
Der Agent-Block unterstützt mehrere LLM-Anbieter über eine einheitliche Inferenzschnittstelle. Verfügbare Modelle umfassen:
- **Lokale Modelle**: Ollama oder VLLM-kompatible Modelle
### Temperatur
Steuert die Zufälligkeit und Kreativität der Antworten:
- **Niedrig (0-0,3)**: Deterministisch und fokussiert. Am besten für faktische Aufgaben und Genauigkeit.
- **Mittel (0,3-0,7)**: Ausgewogene Kreativität und Fokus. Gut für allgemeine Verwendung.
- **Hoch (0,7-2,0)**: Kreativ und abwechslungsreich. Ideal für Brainstorming und Content-Generierung.
### API-Schlüssel
Ihr API-Schlüssel für den ausgewählten LLM-Anbieter. Dieser wird sicher gespeichert und für die Authentifizierung verwendet.
### Tools
Erweitern Sie die Fähigkeiten des Agenten mit externen Integrationen. Wählen Sie aus über 60 vorgefertigten Tools oder definieren Sie benutzerdefinierte Funktionen.
**Verfügbare Kategorien:**
- **Kommunikation**: Gmail, Slack, Telegram, WhatsApp, Microsoft Teams
- **Datenquellen**: Notion, Google Sheets, Airtable, Supabase, Pinecone
- **Webdienste**: Firecrawl, Google Search, Exa AI, Browser-Automatisierung
- **Auto**: Modell entscheidet kontextbasiert, wann Tools verwendet werden
- **Erforderlich**: Tool muss bei jeder Anfrage aufgerufen werden
- **Keine**: Tool verfügbar, aber dem Modell nicht vorgeschlagen
### Antwortformat
Der Parameter für das Antwortformat erzwingt die Generierung strukturierter Ausgaben durch JSON-Schema-Validierung. Dies gewährleistet konsistente, maschinenlesbare Antworten, die vordefinierten Datenstrukturen entsprechen:
```json
{
"type": "object",
"properties": {
"sentiment": {
"type": "string",
"enum": ["positive", "neutral", "negative"]
},
"summary": {
"type": "string",
"description": "Brief summary of the content"
}
},
"required": ["sentiment", "summary"]
}
```
Diese Konfiguration beschränkt die Ausgabe des Modells auf die Einhaltung des angegebenen Schemas, verhindert Freitextantworten und stellt die Generierung strukturierter Daten sicher.
### Zugriff auf Ergebnisse
Nach Abschluss eines Agenten können Sie auf seine Ausgaben zugreifen:
- **response**: Der Antworttext oder die strukturierten Daten des Agenten
- **toolExecutions**: Details zu allen Tools, die der Agent während der Ausführung verwendet hat
- **estimatedCost**: Geschätzte Kosten des API-Aufrufs (falls verfügbar)
## Erweiterte Funktionen
### Memory + Agent: Gesprächsverlauf
Verwenden Sie einen memory Block mit einer konsistenten memoryId (zum Beispiel, conversationHistory), um Nachrichten zwischen Durchläufen zu speichern und diesen Verlauf in den Prompt des Agenten einzubeziehen.
- Fügen Sie die Nachricht des Benutzers vor dem Agenten hinzu
- Lesen Sie den Gesprächsverlauf für den Kontext
- Hängen Sie die Antwort des Agenten nach dessen Ausführung an
Siehe den [`Memory`](/tools/memory) Blockverweis für Details.
## Ausgaben
- **`<agent.content>`**: Antworttext des Agenten
- **`<agent.tokens>`**: Token-Nutzungsstatistiken
- **`<agent.tool_calls>`**: Details zur Tool-Ausführung
- **`<agent.cost>`**: Geschätzte Kosten des API-Aufrufs
## Beispielanwendungsfälle
**Automatisierung des Kundenservice** - Bearbeitung von Anfragen mit Datenbank- und Tool-Zugriff
**Multi-Modell-Inhaltsanalyse** - Analyse von Inhalten mit verschiedenen KI-Modellen
```
Function (Process) → Agent (GPT-4o Technical) → Agent (Claude Sentiment) → Function (Report)
```
**Tool-gestützter Rechercheassistent** - Recherche mit Websuche und Dokumentenzugriff
```
Input → Agent (Google Search, Notion) → Function (Compile Report)
```
## Bewährte Praktiken
- **Sei spezifisch in System-Prompts**: Definiere die Rolle, den Ton und die Einschränkungen des Agenten klar. Je spezifischer deine Anweisungen sind, desto besser kann der Agent seinen vorgesehenen Zweck erfüllen.
- **Wähle die richtige Temperatureinstellung**: Verwende niedrigere Temperatureinstellungen (0-0,3), wenn Genauigkeit wichtig ist, oder erhöhe die Temperatur (0,7-2,0) für kreativere oder vielfältigere Antworten
- **Nutze Tools effektiv**: Integriere Tools, die den Zweck des Agenten ergänzen und seine Fähigkeiten erweitern. Sei selektiv bei der Auswahl der Tools, um den Agenten nicht zu überfordern. Für Aufgaben mit wenig Überschneidung verwende einen anderen Agent-Block für die besten Ergebnisse.
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der API-Block verbindet Ihren Workflow mit externen Diensten durch HTTP-Anfragen. Unterstützt GET, POST, PUT, DELETE und PATCH Methoden für die Interaktion mit REST-APIs.
<div className="flex justify-center">
<Image
src="/static/blocks/api.png"
alt="API-Block"
width={500}
height={400}
className="my-6"
/>
</div>
## Konfigurationsoptionen
### URL
Die Endpunkt-URL für die API-Anfrage. Diese kann sein:
- Eine statische URL, die direkt im Block eingegeben wird
- Eine dynamische URL, die mit der Ausgabe eines anderen Blocks verbunden ist
- Eine URL mit Pfadparametern
### Methode
Wählen Sie die HTTP-Methode für Ihre Anfrage:
- **GET**: Daten vom Server abrufen
- **POST**: Daten an den Server senden, um eine Ressource zu erstellen
- **PUT**: Eine bestehende Ressource auf dem Server aktualisieren
- **DELETE**: Eine Ressource vom Server entfernen
- **PATCH**: Eine bestehende Ressource teilweise aktualisieren
### Abfrageparameter
Definieren Sie Schlüssel-Wert-Paare, die als Abfrageparameter an die URL angehängt werden. Zum Beispiel:
```
Key: apiKey
Value: your_api_key_here
Key: limit
Value: 10
```
Diese würden der URL als `?apiKey=your_api_key_here&limit=10` hinzugefügt.
### Header
Konfigurieren Sie HTTP-Header für Ihre Anfrage. Häufige Header sind:
```
Key: Content-Type
Value: application/json
Key: Authorization
Value: Bearer your_token_here
```
### Anfragekörper
Für Methoden, die einen Anfragekörper unterstützen (POST, PUT, PATCH), können Sie die zu sendenden Daten definieren. Der Körper kann sein:
- JSON-Daten, die direkt im Block eingegeben werden
- Daten, die mit der Ausgabe eines anderen Blocks verbunden sind
- Dynamisch während der Workflow-Ausführung generiert
### Zugriff auf Ergebnisse
Nach Abschluss einer API-Anfrage können Sie auf folgende Ausgaben zugreifen:
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Bedingungsblock verzweigt die Workflow-Ausführung basierend auf booleschen Ausdrücken. Bewerten Sie Bedingungen anhand vorheriger Block-Ausgaben und leiten Sie zu verschiedenen Pfaden weiter, ohne dass ein LLM erforderlich ist.
<div className="flex justify-center">
<Image
src="/static/blocks/condition.png"
alt="Bedingungsblock"
width={500}
height={400}
className="my-6"
/>
</div>
## Konfigurationsoptionen
### Bedingungen
Definieren Sie eine oder mehrere Bedingungen, die ausgewertet werden. Jede Bedingung umfasst:
- **Ausdruck**: Ein JavaScript/TypeScript-Ausdruck, der zu wahr oder falsch ausgewertet wird
- **Pfad**: Der Zielblock, zu dem weitergeleitet werden soll, wenn die Bedingung wahr ist
- **Beschreibung**: Optionale Erklärung, was die Bedingung prüft
Sie können mehrere Bedingungen erstellen, die der Reihe nach ausgewertet werden, wobei die erste übereinstimmende Bedingung den Ausführungspfad bestimmt.
### Format für Bedingungsausdrücke
Bedingungen verwenden JavaScript-Syntax und können auf Eingabewerte aus vorherigen Blöcken verweisen.
**Benutzer-Onboarding-Ablauf** - Onboarding basierend auf Benutzertyp personalisieren
```
Function (Process) → Condition (account_type === 'enterprise') → Advanced or Simple
```
## Bewährte Praktiken
- **Bedingungen korrekt anordnen**: Platzieren Sie spezifischere Bedingungen vor allgemeinen, um sicherzustellen, dass spezifische Logik Vorrang vor Fallbacks hat
- **Verwenden Sie den Else-Zweig bei Bedarf**: Wenn keine Bedingungen übereinstimmen und der Else-Zweig nicht verbunden ist, endet der Workflow-Zweig ordnungsgemäß. Verbinden Sie den Else-Zweig, wenn Sie einen Fallback-Pfad für nicht übereinstimmende Fälle benötigen
- **Halten Sie Ausdrücke einfach**: Verwenden Sie klare, unkomplizierte boolesche Ausdrücke für bessere Lesbarkeit und einfachere Fehlersuche
- **Dokumentieren Sie Ihre Bedingungen**: Fügen Sie Beschreibungen hinzu, um den Zweck jeder Bedingung für bessere Teamzusammenarbeit und Wartung zu erklären
- **Testen Sie Grenzfälle**: Überprüfen Sie, ob Bedingungen Grenzwerte korrekt behandeln, indem Sie mit Werten an den Grenzen Ihrer Bedingungsbereiche testen
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Evaluator-Block nutzt KI, um die Inhaltsqualität anhand benutzerdefinierter Metriken zu bewerten. Perfekt für Qualitätskontrolle, A/B-Tests und um sicherzustellen, dass KI-Ausgaben bestimmte Standards erfüllen.
<div className="flex justify-center">
<Image
src="/static/blocks/evaluator.png"
alt="Evaluator-Block-Konfiguration"
width={500}
height={400}
className="my-6"
/>
</div>
## Konfigurationsoptionen
### Bewertungsmetriken
Definieren Sie benutzerdefinierte Metriken, anhand derer Inhalte bewertet werden. Jede Metrik umfasst:
- **Name**: Eine kurze Bezeichnung für die Metrik
- **Beschreibung**: Eine detaillierte Erklärung, was die Metrik misst
- **Bereich**: Der numerische Bereich für die Bewertung (z.B. 1-5, 0-10)
Beispielmetriken:
```
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?
```
### Inhalt
Der zu bewertende Inhalt. Dies kann sein:
- Direkt in der Blockkonfiguration bereitgestellt
- Verbunden mit der Ausgabe eines anderen Blocks (typischerweise ein Agent-Block)
- Dynamisch während der Workflow-Ausführung generiert
### Modellauswahl
Wählen Sie ein KI-Modell für die Durchführung der Bewertung:
- **Verwenden Sie spezifische Metrikbeschreibungen**: Definieren Sie klar, was jede Metrik misst, um genauere Bewertungen zu erhalten
- **Wählen Sie geeignete Bereiche**: Wählen Sie Bewertungsbereiche, die ausreichend Granularität bieten, ohne zu komplex zu sein
- **Verbinden Sie mit Agent-Blöcken**: Verwenden Sie Evaluator-Blöcke, um die Ausgaben von Agent-Blöcken zu bewerten und Feedback-Schleifen zu erstellen
- **Verwenden Sie konsistente Metriken**: Für vergleichende Analysen sollten Sie konsistente Metriken über ähnliche Bewertungen hinweg beibehalten
- **Kombinieren Sie mehrere Metriken**: Verwenden Sie verschiedene Metriken, um eine umfassende Bewertung zu erhalten
Der Funktionsblock führt benutzerdefinierten JavaScript- oder TypeScript-Code in Ihren Workflows aus. Transformieren Sie Daten, führen Sie Berechnungen durch oder implementieren Sie benutzerdefinierte Logik.
<div className="flex justify-center">
<Image
src="/static/blocks/function.png"
alt="Funktionsblock mit Code-Editor"
width={500}
height={400}
className="my-6"
/>
</div>
## Ausgaben
- **`<function.result>`**: Der von Ihrer Funktion zurückgegebene Wert
- **`<function.stdout>`**: Console.log()-Ausgabe Ihres Codes
## Beispielanwendungsfälle
**Datenverarbeitungspipeline** - Transformation von API-Antworten in strukturierte Daten
```
API (Fetch) → Function (Process & Validate) → Function (Calculate Metrics) → Response
```
**Implementierung von Geschäftslogik** - Berechnung von Treuepunkten und Stufen
```
Agent (Get History) → Function (Calculate Score) → Function (Determine Tier) → Condition (Route)
```
**Datenvalidierung und -bereinigung** - Validierung und Bereinigung von Benutzereingaben
```
Input → Function (Validate & Sanitize) → API (Save to Database)
```
### Beispiel: Treuepunkte-Rechner
```javascript title="loyalty-calculator.js"
// Process customer data and calculate loyalty score
import { Callout } from 'fumadocs-ui/components/callout'
import { Image } from '@/components/ui/image'
import { Video } from '@/components/ui/video'
Der Guardrails-Block validiert und schützt Ihre KI-Workflows, indem er Inhalte anhand mehrerer Validierungstypen überprüft. Stellen Sie die Datenqualität sicher, verhindern Sie Halluzinationen, erkennen Sie personenbezogene Daten und erzwingen Sie Formatanforderungen, bevor Inhalte durch Ihren Workflow fließen.
<div className="flex justify-center">
<Image
src="/static/blocks/guardrails.png"
alt="Guardrails-Block"
width={500}
height={400}
className="my-6"
/>
</div>
## Validierungstypen
### JSON-Validierung
Überprüft, ob der Inhalt korrekt formatiertes JSON ist. Perfekt, um sicherzustellen, dass strukturierte LLM-Ausgaben sicher geparst werden können.
**Anwendungsfälle:**
- Validierung von JSON-Antworten aus Agent-Blöcken vor dem Parsen
- Sicherstellen, dass API-Payloads korrekt formatiert sind
- Überprüfung der Integrität strukturierter Daten
**Ausgabe:**
- `passed`: `true` bei gültigem JSON, sonst `false`
Prüft, ob der Inhalt einem bestimmten regulären Ausdrucksmuster entspricht.
**Anwendungsfälle:**
- Validierung von E-Mail-Adressen
- Überprüfung von Telefonnummernformaten
- Verifizierung von URLs oder benutzerdefinierten Kennungen
- Durchsetzung spezifischer Textmuster
**Konfiguration:**
- **Regex-Muster**: Der reguläre Ausdruck, gegen den geprüft wird (z.B. `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` für E-Mails)
**Ausgabe:**
- `passed`: `true` wenn der Inhalt dem Muster entspricht, sonst `false`
- `error`: Fehlermeldung bei fehlgeschlagener Validierung
### Halluzinationserkennung
Verwendet Retrieval-Augmented Generation (RAG) mit LLM-Bewertung, um zu erkennen, wann KI-generierte Inhalte im Widerspruch zu Ihrer Wissensdatenbank stehen oder nicht darin begründet sind.
**Funktionsweise:**
1. Abfrage Ihrer Wissensdatenbank nach relevantem Kontext
2. Übermittlung sowohl der KI-Ausgabe als auch des abgerufenen Kontexts an ein LLM
**Halluzinationen verhindern** - Validieren Sie Kundendienstantworten anhand der Wissensdatenbank
```
Agent (Response) → Guardrails (Check KB) → Condition (Score ≥ 3) → Send or Flag
```
**PII in Benutzereingaben blockieren** - Bereinigen Sie von Benutzern übermittelte Inhalte
```
Input → Guardrails (Detect PII) → Condition (No PII) → Process or Reject
```
## Bewährte Praktiken
- **Verkettung mit Bedingungsblöcken**: Verwenden Sie `<guardrails.passed>`, um die Workflow-Logik basierend auf Validierungsergebnissen zu verzweigen
- **JSON-Validierung vor dem Parsen verwenden**: Validieren Sie immer die JSON-Struktur, bevor Sie versuchen, LLM-Ausgaben zu parsen
- **Geeignete PII-Typen auswählen**: Wählen Sie nur die für Ihren Anwendungsfall relevanten PII-Entitätstypen für bessere Leistung
- **Angemessene Konfidenzgrenzwerte festlegen**: Passen Sie für die Halluzinationserkennung den Grenzwert an Ihre Genauigkeitsanforderungen an (höher = strenger)
- **Starke Modelle für die Halluzinationserkennung verwenden**: GPT-4o oder Claude 3.7 Sonnet bieten genauere Konfidenzwerte
- **PII für die Protokollierung maskieren**: Verwenden Sie den Modus "Mask", wenn Sie Inhalte protokollieren oder speichern müssen, die PII enthalten könnten
- **Regex-Muster testen**: Validieren Sie Ihre Regex-Muster gründlich, bevor Sie sie in der Produktion einsetzen
- **Validierungsfehler überwachen**: Verfolgen Sie `<guardrails.error>`Nachrichten, um häufige Validierungsprobleme zu identifizieren
<Callout type="info">
Die Validierung von Guardrails erfolgt synchron in Ihrem Workflow. Für die Erkennung von Halluzinationen sollten Sie schnellere Modelle (wie GPT-4o-mini) wählen, wenn die Latenz kritisch ist.
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
import { Video } from '@/components/ui/video'
Der Human in the Loop Block pausiert die Workflow-Ausführung und wartet auf menschliches Eingreifen, bevor er fortfährt. Verwenden Sie ihn, um Genehmigungspunkte hinzuzufügen, Feedback zu sammeln oder zusätzliche Eingaben an kritischen Entscheidungspunkten einzuholen.
<div className="flex justify-center">
<Image
src="/static/blocks/hitl-1.png"
alt="Human in the Loop Block Konfiguration"
width={500}
height={400}
className="my-6"
/>
</div>
Wenn die Ausführung diesen Block erreicht, pausiert der Workflow auf unbestimmte Zeit, bis ein Mensch über das Genehmigungsportal, die API oder den Webhook eine Eingabe macht.
<div className="flex justify-center">
<Image
src="/static/blocks/hitl-2.png"
alt="Human in the Loop Genehmigungsportal"
width={700}
height={500}
className="my-6"
/>
</div>
## Konfigurationsoptionen
### Pausierte Ausgabe
Definiert, welche Daten dem Genehmigenden angezeigt werden. Dies ist der Kontext, der im Genehmigungsportal angezeigt wird, um eine fundierte Entscheidung zu ermöglichen.
Verwenden Sie den visuellen Builder oder den JSON-Editor, um die Daten zu strukturieren. Referenzieren Sie Workflow-Variablen mit der `<blockName.output>` Syntax.
```json
{
"customerName": "<agent1.content.name>",
"proposedAction": "<router1.selectedPath>",
"confidenceScore": "<evaluator1.score>",
"generatedEmail": "<agent2.content>"
}
```
### Benachrichtigung
Konfiguriert, wie Genehmigende benachrichtigt werden, wenn eine Genehmigung erforderlich ist. Unterstützte Kanäle sind:
Fügen Sie die Genehmigungs-URL (`<blockId.url>`) in Ihre Benachrichtigungsnachrichten ein, damit Genehmigende auf das Portal zugreifen können.
### Fortsetzungseingabe
Definiert die Felder, die Genehmigende bei der Antwort ausfüllen. Diese Daten werden nach der Fortsetzung des Workflows für nachfolgende Blöcke verfügbar.
```json
{
"approved": {
"type": "boolean",
"description": "Approve or reject this request"
},
"comments": {
"type": "string",
"description": "Optional feedback or explanation"
}
}
```
Greifen Sie in nachgelagerten Blöcken auf Wiederaufnahmedaten mit `<blockId.resumeInput.fieldName>` zu.
Jeder Block generiert eine eindeutige Portal-URL (`<blockId.url>`) mit einer visuellen Oberfläche, die alle pausierten Ausgabedaten und Formularfelder für die Fortsetzungseingabe anzeigt. Mobilgerätekompatibel und sicher.
Teilen Sie diese URL in Benachrichtigungen, damit Genehmiger die Anfragen prüfen und beantworten können.
</Tab>
<Tab>
### REST API
Workflows programmatisch fortsetzen:
```bash
POST /api/workflows/{workflowId}/executions/{executionId}/resume/{blockId}
{
"approved": true,
"comments": "Looks good to proceed"
}
```
Erstellen Sie benutzerdefinierte Genehmigungs-UIs oder integrieren Sie bestehende Systeme.
</Tab>
<Tab>
### Webhook
Fügen Sie ein Webhook-Tool im Benachrichtigungsbereich hinzu, um Genehmigungsanfragen an externe Systeme zu senden. Integration mit Ticketing-Systemen wie Jira oder ServiceNow.
</Tab>
</Tabs>
## Häufige Anwendungsfälle
**Inhaltsgenehmigung** - Überprüfung von KI-generierten Inhalten vor der Veröffentlichung
```
Agent → Human in the Loop → API (Publish)
```
**Mehrstufige Genehmigungen** - Verkettung mehrerer Genehmigungsschritte für wichtige Entscheidungen
```
Agent → Human in the Loop (Manager) → Human in the Loop (Director) → Execute
```
**Datenvalidierung** - Überprüfung extrahierter Daten vor der Verarbeitung
```
Agent (Extract) → Human in the Loop (Validate) → Function (Process)
```
**Qualitätskontrolle** - Überprüfung von KI-Ausgaben vor dem Versand an Kunden
```
Agent (Generate) → Human in the Loop (QA) → Gmail (Send)
```
## Block-Ausgaben
**`url`** - Eindeutige URL für das Genehmigungsportal
**`resumeInput.*`** - Alle in der Fortsetzungseingabe definierten Felder werden verfügbar, nachdem der Workflow fortgesetzt wird
Zugriff über `<blockId.resumeInput.fieldName>`.
## Beispiel
**Pausierte Ausgabe:**
```json
{
"title": "<agent1.content.title>",
"body": "<agent1.content.body>",
"qualityScore": "<evaluator1.score>"
}
```
**Fortsetzungseingabe:**
```json
{
"approved": { "type": "boolean" },
"feedback": { "type": "string" }
}
```
**Nachgelagerte Verwendung:**
```javascript
// Condition block
<approval1.resumeInput.approved> === true
```
Das Beispiel unten zeigt ein Genehmigungsportal, wie es von einem Genehmiger gesehen wird, nachdem der Workflow angehalten wurde. Genehmiger können die Daten überprüfen und Eingaben als Teil der Workflow-Wiederaufnahme bereitstellen. Auf das Genehmigungsportal kann direkt über die eindeutige URL, `<blockId.url>`, zugegriffen werden.
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 { Video } from '@/components/ui/video'
Blöcke sind die Bausteine, die du miteinander verbindest, um KI-Workflows zu erstellen. Betrachte sie als spezialisierte Module, die jeweils eine bestimmte Aufgabe übernehmen – vom Chatten mit KI-Modellen über API-Aufrufe bis hin zur Datenverarbeitung.
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Schleifenblock ist ein Container, der Blöcke wiederholt ausführt. Iteriere über Sammlungen, wiederhole Operationen eine festgelegte Anzahl von Malen oder fahre fort, solange eine Bedingung erfüllt ist.
<Callout type="info">
Schleifenblöcke sind Container-Knoten, die andere Blöcke in sich enthalten. Die enthaltenen Blöcke werden mehrfach ausgeführt, basierend auf deiner Konfiguration.
**For-Schleife (Iterationen)** - Eine numerische Schleife, die eine festgelegte Anzahl von Malen ausgeführt wird:
<div className="flex justify-center">
<Image
src="/static/blocks/loop-1.png"
alt="For-Schleife mit Iterationen"
width={500}
height={400}
className="my-6"
/>
</div>
Verwende diese, wenn du eine Operation eine bestimmte Anzahl von Malen wiederholen musst.
```
Example: Run 5 times
- Iteration 1
- Iteration 2
- Iteration 3
- Iteration 4
- Iteration 5
```
</Tab>
<Tab>
**ForEach-Schleife (Sammlung)** - Eine sammlungsbasierte Schleife, die über jedes Element in einem Array oder Objekt iteriert:
<div className="flex justify-center">
<Image
src="/static/blocks/loop-2.png"
alt="ForEach-Schleife mit Sammlung"
width={500}
height={400}
className="my-6"
/>
</div>
Verwende diese, wenn du eine Sammlung von Elementen verarbeiten musst.
```
Example: Process ["apple", "banana", "orange"]
- Iteration 1: Process "apple"
- Iteration 2: Process "banana"
- Iteration 3: Process "orange"
```
</Tab>
<Tab>
**While-Schleife (Bedingungsbasiert)** - Wird ausgeführt, solange eine Bedingung als wahr ausgewertet wird:
<div className="flex justify-center">
<Image
src="/static/blocks/loop-3.png"
alt="While-Schleife mit Bedingung"
width={500}
height={400}
className="my-6"
/>
</div>
Verwende diese, wenn du eine Schleife benötigst, die läuft, bis eine bestimmte Bedingung erfüllt ist. Die Bedingung wird **vor** jeder Iteration überprüft.
```
Example: While {"<variable.i>"} < 10
- Check condition → Execute if true
- Inside loop: Increment {"<variable.i>"}
- Inside loop: Variables assigns i = {"<variable.i>"} + 1
- Check condition → Execute if true
- Check condition → Exit if false
```
</Tab>
<Tab>
**Do-While-Schleife (Bedingungsbasiert)** - Wird mindestens einmal ausgeführt und dann fortgesetzt, solange eine Bedingung wahr ist:
<div className="flex justify-center">
<Image
src="/static/blocks/loop-4.png"
alt="Do-While-Schleife mit Bedingung"
width={500}
height={400}
className="my-6"
/>
</div>
Verwende diese, wenn du eine Operation mindestens einmal ausführen musst und dann die Schleife fortsetzen willst, bis eine Bedingung erfüllt ist. Die Bedingung wird **nach** jeder Iteration überprüft.
```
Example: Do-while {"<variable.i>"} < 10
- Execute blocks
- Inside loop: Increment {"<variable.i>"}
- Inside loop: Variables assigns i = {"<variable.i>"} + 1
- Check condition → Continue if true
- Check condition → Exit if false
```
</Tab>
</Tabs>
## Wie man Schleifen verwendet
### Eine Schleife erstellen
1. Ziehe einen Schleifenblock aus der Werkzeugleiste auf deine Leinwand
2. Konfiguriere den Schleifentyp und die Parameter
3. Ziehe andere Blöcke in den Schleifencontainer
4. Verbinde die Blöcke nach Bedarf
### Auf Ergebnisse zugreifen
Nach Abschluss einer Schleife kannst du auf aggregierte Ergebnisse zugreifen:
- **loop.results**: Array mit Ergebnissen aller Schleifendurchläufe
## Beispielanwendungsfälle
**Verarbeitung von API-Ergebnissen** - ForEach-Schleife verarbeitet Kundendatensätze aus einer API
```javascript
// Beispiel: ForEach-Schleife für API-Ergebnisse
const customers = await api.getCustomers();
loop.forEach(customers, (customer) => {
// Verarbeite jeden Kunden
if (customer.status === 'active') {
sendEmail(customer.email, 'Sonderangebot');
}
});
```
**Iterative Inhaltsgenerierung** - For-Schleife generiert mehrere Inhaltsvariationen
```javascript
// Beispiel: For-Schleife für Inhaltsgenerierung
const variations = [];
loop.for(5, (i) => {
// Generiere 5 verschiedene Variationen
const content = ai.generateContent({
prompt: `Variation ${i+1} für Produktbeschreibung`,
temperature: 0.7 + (i * 0.1)
});
variations.push(content);
});
```
**Zähler mit While-Schleife** - While-Schleife verarbeitet Elemente mit Zähler
```javascript
// Beispiel: While-Schleife mit Zähler
let counter = 0;
let processedItems = 0;
loop.while(() => counter < items.length, () => {
if (items[counter].isValid) {
processItem(items[counter]);
processedItems++;
}
counter++;
});
console.log(`${processedItems} gültige Elemente verarbeitet`);
```
## Erweiterte Funktionen
### Einschränkungen
<Callout type="warning">
Container-Blöcke (Schleifen und Parallele) können nicht ineinander verschachtelt werden. Das bedeutet:
- Du kannst keinen Schleifenblock in einen anderen Schleifenblock platzieren
- Du kannst keinen Parallel-Block in einen Schleifenblock platzieren
- Du kannst keinen Container-Block in einen anderen Container-Block platzieren
Wenn du mehrdimensionale Iterationen benötigst, erwäge eine Umstrukturierung deines Workflows, um sequentielle Schleifen zu verwenden oder Daten in Stufen zu verarbeiten.
</Callout>
<Callout type="info">
Schleifen werden sequentiell ausgeführt, nicht parallel. Wenn du eine gleichzeitige Ausführung benötigst, verwende stattdessen den Parallel-Block.
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Parallel-Block ist ein Container, der mehrere Instanzen gleichzeitig ausführt, um Workflows schneller zu verarbeiten. Verarbeiten Sie Elemente simultan statt sequentiell.
<Callout type="info">
Parallel-Blöcke sind Container-Knoten, die ihre Inhalte mehrfach gleichzeitig ausführen, im Gegensatz zu Schleifen, die sequentiell ausgeführt werden.
</Callout>
## Konfigurationsoptionen
### Parallel-Typ
Wählen Sie zwischen zwei Arten der parallelen Ausführung:
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Response-Block formatiert und sendet strukturierte HTTP-Antworten zurück an API-Aufrufer. Verwenden Sie ihn, um Workflow-Ergebnisse mit korrekten Statuscodes und Headern zurückzugeben.
<div className="flex justify-center">
<Image
src="/static/blocks/response.png"
alt="Konfiguration des Antwort-Blocks"
width={500}
height={400}
className="my-6"
/>
</div>
<Callout type="info">
Response-Blöcke sind terminale Blöcke - sie beenden die Workflow-Ausführung und können nicht mit anderen Blöcken verbunden werden.
</Callout>
## Konfigurationsoptionen
### Antwortdaten
Die Antwortdaten sind der Hauptinhalt, der an den API-Aufrufer zurückgesendet wird. Diese sollten als JSON formatiert sein und können Folgendes enthalten:
- Statische Werte
- Dynamische Verweise auf Workflow-Variablen mit der `<variable.name>` Syntax
- Verschachtelte Objekte und Arrays
- Jede gültige JSON-Struktur
### Statuscode
Legen Sie den HTTP-Statuscode für die Antwort fest (standardmäßig 200):
Antwortblöcke sind endgültig - sie beenden die Workflow-Ausführung und senden die HTTP-Antwort an den API-Aufrufer. Es stehen keine Ausgaben für nachgelagerte Blöcke zur Verfügung.
## Variablenreferenzen
Verwenden Sie die `<variable.name>` Syntax, um Workflow-Variablen dynamisch in Ihre Antwort einzufügen:
```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">
Variablennamen sind Groß- und Kleinschreibung sensitiv und müssen exakt mit den in Ihrem Workflow verfügbaren Variablen übereinstimmen.
</Callout>
## Best Practices
- **Verwenden Sie aussagekräftige Statuscodes**: Wählen Sie passende HTTP-Statuscodes, die das Ergebnis des Workflows genau widerspiegeln
- **Strukturieren Sie Ihre Antworten einheitlich**: Behalten Sie eine konsistente JSON-Struktur über alle Ihre API-Endpunkte bei, um eine bessere Entwicklererfahrung zu gewährleisten
- **Fügen Sie relevante Metadaten hinzu**: Fügen Sie Zeitstempel und Versionsinformationen hinzu, um bei der Fehlerbehebung und Überwachung zu helfen
- **Behandeln Sie Fehler elegant**: Verwenden Sie bedingte Logik in Ihrem Workflow, um angemessene Fehlerantworten mit aussagekräftigen Meldungen zu setzen
- **Validieren Sie Variablenreferenzen**: Stellen Sie sicher, dass alle referenzierten Variablen existieren und die erwarteten Datentypen enthalten, bevor der Antwortblock ausgeführt wird
import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
Der Router-Block verwendet KI, um Workflows basierend auf Inhaltsanalysen intelligent zu leiten. Im Gegensatz zu Bedingungsblöcken, die einfache Regeln verwenden, verstehen Router Kontext und Absicht.
<div className="flex justify-center">
<Image
src="/static/blocks/router.png"
alt="Router-Block mit mehreren Pfaden"
width={500}
height={400}
className="my-6"
/>
</div>
## Router vs. Bedingung
**Verwende Router, wenn:**
- KI-gestützte Inhaltsanalyse benötigt wird
- Mit unstrukturierten oder variierenden Inhalten gearbeitet wird
- Absichtsbasierte Weiterleitung erforderlich ist (z.B. "Support-Tickets an Abteilungen weiterleiten")
- **Klare Zielbeschreibungen bereitstellen**: Helfen Sie dem Router zu verstehen, wann jedes Ziel ausgewählt werden soll, mit spezifischen, detaillierten Beschreibungen
- **Spezifische Routing-Kriterien verwenden**: Definieren Sie klare Bedingungen und Beispiele für jeden Pfad, um die Genauigkeit zu verbessern
- **Fallback-Pfade implementieren**: Verbinden Sie ein Standardziel für Fälle, in denen kein spezifischer Pfad geeignet ist
- **Mit verschiedenen Eingaben testen**: Stellen Sie sicher, dass der Router verschiedene Eingabetypen, Grenzfälle und unerwartete Inhalte verarbeiten kann
- **Routing-Leistung überwachen**: Überprüfen Sie Routing-Entscheidungen regelmäßig und verfeinern Sie Kriterien basierend auf tatsächlichen Nutzungsmustern
- **Geeignete Modelle auswählen**: Verwenden Sie Modelle mit starken Argumentationsfähigkeiten für komplexe Routing-Entscheidungen
import { Callout } from 'fumadocs-ui/components/callout'
import { Step, Steps } from 'fumadocs-ui/components/steps'
import { Image } from '@/components/ui/image'
Der Variablen-Block aktualisiert Workflow-Variablen während der Ausführung. Variablen müssen zuerst im Variablen-Bereich deines Workflows initialisiert werden, dann kannst du diesen Block verwenden, um ihre Werte während der Ausführung deines Workflows zu aktualisieren.
<div className="flex justify-center">
<Image
src="/static/blocks/variables.png"
alt="Variablen-Block"
width={500}
height={400}
className="my-6"
/>
</div>
<Callout>
Greife überall in deinem Workflow auf Variablen zu, indem du die `<variable.variableName>` Syntax verwendest.
</Callout>
## Wie man Variablen verwendet
### 1. Initialisierung in Workflow-Variablen
Erstellen Sie zunächst Ihre Variablen im Variablenbereich des Workflows (zugänglich über die Workflow-Einstellungen):
```
customerEmail = ""
retryCount = 0
currentStatus = "pending"
```
### 2. Aktualisierung mit dem Variablen-Block
Verwenden Sie den Variablen-Block, um diese Werte während der Ausführung zu aktualisieren:
```
customerEmail = <api.email>
retryCount = <variable.retryCount> + 1
currentStatus = "processing"
```
### 3. Überall zugreifen
Referenzieren Sie Variablen in jedem Block:
```
Agent prompt: "Send email to <variable.customerEmail>"
Condition: <variable.retryCount> < 5
API body: {"status": "<variable.currentStatus>"}
```
## Beispielanwendungsfälle
**Schleifenzähler und Status** - Fortschritt durch Iterationen verfolgen
import { Callout } from 'fumadocs-ui/components/callout'
import { Step, Steps } from 'fumadocs-ui/components/steps'
import { Image } from '@/components/ui/image'
Der Warten-Block pausiert deinen Workflow für eine bestimmte Zeit, bevor er mit dem nächsten Block fortfährt. Verwende ihn, um Verzögerungen zwischen Aktionen einzufügen, API-Ratenbegrenzungen einzuhalten oder Operationen zeitlich zu verteilen.
<div className="flex justify-center">
<Image
src="/static/blocks/wait.png"
alt="Warte-Block"
width={500}
height={400}
className="my-6"
/>
</div>
## Konfiguration
### Wartezeit
Geben Sie die Dauer für die Ausführungspause ein:
- **Eingabe**: Positive Zahl
- **Maximum**: 600 Sekunden (10 Minuten) oder 10 Minuten
### Einheit
Wählen Sie die Zeiteinheit:
- **Sekunden**: Für kurze, präzise Verzögerungen
- **Minuten**: Für längere Pausen
<Callout type="info">
Warteblöcke können durch Stoppen des Workflows abgebrochen werden. Die maximale Wartezeit beträgt 10 Minuten.
</Callout>
## Ausgaben
- **`<wait.waitDuration>`**: Die Wartezeit in Millisekunden
- **`<wait.status>`**: Status der Wartezeit ('waiting', 'completed' oder 'cancelled')
## Beispielanwendungsfälle
**API-Ratenbegrenzung** - Bleiben Sie zwischen Anfragen innerhalb der API-Ratenlimits
```
API (Request 1) → Wait (2s) → API (Request 2)
```
**Zeitgesteuerte Benachrichtigungen** - Senden Sie Folgenachrichten nach einer Verzögerung
```
Function (Send Email) → Wait (5min) → Function (Follow-up)
```
**Verarbeitungsverzögerungen** - Warten Sie, bis das externe System die Verarbeitung abgeschlossen hat
```
API (Trigger Job) → Wait (30s) → API (Check Status)
```
## Bewährte Praktiken
- **Halten Sie Wartezeiten angemessen**: Verwenden Sie Wait für Verzögerungen bis zu 10 Minuten. Für längere Verzögerungen sollten Sie geplante Workflows in Betracht ziehen
- **Überwachen Sie die Ausführungszeit**: Denken Sie daran, dass Wartezeiten die Gesamtdauer des Workflows verlängern
Um Signaturen zu verifizieren, berechnen Sie `HMAC-SHA256(secret, "${timestamp}.${body}")` und vergleichen Sie mit dem `v1`Wert.
### Zusätzliche Header
Benutzerdefinierte Schlüssel-Wert-Header, die in die Anfrage aufgenommen werden. Diese überschreiben alle automatischen Header mit demselben Namen.
## Automatische Header
Jede Anfrage enthält automatisch diese Header:
| Header | Beschreibung |
|--------|-------------|
| `Content-Type` | `application/json` |
| `X-Webhook-Timestamp` | Unix-Zeitstempel in Millisekunden |
| `X-Delivery-ID` | Eindeutige UUID für diese Zustellung |
| `Idempotency-Key` | Identisch mit `X-Delivery-ID` zur Deduplizierung |
## Ausgaben
| Ausgabe | Typ | Beschreibung |
|--------|------|-------------|
| `data` | json | Antwort-Body vom Endpunkt |
| `status` | number | HTTP-Statuscode |
| `headers` | object | Antwort-Header |
## Beispiel-Anwendungsfälle
**Externe Dienste benachrichtigen** - Workflow-Ergebnisse an Slack, Discord oder benutzerdefinierte Endpunkte senden
```
Agent → Function (format) → Webhook (notify)
```
**Externe Workflows auslösen** - Prozesse in anderen Systemen starten, wenn Bedingungen erfüllt sind
```
Condition (check) → Webhook (trigger) → Response
```
<Callout>
Der Webhook-Block verwendet immer POST. Für andere HTTP-Methoden oder mehr Kontrolle verwenden Sie den [API-Block](/blocks/api).
</Callout>
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.