DocumentationIntegration
Drop-In Safety

Framework Adapters

One line to make any framework safe. Each adapter uses guard.effect() internally with provider receipt extraction, writing full ledger entries automatically.

Supported Frameworks

LangGraph
👥
CrewAI
Inngest
n8n
🌊
Airflow
🧠
Anthropic MCP
🤖
OpenAI Assistants
Vercel AI SDK

LangGraph

Wrap your LangGraph nodes with guard.langGraph() to make them retry-safe. The adapter automatically extracts the receipt from the node's return value.

charge-node.ts
import { guard } from '@replaysafe/guard-sdk'

async function chargeNode(state) {
  const charge = await guard.langGraph(
    'stripe-charge',
    { amount: state.amount, customer: state.customerId },
    () => stripe.charges.create({
      amount: state.amount,
      customer: state.customerId,
    })
  )
  return { chargeId: charge.id }
}

CrewAI

Wrap your CrewAI tool calls with guard.crewai() to prevent duplicate tool executions across agent retries.

search-tool.ts
import { guard } from '@replaysafe/guard-sdk'

async function searchTool(query) {
  return await guard.crewai(
    'web-search',
    { query },
    () => tavily.search({ query })
  )
}

Inngest

Wrap your Inngest step functions with guard.inngest() to make each step idempotent across function retries.

process-order.ts
import { guard } from '@replaysafe/guard-sdk'

export const processOrder = inngest.createFunction(
  { id: 'process-order' },
  { event: 'order.created' },
  async ({ event, step }) => {
    await step.run('charge', () =>
      guard.inngest('stripe-charge', { orderId: event.data.orderId },
        () => stripe.charges.create({ amount: event.data.amount })
      )
    )
  }
)

MCP & OpenAI Assistants

For Anthropic MCP tools and OpenAI Assistants, use guard.mcp() and guard.openai() respectively. These adapters handle the provider-specific receipt extraction automatically.

mcp-tool.ts
import { guard } from '@replaysafe/guard-sdk'

// Anthropic MCP
await guard.mcp('file-write', { path, content },
  () => fs.writeFile(path, content)
)

// OpenAI Assistants
await guard.openai('code-interpreter', { input },
  () => openai.assistants.code({ input })
)

Any Framework

Don't see your framework? Use guard.effect() directly - it works with any async function. The adapter just provides convenience methods for receipt extraction.

// Generic usage — works with any framework
const result = await guard.effect({
  type: 'CUSTOM_OPERATION',
  target: 'my-api-call',
  input: { key: 'value' },
  execute: () => myCustomFunction(),
  receipt: (r) => ({ id: r.id }),
})

Next Steps

Ready to make your framework retry-safe? Start with the ReplayGuard SDK.