Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ad83676
feat(docs): fill documentation gaps across platform features
waleedlatif1 Apr 11, 2026
a0b35f5
fix(docs): address PR review comments on chat OTP cookies and MCP env…
waleedlatif1 Apr 11, 2026
6f3d1ad
fix(docs): replace smart quotes with straight quotes in JSX attributes
waleedlatif1 Apr 11, 2026
5fbfa11
update(docs): update mcp, custom tools, and variables docs
TheodoreSpeaks Apr 16, 2026
c0de014
Fix grammar
TheodoreSpeaks Apr 16, 2026
99a1ac0
Merge branch 'doc/update-mcp' into waleedlatif1/docs-gap-audit
TheodoreSpeaks Apr 16, 2026
1c334aa
mothership docs, tags, connectors, api, chat deploy, etc
waleedlatif1 Apr 16, 2026
924faf1
more info
waleedlatif1 Apr 16, 2026
87d346e
more
waleedlatif1 Apr 16, 2026
927a693
feat(docs): auto-generate per-provider trigger documentation
waleedlatif1 Apr 16, 2026
9f07102
refactor(docs): align trigger docs structure with tools docs
waleedlatif1 Apr 16, 2026
b11ee34
refactor(docs): use human-readable names for trigger section headings
waleedlatif1 Apr 16, 2026
35beb7e
fix(docs): resolve subBlock builder functions for all trigger Config …
waleedlatif1 Apr 16, 2026
be23128
fix(docs): correctly destructure nested implicit-object trigger outputs
waleedlatif1 Apr 16, 2026
6a937f1
chore(docs): update static trigger and start page images
waleedlatif1 Apr 16, 2026
9473851
feat(providers): add claude-opus-4-7 model with adaptive thinking sup…
waleedlatif1 Apr 16, 2026
0680d3e
Add workflow version screenshots
TheodoreSpeaks Apr 16, 2026
24387e7
Add function block screenshots
TheodoreSpeaks Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions apps/docs/app/[lang]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DocsBody, DocsPage } from 'fumadocs-ui/page'
import { DocsPage } from 'fumadocs-ui/page'
import Link from 'next/link'

