Skip to main content

Agent Plugin Authoring

Agent Plugin Quickstart

Let's get started building your first agent plugin.

Plugins are an extensible system for building agents for your PromptPanel instance.

If you can prototype your agent using Python, you should be able to fit it to our system and generate a customizable chat-based interface for your application (complete with authentication and access controls).

Files and Directories

The following is an example of what a sample Plugin directory looks like.
Only two files are required, a handler.py and a manifest.json.

handler.py
manifest.json
requirements.txt    # optional
readme.md           # optional
/template           # optional
    panel.html      # optional
    thread.html     # optional
    message.html    # optional
/static             # optional
    icon.png
    ...

handler.py

The handler.py is the entrypoint to the logic for your Plugin.

On the creation of a Message or File, the following functions from your handler.py will be called (they will also contain the context of the associated parameters):

  • For incoming files Files: def file_handler(file, thread, panel): ...
  • For incoming Messages def message_handler(message, thread, panel):

Data Available

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

You can access all of these models from within your plugin, (for example, file.filename or message.content). You can also query these models, useful for implementations like memory.

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.

Returning Text to Frontend

In terms of returning, the out-of-box templates expect a text-based StreamingHttpResponse with deltas (but can be customized if you customize your /templates below).

manifest.json

The manifest will have more details about your plugin (like settings which the user can configure).

You can read up more on manifests here, but below is a simple one you can use to get started:

{
  "name": "My First Plugin",
}

Your First Plugin

We've created a Hello World style example of a Plugin which you can modify and try out.

You can find this, as well as other reference Plugins in the plugin directory of our repo.

One-Click Development Environment

Get started developing using a one-click cloud development environment using GitPod: