Lindy AI SDK best practices and common patterns.
Use when learning SDK patterns, optimizing API usage,
or implementing advanced agent features.
Trigger with phrases like "lindy SDK patterns", "lindy best practices",
"lindy API patterns", "lindy code patterns".
Lindy is primarily a no-code platform. External integration happens through three
channels: Webhook triggers (inbound), HTTP Request actions (outbound), and
Run Code actions (inline Python/JS execution via E2B sandbox). This skill covers
patterns for each.
Prerequisites
Lindy account with active agents
Node.js 18+ or Python 3.10+ for webhook receivers
Completed lindy-install-auth setup
Pattern 1: Webhook Trigger Integration
Your application fires webhooks to wake Lindy agents:
Send the processed data as JSON with fields matching the API schema.
Include: name from {{trigger.data.name}}, analysis from previous step.
Your API endpoint receives the call:
// Your API receiving Lindy agent calls
app.post('/process', async (req, res) => {
const { name, analysis } = req.body;
const result = await processData(name, analysis);
res.json({ result, processedAt: new Date().toISOString() });
});
Pattern 3: Run Code Action (E2B Sandbox)
Execute Python or JavaScript directly in Lindy workflows. Code runs in isolated
Firecracker microVMs with ~150ms startup time.
Python example (data transformation in a workflow):
# Run Code action — Python
# Input variables: raw_data (string from previous step)
import json
data = json.loads(raw_data) # Input vars are always strings
# Process
cleaned = [
{"name": item["name"].strip(), "score": float(item["score"])}
for item in data["items"]
if float(item["score"]) > 0.5
]
# Sort by score descending
cleaned.sort(key=lambda x: x["score"], reverse=True)
# Return value accessible as {{run_code.result}} in next step
return json.dumps({"filtered_count": len(cleaned), "items": cleaned})