Skip to main content

Agent Plugin Authoring

Data Model

The data model is good for understanding how PromptPanel works and what is happening when you send a message or upload a file.

It's also useful for if you want to author your own plugin agents.

Definitions

Plugin Agents

Plugin agents are meant to be user-loadable and extensible. They contain all the logic that is needed to run an AI experience.

They contain:

  • a manifest which are the metadata settings the user can set for a Panel.
  • a static directory of files which will be dynamically serves such as CSS and JS.
  • a templates directory for the routes for the Plugin's Panels, Threads, and Messages.
  • a handler which has the logic that will be run when a new Message or File is created.

Panels

Panels can be thought of as bots or applets. They have metadata settings which are derived from the Plugin they are associated to.

They are owned by a User.

Threads

Threads are topics owned by the Panel.

Utilizing them is optional depending on the logic of the Plugin associated with your Panel.

Messages and Files

Are User / bot created (by the Plugin).

They are related to the Panel, but also optionally to the Thread.

Creating a new Message or File will kick of the handler logic of the associated Plugin.


You can view the models.py file for an up-to-date view of the models described above.

Relationships

data-model.png

The core data model has a few relationships:

  • Panels are created by by Users.
  • Threads are owned by Panels.
  • Messages are related Panels, and optionally Threads.
  • Files are related to Panels, and optionally Threads as well.

Auxiliary Data

Aside from the relationships between objects - the data objects also contain a small amount of data.

  • Panels have a name.
  • Threads have a title.
  • Messages contain message content.
  • Files contain a filepath to the raw, uploaded file.

Each of the objects also has a metadata JSON object associated to it for free-form usage, and a created_by, created_on, and updated_at datetime for tracking changes to the object.

Plugin Logic

data-model-plugin.png

The only difference to the metadata is for Panels. Panels receive a metadata template from the manifest of a Plugin which helps guide what metadata should be present as settings.

The metadata from the Plugin manifest is loosely coupled to the Panel (which is why the user is able to swap between Plugins for their Panel and have the metadata options persist).

Anytime a Message or File object is created through the API the message_handler or file_handler is kicked off from the Plugin which contains the logic of what happens next.