Skip to content

Commit 0e65a8a

Browse files
icecrasher321waleedlatif1greptile-apps[bot]aadamgoughAdam Gough
authored
feat(trigger-docs): new trigger docs, function block rce imports fix (#1462)
* fix(sidebar): draggable cursor on sidebar when switching workflows (#1276) * remove inline css for edge labels * fix remote code execution imports for javascript * add docs for new triggers * fix * fix draggable link --------- Co-authored-by: Waleed Latif <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Adam Gough <[email protected]> Co-authored-by: Adam Gough <[email protected]> Co-authored-by: Siddharth Ganesan <[email protected]>
1 parent d1f5c69 commit 0e65a8a

File tree

21 files changed

+400
-168
lines changed

21 files changed

+400
-168
lines changed

apps/docs/content/docs/de/blocks/workflow.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { Image } from '@/components/ui/image'
99

1010
Der Workflow-Block ermöglicht es, andere Workflows als wiederverwendbare Komponenten innerhalb deines aktuellen Workflows auszuführen. Dies ermöglicht modulares Design, Codewiederverwendung und die Erstellung komplexer verschachtelter Workflows, die aus kleineren, fokussierten Workflows zusammengesetzt werden können.
1111

12-
<div className="flex justify-center">
12+
<div className="flex justify-center my-6">
1313
<Image
1414
src="/static/blocks/workflow.png"
1515
alt="Workflow-Block"
16-
width={500}
17-
height={350}
18-
className="my-6"
16+
width={400}
17+
height={280}
18+
className="rounded-xl border border-border shadow-sm"
1919
/>
2020
</div>
2121

Lines changed: 23 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,40 @@
11
---
2-
title: Workflow
2+
title: Workflow Block
3+
description: Run another workflow inside the current flow
34
---
45

56
import { Callout } from 'fumadocs-ui/components/callout'
6-
import { Step, Steps } from 'fumadocs-ui/components/steps'
7-
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
87
import { Image } from '@/components/ui/image'
98

10-
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.
9+
## What It Does
1110

12-
<div className="flex justify-center">
11+
<div className='flex justify-center my-6'>
1312
<Image
14-
src="/static/blocks/workflow.png"
15-
alt="Workflow Block"
16-
width={500}
17-
height={350}
18-
className="my-6"
13+
src='/static/blocks/workflow.png'
14+
alt='Workflow block configuration'
15+
width={400}
16+
height={280}
17+
className='rounded-xl border border-border shadow-sm'
1918
/>
2019
</div>
2120

22-
<Callout type="info">
23-
Workflow blocks enable modular design by allowing you to compose complex workflows from smaller, reusable components.
24-
</Callout>
25-
26-
## Overview
27-
28-
The Workflow block serves as a bridge between workflows, enabling you to:
29-
30-
<Steps>
31-
<Step>
32-
<strong>Reuse existing workflows</strong>: Execute previously created workflows as components within new workflows
33-
</Step>
34-
<Step>
35-
<strong>Create modular designs</strong>: Break down complex processes into smaller, manageable workflows
36-
</Step>
37-
<Step>
38-
<strong>Maintain separation of concerns</strong>: Keep different business logic isolated in separate workflows
39-
</Step>
40-
<Step>
41-
<strong>Enable team collaboration</strong>: Share and reuse workflows across different projects and team members
42-
</Step>
43-
</Steps>
44-
45-
## How It Works
46-
47-
The Workflow block:
48-
49-
1. Takes a reference to another workflow in your workspace
50-
2. Passes input data from the current workflow to the child workflow (available via start.input)
51-
3. Executes the child workflow in an isolated context
52-
4. Returns the result back to the parent workflow for further processing
21+
Drop a Workflow block when you want to call a child workflow as part of a larger flow. The block runs the latest deployed version of that workflow, waits for it to finish, and then continues with the parent.
5322

54-
## Configuration Options
23+
## Configure It
5524

56-
### Workflow Selection
25+
1. **Pick a workflow** from the dropdown (self-references are blocked to prevent loops).
26+
2. **Map inputs**: If the child workflow has an Input Form trigger, you’ll see each field and can connect parent variables. The mapped values are what the child receives.
27+
3. **Outputs**: After the child finishes, the block exposes:
28+
- `result` – the child workflow’s final response
29+
- `success` – whether it ran without errors
30+
- `error` – message when the run fails
5731

58-
Choose which workflow to execute from a dropdown list of available workflows in your workspace. The list includes:
32+
## Execution Notes
5933

60-
- All workflows you have access to in the current workspace
61-
- Workflows shared with you by other team members
62-
- Both enabled and disabled workflows (though only enabled workflows can be executed)
34+
- Child workflows run in the same workspace context, so environment variables and tools carry over.
35+
- The block uses deployment versioning: any API, schedule, webhook, manual, or chat execution calls the deployed snapshot. Redeploy the child when you change it.
36+
- If the child fails, the block raises an error unless you handle it downstream.
6337

64-
65-
### Execution Context
66-
67-
The child workflow executes with:
68-
69-
- Its own isolated execution context
70-
- Access to the same workspace resources (API keys, environment variables)
71-
- Proper workspace membership and permission checks
72-
- Nested tracespan in the execution log
73-
74-
<Callout type="warning">
75-
**Cycle Detection**: The system automatically detects and prevents circular dependencies between workflows to avoid infinite loops.
38+
<Callout>
39+
Keep child workflows focused. Small, reusable flows make it easier to combine them without creating deep nesting.
7640
</Callout>
77-
78-
## Inputs and Outputs
79-
80-
<Tabs items={['Configuration', 'Variables', 'Results']}>
81-
<Tab>
82-
<ul className="list-disc space-y-2 pl-6">
83-
<li>
84-
<strong>Workflow Selection</strong>: Choose which workflow to execute
85-
</li>
86-
<li>
87-
<strong>Input Data</strong>: Variable or block reference to pass to child workflow
88-
</li>
89-
<li>
90-
<strong>Execution Context</strong>: Isolated environment with workspace resources
91-
</li>
92-
</ul>
93-
</Tab>
94-
<Tab>
95-
<ul className="list-disc space-y-2 pl-6">
96-
<li>
97-
<strong>workflow.success</strong>: Boolean indicating completion status
98-
</li>
99-
<li>
100-
<strong>workflow.childWorkflowName</strong>: Name of executed child workflow
101-
</li>
102-
<li>
103-
<strong>workflow.result</strong>: Result returned by the child workflow
104-
</li>
105-
<li>
106-
<strong>workflow.error</strong>: Error details if workflow failed
107-
</li>
108-
</ul>
109-
</Tab>
110-
<Tab>
111-
<ul className="list-disc space-y-2 pl-6">
112-
<li>
113-
<strong>Workflow Response</strong>: Primary output from child workflow
114-
</li>
115-
<li>
116-
<strong>Execution Status</strong>: Success status and error information
117-
</li>
118-
<li>
119-
<strong>Access</strong>: Available in blocks after the workflow
120-
</li>
121-
</ul>
122-
</Tab>
123-
</Tabs>
124-
125-
## Example Use Cases
126-
127-
### Modular Customer Onboarding
128-
129-
<div className="mb-4 rounded-md border p-4">
130-
<h4 className="font-medium">Scenario: Break down complex onboarding into reusable components</h4>
131-
<ol className="list-decimal pl-5 text-sm">
132-
<li>Main workflow receives customer data</li>
133-
<li>Workflow block executes validation workflow</li>
134-
<li>Workflow block executes account setup workflow</li>
135-
<li>Workflow block executes welcome email workflow</li>
136-
</ol>
137-
</div>
138-
139-
### Microservice Architecture
140-
141-
<div className="mb-4 rounded-md border p-4">
142-
<h4 className="font-medium">Scenario: Create independent service workflows</h4>
143-
<ol className="list-decimal pl-5 text-sm">
144-
<li>Payment processing workflow handles transactions</li>
145-
<li>Inventory management workflow updates stock</li>
146-
<li>Notification workflow sends confirmations</li>
147-
<li>Main workflow orchestrates all services</li>
148-
</ol>
149-
</div>
150-
151-
### Conditional Processing
152-
153-
<div className="mb-4 rounded-md border p-4">
154-
<h4 className="font-medium">Scenario: Execute different workflows based on conditions</h4>
155-
<ol className="list-decimal pl-5 text-sm">
156-
<li>Condition block evaluates user type</li>
157-
<li>Enterprise users → Complex approval workflow</li>
158-
<li>Standard users → Simple approval workflow</li>
159-
<li>Free users → Basic processing workflow</li>
160-
</ol>
161-
</div>
162-
163-
## Best Practices
164-
165-
- **Keep workflows focused**: Design child workflows to handle specific, well-defined tasks with clear inputs and outputs
166-
- **Minimize nesting depth**: Avoid deeply nested workflow hierarchies for better maintainability and performance
167-
- **Handle errors gracefully**: Implement proper error handling for child workflow failures and provide fallback mechanisms
168-
- **Test independently**: Ensure child workflows can be tested and validated independently from parent workflows
169-
- **Use semantic naming**: Give workflows descriptive names that clearly indicate their purpose and functionality

apps/docs/content/docs/en/execution/index.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Execution
44

55
import { Callout } from 'fumadocs-ui/components/callout'
66
import { Card, Cards } from 'fumadocs-ui/components/card'
7+
import { Image } from '@/components/ui/image'
78

89
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.
910

@@ -88,6 +89,22 @@ Chat deployment creates a conversational interface for your workflow:
8889

8990
Each deployment method passes data to your workflow's starter block, beginning the execution flow.
9091

92+
## Deployment Snapshots
93+
94+
All public entry points—API, Chat, Schedule, Webhook, and Manual runs—execute the workflow’s active deployment snapshot. Publish a new deployment whenever you change the canvas so every trigger uses the updated version.
95+
96+
<div className='flex justify-center my-6'>
97+
<Image
98+
src='/static/execution/deployment-versions-light.png'
99+
alt='Deployment versions table'
100+
width={500}
101+
height={280}
102+
className='rounded-xl border border-border shadow-sm'
103+
/>
104+
</div>
105+
106+
The Deploy modal keeps a full version history—inspect any snapshot, compare it against your draft, and promote or roll back with one click when you need to restore a prior release.
107+
91108
## Programmatic Execution
92109

93110
Execute workflows from your applications using our official SDKs:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: API Trigger
3+
description: Start a workflow from an authenticated HTTP request
4+
---
5+
6+
import { Callout } from 'fumadocs-ui/components/callout'
7+
import { Image } from '@/components/ui/image'
8+
9+
## Overview
10+
11+
The API trigger exposes your workflow as a secure HTTP endpoint. Send JSON data to the endpoint and your workflow processes it immediately. API calls always execute against your latest deployment.
12+
13+
## Configure Input Format
14+
15+
<div className='flex justify-center my-6'>
16+
<Image
17+
src='/static/triggers/api-trigger-light.png'
18+
alt='API trigger input format'
19+
width={400}
20+
height={250}
21+
className='rounded-xl border border-border shadow-sm'
22+
/>
23+
</div>
24+
25+
Add an **Input Format** field for each parameter. Runtime output keys mirror the schema and are also available under `<api.input>`.
26+
27+
```yaml
28+
- type: string
29+
name: userId
30+
value: demo-user # optional manual test value
31+
- type: number
32+
name: maxTokens
33+
```
34+
35+
Manual runs in the editor use the `value` column so you can test without sending a request. During execution the resolver populates both `<api.userId>` and `<api.input.userId>`.
36+
37+
## Request Example
38+
39+
```bash
40+
curl -X POST \
41+
https://sim.ai/api/workflows/WORKFLOW_ID/execute \
42+
-H 'Content-Type: application/json' \
43+
-H 'X-API-Key: YOUR_KEY' \
44+
-d '{"userId":"demo-user","maxTokens":1024}'
45+
```
46+
47+
Successful responses return the serialized execution result from the Executor. Errors surface validation, auth, or workflow failures.
48+
49+
## Output Reference
50+
51+
| Reference | Description |
52+
|-----------|-------------|
53+
| `<api.field>` | Field defined in the Input Format |
54+
| `<api.input>` | Entire structured request body |
55+
56+
If no Input Format is defined, the executor exposes the raw JSON at `<api.input>` only.
57+
58+
<Callout type="warning">
59+
A workflow can contain only one API Trigger. Publish a new deployment after changes so the endpoint stays up to date.
60+
</Callout>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Chat Trigger
3+
description: Start a workflow from a chat deployment
4+
---
5+
6+
import { Callout } from 'fumadocs-ui/components/callout'
7+
import { Image } from '@/components/ui/image'
8+
9+
## Overview
10+
11+
The Chat trigger creates a conversational interface for your workflow. Deploy your workflow as a chat and users can interact with it through a shareable URL. Each message starts a new workflow execution using your latest deployment.
12+
13+
## Runtime Outputs
14+
15+
<div className='flex justify-center my-6'>
16+
<Image
17+
src='/static/triggers/chat-trigger-light.png'
18+
alt='Chat deployment conversation'
19+
width={400}
20+
height={250}
21+
className='rounded-xl border border-border shadow-sm'
22+
/>
23+
</div>
24+
25+
The trigger writes three fields that downstream blocks can reference:
26+
27+
| Reference | Description |
28+
|-----------|-------------|
29+
| `<chat.input>` | Latest user message |
30+
| `<chat.conversationId>` | Conversation thread ID |
31+
| `<chat.files>` | Optional uploaded files |
32+
33+
Files include `name`, `mimeType`, and a signed download `url`.
34+
35+
## Usage Notes
36+
37+
1. Add one Chat Trigger block per workflow.
38+
2. Deploy the workflow in chat mode.
39+
3. Share the deployment link—every reply reuses the conversation ID so the workflow can keep context.
40+
41+
<Callout type="info">
42+
The builder blocks multiple Chat Trigger blocks in the same workflow.
43+
</Callout>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Triggers
3+
description: Core ways to start Sim workflows
4+
---
5+
6+
import { Card, Cards } from 'fumadocs-ui/components/card'
7+
8+
## Core Triggers
9+
10+
Pick one trigger per workflow to define how it starts:
11+
12+
<Cards>
13+
<Card title="API" href="/triggers/api">
14+
HTTP endpoint that maps JSON bodies into workflow inputs
15+
</Card>
16+
<Card title="Chat" href="/triggers/chat">
17+
Deployed chat interface with streaming responses
18+
</Card>
19+
<Card title="Input Form" href="/triggers/input-form">
20+
Typed manual input used in editor runs and child workflows
21+
</Card>
22+
<Card title="Manual" href="/triggers/manual">
23+
On-demand runs with no additional data
24+
</Card>
25+
<Card title="Schedule" href="/triggers/schedule">
26+
Cron or interval based execution
27+
</Card>
28+
<Card title="Webhook" href="/triggers/webhook">
29+
Receive external webhook payloads
30+
</Card>
31+
</Cards>
32+
33+
## Quick Comparison
34+
35+
| Trigger | Start condition |
36+
|---------|-----------------|
37+
| **API** | Authenticated HTTP POST |
38+
| **Chat** | Chat deployment message |
39+
| **Input Form** | On manual submit in editor or parent workflow |
40+
| **Manual** | Run button in editor |
41+
| **Schedule** | Timer managed in schedule modal |
42+
| **Webhook** | On inbound HTTP request |
43+
44+
## Using Triggers
45+
46+
1. Drop the trigger block in the start slot.
47+
2. Configure any required schema or auth.
48+
3. Connect the block to the rest of the workflow.
49+
50+
> Deployments power every trigger. Update the workflow, redeploy, and all trigger entry points pick up the new snapshot. Learn more in [Execution → Deployment Snapshots](/execution).
51+
52+
Legacy Starter blocks remain for existing flows but no longer appear in new builds.

0 commit comments

Comments
 (0)