This is an example using Inngest and Partykit to build a collaborative AI-assisted workflow.
Inngest initiates and orchestrates the workflow, and Partykit is used as a proxy to the OpenAI API. We need a proxy because the OpenAI API streams responses, and we want to orchestrate actions based on suggestions and function calls that the OpenAI API returns.
This is important because we aren't building a simple chat box. We want a UI that allows us to do actual work, and we cannot trust the LLM to make appropriate business decisions.
We can trust the LLM to make suggestions, and we can use those suggestions to make human-level decisions.
The user has a text box they can type into and ask for a particular task. This initiates a workflow with Inngest. As OpenAI streams back its responses, we can use Partykit as a proxy for the streams and broadcast those responses to every subscribed user.
This means that we are able to create multiplayer workflows that are assisted by AI.
Get everything installed:
pnpm install
Start everything like this:
pnpm dev
pnpm dev
starts the web application server, the PartyKit dev server, and the Inngest dev server.
Inngest runs at https://localhost:8288, and the web app server runs at https://localhost:3000. Open both of these in your browser!
Partykit doesn't have a UI but is running at https://127.0.0.1:1999/
OPENAI_API_KEY
and LINEAR_API_KEY
need to be set in /apps/web/.env.local
for the web app to work.
👋 Note that the linear function delete
does NOT actually delete issues. You can create a Linear account for free to test it out.
This example includes the following packages/apps:
web
: simple Next.js appopenai-party
: a PartyKit serverui
: a stub React component library shared by bothweb
applicationseslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s used throughout the monorepo
Each package/app is 100% TypeScript.
To build all apps and packages, run the following command:
pnpm build
To develop all apps and packages, run the following command:
pnpm dev