export const metadata = {
title: 'Page Not Found',
Expand All @@ -7,17 +8,21 @@ export const metadata = {
export default function NotFound() {
return (
<DocsPage>
<DocsBody>
<div className='flex min-h-[60vh] flex-col items-center justify-center text-center'>
<h1 className='mb-4 bg-gradient-to-b from-[#47d991] to-[#33c482] bg-clip-text font-bold text-8xl text-transparent'>
404
</h1>
<h2 className='mb-2 font-semibold text-2xl text-foreground'>Page Not Found</h2>
<p className='text-muted-foreground'>
The page you're looking for doesn't exist or has been moved.
</p>
</div>
</DocsBody>
<div className='flex min-h-[70vh] flex-col items-center justify-center gap-4 text-center'>
<h1 className='bg-gradient-to-b from-[#47d991] to-[#33c482] bg-clip-text font-bold text-8xl text-transparent'>
404
</h1>
<h2 className='font-semibold text-2xl text-foreground'>Page Not Found</h2>
<p className='text-muted-foreground'>
The page you're looking for doesn't exist or has been moved.
</p>
<Link
href='/'
className='ml-1 flex items-center rounded-[8px] bg-[#33c482] px-2.5 py-1.5 text-[13px] text-white transition-colors duration-200 hover:bg-[#2DAC72]'
>
Go home
</Link>
</div>
</DocsPage>
)
}
22 changes: 22 additions & 0 deletions apps/docs/components/ui/icon-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
cloudflare: CloudflareIcon,
cloudformation: CloudFormationIcon,
cloudwatch: CloudWatchIcon,
confluence: ConfluenceIcon,
confluence_v2: ConfluenceIcon,
crowdstrike: CrowdStrikeIcon,
cursor: CursorIcon,
cursor_v2: CursorIcon,
dagster: DagsterIcon,
databricks: DatabricksIcon,
Expand All @@ -243,19 +245,25 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
enrich: EnrichSoIcon,
evernote: EvernoteIcon,
exa: ExaAIIcon,
extend: ExtendIcon,
extend_v2: ExtendIcon,
fathom: FathomIcon,
file: DocumentIcon,
file_v3: DocumentIcon,
firecrawl: FirecrawlIcon,
fireflies: FirefliesIcon,
fireflies_v2: FirefliesIcon,
gamma: GammaIcon,
github: GithubIcon,
github_v2: GithubIcon,
gitlab: GitLabIcon,
gmail: GmailIcon,
gmail_v2: GmailIcon,
gong: GongIcon,
google_ads: GoogleAdsIcon,
google_bigquery: GoogleBigQueryIcon,
google_books: GoogleBooksIcon,
google_calendar: GoogleCalendarIcon,
google_calendar_v2: GoogleCalendarIcon,
google_contacts: GoogleContactsIcon,
google_docs: GoogleDocsIcon,
Expand All @@ -266,7 +274,9 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
google_meet: GoogleMeetIcon,
google_pagespeed: GooglePagespeedIcon,
google_search: GoogleIcon,
google_sheets: GoogleSheetsIcon,
google_sheets_v2: GoogleSheetsIcon,
google_slides: GoogleSlidesIcon,
google_slides_v2: GoogleSlidesIcon,
google_tasks: GoogleTasksIcon,
google_translate: GoogleTranslateIcon,
Expand All @@ -285,16 +295,19 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
imap: MailServerIcon,
incidentio: IncidentioIcon,
infisical: InfisicalIcon,
intercom: IntercomIcon,
intercom_v2: IntercomIcon,
jina: JinaAIIcon,
jira: JiraIcon,
jira_service_management: JiraServiceManagementIcon,
kalshi: KalshiIcon,
kalshi_v2: KalshiIcon,
ketch: KetchIcon,
knowledge: PackageSearchIcon,
langsmith: LangsmithIcon,
launchdarkly: LaunchDarklyIcon,
lemlist: LemlistIcon,
linear: LinearIcon,
linear_v2: LinearIcon,
linkedin: LinkedInIcon,
linkup: LinkupIcon,
Expand All @@ -306,13 +319,16 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
memory: BrainIcon,
microsoft_ad: AzureIcon,
microsoft_dataverse: MicrosoftDataverseIcon,
microsoft_excel: MicrosoftExcelIcon,
microsoft_excel_v2: MicrosoftExcelIcon,
microsoft_planner: MicrosoftPlannerIcon,
microsoft_teams: MicrosoftTeamsIcon,
mistral_parse: MistralIcon,
mistral_parse_v3: MistralIcon,
mongodb: MongoDBIcon,
mysql: MySQLIcon,
neo4j: Neo4jIcon,
notion: NotionIcon,
notion_v2: NotionIcon,
obsidian: ObsidianIcon,
okta: OktaIcon,
Expand All @@ -329,12 +345,14 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
postgresql: PostgresIcon,
posthog: PosthogIcon,
profound: ProfoundIcon,
pulse: PulseIcon,
pulse_v2: PulseIcon,
qdrant: QdrantIcon,
quiver: QuiverIcon,
rds: RDSIcon,
reddit: RedditIcon,
redis: RedisIcon,
reducto: ReductoIcon,
reducto_v2: ReductoIcon,
resend: ResendIcon,
revenuecat: RevenueCatIcon,
Expand All @@ -360,11 +378,13 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
stagehand: StagehandIcon,
stripe: StripeIcon,
sts: STSIcon,
stt: STTIcon,
stt_v2: STTIcon,
supabase: SupabaseIcon,
tailscale: TailscaleIcon,
tavily: TavilyIcon,
telegram: TelegramIcon,
textract: TextractIcon,
textract_v2: TextractIcon,
tinybird: TinybirdIcon,
translate: TranslateIcon,
Expand All @@ -375,7 +395,9 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
typeform: TypeformIcon,
upstash: UpstashIcon,
vercel: VercelIcon,
video_generator: VideoIcon,
video_generator_v2: VideoIcon,
vision: EyeIcon,
vision_v2: EyeIcon,
wealthbox: WealthboxIcon,
webflow: WebflowIcon,
Expand Down
120 changes: 119 additions & 1 deletion apps/docs/content/docs/en/blocks/function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
title: Function
---

import { Callout } from 'fumadocs-ui/components/callout'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Image } from '@/components/ui/image'
import { FAQ } from '@/components/ui/faq'

The Function block executes custom JavaScript or TypeScript code in your workflows. Transform data, perform calculations, or implement custom logic.
The Function block executes custom JavaScript, TypeScript, or Python code in your workflows. Transform data, perform calculations, or implement custom logic.

<div className="flex justify-center">
<Image
Expand Down Expand Up @@ -41,6 +43,8 @@ Input → Function (Validate & Sanitize) → API (Save to Database)

### Example: Loyalty Score Calculator

<Tabs items={['JavaScript', 'Python']}>
<Tab value="JavaScript">
```javascript title="loyalty-calculator.js"
// Process customer data and calculate loyalty score
const { purchaseHistory, accountAge, supportTickets } = <agent>;
Expand All @@ -64,6 +68,120 @@ return {
metrics: { spendScore, frequencyScore, supportScore }
};
```
</Tab>
<Tab value="Python">
```python title="loyalty-calculator.py"
import json

# Reference outputs from other blocks using angle bracket syntax
data = json.loads('<agent>')
purchase_history = data["purchaseHistory"]
account_age = data["accountAge"]
support_tickets = data["supportTickets"]

# Calculate metrics
total_spent = sum(p["amount"] for p in purchase_history)
purchase_frequency = len(purchase_history) / (account_age / 365)
ticket_ratio = support_tickets["resolved"] / support_tickets["total"]

# Calculate loyalty score (0-100)
spend_score = min(total_spent / 1000 * 30, 30)
frequency_score = min(purchase_frequency * 20, 40)
support_score = ticket_ratio * 30

loyalty_score = round(spend_score + frequency_score + support_score)

tier = "Platinum" if loyalty_score >= 80 else "Gold" if loyalty_score >= 60 else "Silver"

result = {
"customer": data["name"],
"loyaltyScore": loyalty_score,
"loyaltyTier": tier,
"metrics": {
"spendScore": spend_score,
"frequencyScore": frequency_score,
"supportScore": support_score
}
}
print(json.dumps(result))
```
</Tab>
</Tabs>

## Python Support

The Function block supports Python as an alternative to JavaScript. Python code runs in a secure [E2B](https://e2b.dev) cloud sandbox.

<div className="flex justify-center">
<Image
src="/static/blocks/function-python.png"
alt="Function block with Python selected"
width={400}
height={500}
className="my-6"
/>
</div>

### Enabling Python

Select **Python** from the language dropdown in the Function block. Python execution requires E2B to be enabled on your Sim instance.

<Callout type="warn">
If you don't see Python as an option in the language dropdown, E2B is not enabled. This only applies to self-hosted instances — E2B is enabled by default on sim.ai.
</Callout>

<Callout type="info">
Python code always runs in the E2B sandbox, even for simple scripts without imports. This ensures a secure, isolated execution environment.
</Callout>

### Returning Results

In Python, print your result as JSON to stdout. The Function block captures stdout and makes it available via `<function.result>`:

```python title="example.py"
import json

data = {"status": "processed", "count": 42}
print(json.dumps(data))
```

### Available Libraries

The E2B sandbox includes the Python standard library (`json`, `re`, `datetime`, `math`, `os`, `collections`, etc.) and common packages like `matplotlib` for visualization. Charts generated with matplotlib are captured as images automatically.

<Callout type="info">
The exact set of pre-installed packages depends on the E2B sandbox configuration. If a package you need isn't available, consider calling an external API from your code instead.
</Callout>

### Matplotlib Charts

When your Python code generates matplotlib figures, they are automatically captured and returned as base64-encoded PNG images in the output:

```python title="chart.py"
import matplotlib.pyplot as plt
import json

data = json.loads('<api.data>')

plt.figure(figsize=(10, 6))
plt.bar(data["labels"], data["values"])
plt.title("Monthly Revenue")
plt.xlabel("Month")
plt.ylabel("Revenue ($)")
plt.savefig("chart.png")
plt.show()
```

{/* TODO: Screenshot of Python code execution output in the logs panel */}

### JavaScript vs. Python

| | JavaScript | Python |
|--|-----------|--------|
| **Execution** | Local VM (fast) or E2B sandbox (with imports) | Always E2B sandbox |
| **Returning results** | `return { ... }` | `print(json.dumps({ ... }))` |
| **HTTP requests** | `fetch()` built-in | `requests` or `httpx` |
| **Best for** | Quick transforms, JSON manipulation | Data science, charting, complex math |

## Best Practices

Expand Down
Loading
Loading