Serverless Flush

Background sync may not finish before a frozen Lambda or Edge runtime. Flush explicitly at handler end.

Agent hint

Use when deploying to Lambda, Cloud Functions, or Vercel — call flush() or await flushAndWait().

In scope

  • flush() Python
  • flushAndWait() Node
  • Handler exit pattern

Out of scope

  • Ledger path on read-only FS — see Filesystem
  • HTTP retry — see Cloud Sync
Python
from aurex_sdk import AurexAuditor

auditor = AurexAuditor()

def handler(event, context):
    # ... LLM work ...
    auditor.flush()
    return {"statusCode": 200}
Node.js
import { AurexAuditor } from "aurex-sdk";

const auditor = AurexAuditor.getInstance();

export async function handler(event) {
  // ... LLM work ...
  await auditor.flushAndWait();
  return { statusCode: 200 };
}

See also