Skip to content

Commit 3bf00cb

Browse files
Sg312waleedlatif1icecrasher321
authored
improvement(executor): redesign executor + add start block (#1790)
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * improvement(start): revert to start block * make it work with start block * fix start block persistence * cleanup triggers * debounce status checks * update docs * SSE v0.1 * v0.2 * v0.3 * v0.4 * v0.5 * v0.6 * broken checkpoint * Executor progress - everything preliminarily tested except while loops and triggers * Executor fixes * Fix var typing * Implement while loop execution * Loop and parallel result agg * Refactor v1 - loops work * Fix var resolution in for each loop * Fix while loop condition and variable resolution * Fix loop iteration counts * Fix loop badges * Clean logs * Fix variable references from start block * Fix condition block * Fix conditional convergence * Dont execute orphaned nodse * Code cleanup 1 and error surfacing * compile time try catch * Some fixes * Fix error throwing * Sentinels v1 * Fix multiple start and end nodes in loop * Edge restoration * Fix reachable nodes execution * Parallel subflows * Fix loop/parallel sentinel convergence * Loops and parallels orchestrator * Split executor * Variable resolution split * Dag phase * Refactor * Refactor * Refactor 3 * Lint + refactor * Lint + cleanup + refactor * Readability * Initial logs * Fix trace spans * Console pills for iters * Add input/output pills * Checkpoint * remove unused code * THIS IS THE COMMIT THAT CAN BREAK A LOT OF THINGS * ANOTHER BIG REFACTOR * Lint + fix tests * Fix webhook * Remove comment * Merge stash * Fix triggers? * Stuff * Fix error port * Lint * Consolidate state * Clean up some var resolution * Remove some var resolution logs * Fix chat * Fix chat triggers * Fix chat trigger fully * Snapshot refactor * Fix mcp and custom tools * Lint * Fix parallel default count and trace span overlay * Agent purple * Fix test * Fix test --------- Co-authored-by: Waleed <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]>
1 parent 7d67ae3 commit 3bf00cb

File tree

137 files changed

+8487
-20375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+8487
-20375
lines changed

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

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,35 @@ import { Card, Cards } from 'fumadocs-ui/components/card'
77

88
## Core Triggers
99

10-
Pick one trigger per workflow to define how it starts:
10+
Use the Start block for everything originating from the editor, deploy-to-API, or deploy-to-chat experiences. Other triggers remain available for event-driven workflows:
1111

1212
<Cards>
13-
<Card title="API" href="/triggers/api">
14-
HTTP endpoint that maps JSON bodies into workflow inputs
13+
<Card title="Start" href="/triggers/start">
14+
Unified entry point that supports editor runs, API deployments and chat deployments
1515
</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
16+
<Card title="Webhook" href="/triggers/webhook">
17+
Receive external webhook payloads
2418
</Card>
2519
<Card title="Schedule" href="/triggers/schedule">
2620
Cron or interval based execution
2721
</Card>
28-
<Card title="Webhook" href="/triggers/webhook">
29-
Receive external webhook payloads
30-
</Card>
3122
</Cards>
3223

3324
## Quick Comparison
3425

3526
| Trigger | Start condition |
3627
|---------|-----------------|
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 |
28+
| **Start** | Editor runs, deploy-to-API requests, or chat messages |
4129
| **Schedule** | Timer managed in schedule modal |
4230
| **Webhook** | On inbound HTTP request |
4331

32+
> The Start block always exposes `input`, `conversationId`, and `files` fields. Add custom fields to the input format for additional structured data.
33+
4434
## Using Triggers
4535

46-
1. Drop the trigger block in the start slot.
36+
1. Drop the Start block in the start slot (or an alternate trigger like Webhook/Schedule).
4737
2. Configure any required schema or auth.
4838
3. Connect the block to the rest of the workflow.
4939

