AGENT SKILL

sp-inngest

Use for Inngest provider guidance in this project.

License 许可
MIT
最近更新
2026-07-02
Stars
★ 3
Forks
0

01 前言 Front Matter

name
sp-inngest
description
Use for Inngest provider guidance in this project.

03 SKILL.md 正文

Inngest provider guidance

Generated by stripe projects llm-context for Inngest. Source: https://www.inngest.com/llm-context.md

Inngest Integration Guide

After provisioning, your access_configuration contains the credentials needed to integrate Inngest into your application.

Environment Variables

Add these to your .env file (or your platform's environment configuration):

INNGEST_SIGNING_KEY=<your signing key from access_configuration>
INNGEST_EVENT_KEY=<your event key from access_configuration>

The signing key authenticates communication between your app and Inngest. The event key is used to send events that trigger functions.

SDK Installation

TypeScript / JavaScript

npm install inngest

Python

pip install inngest

Creating the Inngest Client

TypeScript

import { Inngest } from "inngest";

const inngest = new Inngest({ id: "my-app" });

Python

import inngest

client = inngest.Inngest(app_id="my-app")

Writing Functions

Functions are the core building block. Each function is triggered by an event or a cron schedule. The trigger is defined in the triggers property of the function configuration object.

Event-triggered function (TypeScript)

const processUpload = inngest.createFunction(
  { id: "process-upload", triggers: [{ event: "app/file.uploaded" }] },
  async ({ event, step }) => {
    const result = await step.run("process", async () => {
      return await processFile(event.data.fileUrl);
    });

    await step.run("notify", async () => {
      await sendNotification(event.data.userId, result);
    });

    return { success: true };
  }
);

Cron function (TypeScript)

const dailyCleanup = inngest.createFunction(
  { id: "daily-cleanup", triggers: [{ cron: "0 0 * * *" }] },
  async ({ step }) => {
    await step.run("cleanup", async () => {
      return await cleanupOldRecords();
    });
  }
);

Event-triggered function (Python)

@client.create_function(
    fn_id="process-upload",
    trigger=inngest.TriggerEvent(event="app/file.uploaded"),
)
async def process_upload(ctx: inngest.Context, step: inngest.Step):
    async def process():
        return await process_file(ctx.event.data["file_url"])

    result = await step.run("process", process)

    async def notify():
        await send_notification(ctx.event.data["user_id"], result)

    await step.run("notify", notify)
    return {"success": True}

Cron function (Python)

@client.create_function(
    fn_id="daily-cleanup",
    trigger=inngest.TriggerCron(cron="0 0 * * *"),
)
async def daily_cleanup(ctx: inngest.Context, step: inngest.Step):
    async def cleanup():
        return await cleanup_old_records()

    await step.run("cleanup", cleanup)

Serving Functions

Use the serve() handler to expose your functions via an HTTP endpoint. Inngest calls this endpoint to discover and invoke your functions.

Bun (zero extra dependencies)

import { serve } from "inngest/bun";
import { inngest } from "./inngest/client";
import { processUpload, dailyCleanup } from "./inngest/functions";

Bun.serve({
  port: 3000,
  fetch: serve({
    client: inngest,
    functions: [processUpload, dailyCleanup],
  }),
});

Next.js (App Router)

// app/api/inngest/route.ts
import { serve } from "inngest/next";
import { inngest } from "@/inngest/client";
import { processUpload, dailyCleanup } from "@/inngest/functions";

export const { GET, POST, PUT } = serve({
  client: inngest,
  functions: [processUpload, dailyCleanup],
});

Express

import express from "express";
import { serve } from "inngest/express";
import { inngest } from "./inngest/client";
import { processUpload, dailyCleanup } from "./inngest/functions";

const app = express();

app.use("/api/inngest", serve({
  client: inngest,
  functions: [processUpload, dailyCleanup],
}));

app.listen(3000);

FastAPI (Python)

import inngest
import inngest.fast_api
from fastapi import FastAPI

app = FastAPI()
client = inngest.Inngest(app_id="my-app")

inngest.fast_api.serve(app, client, [process_upload, daily_cleanup])

Sending Events

Trigger functions by sending events from anywhere in your application.

TypeScript

await inngest.send({
  name: "app/file.uploaded",
  data: {
    fileUrl: "https://example.com/file.pdf",
    userId: "user_123",
  },
});

Python

await client.send(
    inngest.Event(
        name="app/file.uploaded",
        data={
            "file_url": "https://example.com/file.pdf",
            "user_id": "user_123",
        },
    )
)

REST API

curl -X POST https://inn.gs/e/<INNGEST_EVENT_KEY> \
  -H "Content-Type: application/json" \
  -d '{"name": "app/file.uploaded", "data": {"fileUrl": "https://example.com/file.pdf"}}'

Syncing Your App

After deploying your application, Inngest needs to discover your functions by syncing with your serve endpoint.

  1. Deploy your app with the serve endpoint accessible at a public URL
  2. Sync your app by sending a PUT request to your serve endpoint:
curl -X PUT https://your-app.com/api/inngest --fail-with-body

This triggers the SDK to register its function definitions with the Inngest API. The SDK handles all authentication automatically using your INNGEST_SIGNING_KEY. 3. Inngest also automatically syncs when your app starts, or you can trigger a sync from the dashboard

REST API v2

Inngest provides a REST API for managing your account and resources programmatically.

Authentication: Include your signing key as a Bearer token:

Authorization: Bearer <INNGEST_SIGNING_KEY>

To target a specific environment, include the optional header:

X-Inngest-Env: <environment-id>

Available Endpoints

  • GET https://api.inngest.com/v2/account -- Fetch account information
  • GET https://api.inngest.com/v2/envs -- List environments (workspaces)
  • POST https://api.inngest.com/v2/envs -- Create a new environment
  • GET https://api.inngest.com/v2/keys/signing -- List signing keys
  • GET https://api.inngest.com/v2/keys/events -- List event keys

Dashboard

Access your Inngest dashboard using the dashboard_url from your access_configuration to view function runs, manage environments, and monitor your workflows.

Further Documentation

For comprehensive documentation including advanced features like concurrency control, throttling, batching, fan-out patterns, and more, see the full documentation index at https://www.inngest.com/llms.txt

04 同仓库更多 Skills