jeremylongshore

lindy-sdk-patterns

@jeremylongshore/lindy-sdk-patterns
jeremylongshore
1,004
123 forks
Updated 1/18/2026
View on GitHub

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".

Installation

$skills install @jeremylongshore/lindy-sdk-patterns
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Pathplugins/saas-packs/lindy-pack/skills/lindy-sdk-patterns/SKILL.md
Branchmain
Scoped Name@jeremylongshore/lindy-sdk-patterns

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

skills list

Skill Instructions


name: lindy-sdk-patterns description: | 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". allowed-tools: Read, Write, Edit version: 1.0.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io

Lindy SDK Patterns

Overview

Essential SDK patterns and best practices for Lindy AI agent development.

Prerequisites

  • Completed lindy-install-auth setup
  • Basic understanding of async/await
  • Familiarity with TypeScript

Instructions

Pattern 1: Client Singleton

// lib/lindy.ts
import { Lindy } from '@lindy-ai/sdk';

let client: Lindy | null = null;

export function getLindyClient(): Lindy {
  if (!client) {
    client = new Lindy({
      apiKey: process.env.LINDY_API_KEY!,
      timeout: 30000,
    });
  }
  return client;
}

Pattern 2: Agent Factory

// agents/factory.ts
import { getLindyClient } from '../lib/lindy';

interface AgentConfig {
  name: string;
  instructions: string;
  tools?: string[];
}

export async function createAgent(config: AgentConfig) {
  const lindy = getLindyClient();

  const agent = await lindy.agents.create({
    name: config.name,
    instructions: config.instructions,
    tools: config.tools || [],
  });

  return agent;
}

Pattern 3: Retry with Backoff

async function runWithRetry<T>(
  fn: () => Promise<T>,
  maxRetries = 3
): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error: any) {
      if (error.status === 429 && i < maxRetries - 1) {
        await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
        continue;
      }
      throw error;
    }
  }
  throw new Error('Max retries exceeded');
}

Pattern 4: Streaming Responses

async function streamAgentResponse(agentId: string, input: string) {
  const lindy = getLindyClient();

  const stream = await lindy.agents.runStream(agentId, { input });

  for await (const chunk of stream) {
    process.stdout.write(chunk.delta);
  }
  console.log(); // newline
}

Output

  • Reusable client singleton pattern
  • Agent factory for consistent creation
  • Robust error handling with retries
  • Streaming support for real-time output

Error Handling

PatternUse CaseBenefit
SingletonConnection reuseReduced overhead
FactoryAgent creationConsistency
RetryRate limitsReliability
StreamingLong responsesBetter UX

Examples

Complete Agent Service

// services/agent-service.ts
import { getLindyClient } from '../lib/lindy';

export class AgentService {
  private lindy = getLindyClient();

  async createAndRun(name: string, instructions: string, input: string) {
    const agent = await this.lindy.agents.create({ name, instructions });
    const result = await this.lindy.agents.run(agent.id, { input });
    return { agent, result };
  }

  async listAgents() {
    return this.lindy.agents.list();
  }

  async deleteAgent(id: string) {
    return this.lindy.agents.delete(id);
  }
}

Resources

Next Steps

Proceed to lindy-core-workflow-a for agent creation workflows.

More by jeremylongshore

View all
rabbitmq-queue-setup
1,004

Rabbitmq Queue Setup - Auto-activating skill for Backend Development. Triggers on: rabbitmq queue setup, rabbitmq queue setup Part of the Backend Development skill category.

model-evaluation-suite
1,004

evaluating-machine-learning-models: This skill allows Claude to evaluate machine learning models using a comprehensive suite of metrics. It should be used when the user requests model performance analysis, validation, or testing. Claude can use this skill to assess model accuracy, precision, recall, F1-score, and other relevant metrics. Trigger this skill when the user mentions "evaluate model", "model performance", "testing metrics", "validation results", or requests a comprehensive "model evaluation".

neural-network-builder
1,004

building-neural-networks: This skill allows Claude to construct and configure neural network architectures using the neural-network-builder plugin. It should be used when the user requests the creation of a new neural network, modification of an existing one, or assistance with defining the layers, parameters, and training process. The skill is triggered by requests involving terms like "build a neural network," "define network architecture," "configure layers," or specific mentions of neural network types (e.g., "CNN," "RNN," "transformer").

oauth-callback-handler
1,004

Oauth Callback Handler - Auto-activating skill for API Integration. Triggers on: oauth callback handler, oauth callback handler Part of the API Integration skill category.