5040
> 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).
5141
52-
Legacy Starter blocks remain for existing flows but no longer appear in new builds.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"pages": ["index", "api", "chat", "input-form", "manual", "schedule", "starter", "webhook"]
2+
"pages": ["index", "start", "schedule", "webhook", "starter"]
33
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: Start
3+
---
4+
5+
import { Callout } from 'fumadocs-ui/components/callout'
6+
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
7+
import { Image } from '@/components/ui/image'
8+
9+
The Start block is the default trigger for workflows built in Sim. It collects structured inputs and fans out to the rest of your graph for editor tests, API deployments, and chat experiences.
10+
11+
<div className="flex justify-center">
12+
<Image
13+
src="/static/start.png"
14+
alt="Start block with Input Format fields"
15+
width={360}
16+
height={380}
17+
className="my-6"
18+
/>
19+
</div>
20+
21+
<Callout type="info">
22+
The Start block sits in the start slot when you create a workflow. Keep it there when you want the same entry point to serve editor runs, deploy-to-API requests, and chat sessions. Swap it with Webhook or Schedule triggers when you only need event-driven execution.
23+
</Callout>
24+
25+
## Fields exposed by Start
26+
27+
The Start block emits different data depending on the execution surface:
28+
29+
- **Input Format fields** — Every field you add becomes available as `<start.fieldName>`. For example, a `customerId` field shows up as `<start.customerId>` in downstream blocks and templates.
30+
- **Chat-only fields** — When the workflow runs from the chat side panel or a deployed chat experience, Sim also provides `<start.input>` (latest user message), `<start.conversationId>` (active session id), and `<start.files>` (chat attachments).
31+
32+
Keep Input Format fields scoped to the names you expect to reference later—those values are the only structured fields shared across editor, API, and chat runs.
33+
34+
## Configure the Input Format
35+
36+
Use the Input Format sub-block to define the schema that applies across execution modes:
37+
38+
1. Add a field for each value you want to collect.
39+
2. Choose a type (`string`, `number`, `boolean`, `object`, `array`, or `files`). File fields accept uploads from chat and API callers.
40+
3. Provide default values when you want the manual run modal to populate test data automatically. These defaults are ignored for deployed executions.
41+
4. Reorder fields to control how they appear in the editor form.
42+
43+
Reference structured values downstream with expressions such as `<start.customerId>` depending on the block you connect.
44+
45+
## How it behaves per entry point
46+
47+
<Tabs items={['Editor run', 'Deploy to API', 'Deploy to chat']}>
48+
<Tab>
49+
<div className="space-y-3">
50+
<p>
51+
When you click <strong>Run</strong> in the editor, the Start block renders the Input Format as a form. Default values make it easy to retest without retyping data. Submitting the form triggers the workflow immediately and the values become available on <code>&lt;start.fieldName&gt;</code> (for example <code>&lt;start.sampleField&gt;</code>).
52+
</p>
53+
<p>
54+
File fields in the form upload directly into the corresponding `<start.fieldName>`; use those values to feed downstream tools or storage steps.
55+
</p>
56+
</div>
57+
</Tab>
58+
<Tab>
59+
<div className="space-y-3">
60+
<p>
61+
Deploying to API turns the Input Format into a JSON contract for clients. Each field becomes part of the request body, and Sim coerces primitive types on ingestion. File fields expect objects that reference uploaded files; use the execution file upload endpoint before invoking the workflow.
62+
</p>
63+
<p>
64+
API callers can include additional optional properties. They are preserved inside `<start.fieldName>` outputs so you can experiment without redeploying immediately.
65+
</p>
66+
</div>
67+
</Tab>
68+
<Tab>
69+
<div className="space-y-3">
70+
<p>
71+
In chat deployments the Start block binds to the active conversation. The latest message fills <code>&lt;start.input&gt;</code>, the session identifier is available at <code>&lt;start.conversationId&gt;</code>, and user attachments appear on <code>&lt;start.files&gt;</code>, alongside any Input Format fields scoped as <code>&lt;start.fieldName&gt;</code>.
72+
</p>
73+
<p>
74+
If you launch chat with additional structured context (for example from an embed), it merges into the corresponding `<start.fieldName>` outputs, keeping downstream blocks consistent with API and manual runs.
75+
</p>
76+
</div>
77+
</Tab>
78+
</Tabs>
79+
80+
## Referencing Start data downstream
81+
82+
- Connect `<start.fieldName>` directly into agents, tools, or functions that expect structured payloads.
83+
- Use templating syntax like `<start.sampleField>` or `<start.files[0].url>` (chat only) in prompt fields.
84+
- Keep `<start.conversationId>` handy when you need to group outputs, update conversation history, or call back into the chat API.
85+
86+
## Best practices
87+
88+
- Treat the Start block as the single entry point when you want to support both API and chat callers.
89+
- Prefer named Input Format fields over parsing raw JSON in downstream nodes; type coercion happens automatically.
90+
- Add validation or routing immediately after Start if certain fields are required for your workflow to succeed.

apps/docs/content/docs/en/triggers/starter.mdx

Lines changed: 0 additions & 67 deletions
This file was deleted.

apps/docs/public/static/start.png

19.3 KB
Loading
-36.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)