I'm exploring a new way to build reactive applications using an 'Agents' API. Inspired by Preact Signals and my previous reactive-prompt project, this toolkit uses Chrome's prompt API. Each Agent has a persona, task, and context, reacting to input changes. You can chain Agents, passing data between them. I've created different Agent types like a 'Human' Agent representing user input and a 'ToolCaller' that can execute JavaScript functions based on context. This experiment explores data-flow-driven LLM applications, similar to Breadboard, and leverages Preact Signals for managing this flow.
I've created a small library called reactive-prompt that lets you easily manage prompts in a reactive way, similar to how you'd build a web app with React. It uses Preact's Signals to track changes to inputs and automatically re-runs prompts when those inputs update. This allows for efficient chaining of prompts, where the output of one becomes the input of another, and only necessary prompts are re-evaluated. The library currently uses Chrome's experimental prompt API but could be adapted for other providers like OpenAI or Gemini. It makes complex prompt flows much more manageable.