Skip to main content

Protocol-driven plugins for PraisonAI Agents

Project description

PraisonAI Plugins

PraisonAI Plugins is a foundational repository demonstrating how to extend the standard capabilities of the PraisonAI framework using the official Plugin Ecosystem.

Every design decision here revolves around our Agent-Centric Philosophy. You simply write standard python functions and register them. PraisonAI's architecture handles dynamically searching and integrating your plugins at startup without complex configuration files strings.

Features

This repository includes examples and templates covering all 6 Plugin Types categorized natively by the PraisonAI SDK:

  1. Hooks: Inject code into agent interactions like tracking API calls, displaying terminal logs, etc. (simple_logger, custom_tracer)
  2. Tools: Bundle functional python functions as tools that an agent can call automatically. (basic_tools)
  3. Guardrails: Validate outputs, ensure safety, intercept Prompt Injections, prevent PII escapes. (pii_guardrail)
  4. Policies: Set runtime execution contexts—for example blocking dangerous tool execution unconditionally. (strict_policy)
  5. Skills: Bundle higher-level instructions and techniques to transform how the agent "thinks". (researcher_skill)
  6. Integrations: Effortless connectors to 3rd party APIs, internal databases, or services like Slack, Jira. (slack_integration)

🚀 Quickstart for Non-Developers

Install

Getting started is designed to be frictionless for both beginners and experts:

# 1. Clone this package (the plugin repository)
git clone https://github.com/mervinpraison/praisonai-plugins.git
cd praisonai-plugins

# 2. Install the plugins to your global python environment
pip install -e .

That's it. PraisonAI automatically knows you installed these plugins. No messy config required.

Testing Agent Flow

By simply checking if the plugins are available, your standard PraisonAI Agent acts normally, but now runs with the enhanced logic in your Plugins. For example, your test_plugins_discovery.py handles:

from praisonaiagents import Agent

agent = Agent(name="Tester", instructions="Just repeat what I say.")
# This automatically executes all logic defined in plugins: Guardrails, Logging, etc
agent.start("Hello world!")

🛠️ Developer Guide: Building Custom Plugins

The PraisonAI SDK natively implements a powerful Protocol-Driven plugin system.

A Protocol refers to a strict interface specification defining WHAT functionality exists without touching HOW PraisonAI works internally. Your plugins implement hooks across an Agent's lifecycle without modifying core SDK files!

1. Write the Plugin

Inside the src/praisonai_plugins folder, you can create a standard python class mimicking this example Guardrail plugin (pii_guardrail.py):

from praisonaiagents.plugins.plugin import Plugin, PluginInfo, PluginHook

class PIIGuardrailPlugin(Plugin):
    """A protocol-driven plugin evaluating guardrails."""
    
    @property
    def info(self) -> PluginInfo:
        return PluginInfo(
            name="pii_guardrail",
            version="1.0.0",
            description="Blocks PII in responses.",
            author="PraisonAI",
            hooks=[PluginHook.AFTER_LLM] # Define when this plugin acts!
        )
        
    def after_llm(self, response: str, usage: dict) -> str:
        # Example Logic protecting SSN
        if "social security" in response.lower():
            return "[REDACTED BY GUARDRAIL]"
        return response

2. Export it via pyproject.toml

PraisonAI scans for [project.entry-points."praisonai.plugins"] to load classes automatically! In the pyproject.toml root file, export it:

[project.entry-points."praisonai.plugins"]
pii_guardrail = "praisonai_plugins.guardrails.pii_guardrail:PIIGuardrailPlugin"

3. Reinstall

pip install -e .

Now, every time any agent inside your Python environment receives a response containing "social security", this plugin intercepts it, evaluates it, and scrubs the PII.


The PraisonAI Protocol Philosophy

Built with developers in mind, PraisonAI's architectural design features:

  • Zero Overhead: The underlying Core SDK limits itself to hooks and standard Dataclass instances. Lazy-imports mean plugin hooks effectively run with near-zero performance cost.
  • Safe Multi-Agent Design: Plugins don't hold shared state. If you orchestrate AgentFlow() loops, these plugins safely execute globally without thread-locking context bugs.
  • Protocol Extensibility: You're never boxed in. Whether it's the MemoryProtocol, ToolProtocol, or native events (before_agent, after_llm), the Plugin abstraction matches any scenario you face in building robust GenAI apps.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

praisonai_plugins-0.0.4.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

praisonai_plugins-0.0.4-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file praisonai_plugins-0.0.4.tar.gz.

File metadata

  • Download URL: praisonai_plugins-0.0.4.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for praisonai_plugins-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5c88c65f036f747d0bda49c70176ccc819a9e1845b3ebf9e8b73d4e362b5555b
MD5 202fd6c191ca14c9fdd9a4852ccac270
BLAKE2b-256 dab7e6575f521afcc605d24e1bc8db9dd2db23e8693a0d268d72b12983bd5cf1

See more details on using hashes here.

File details

Details for the file praisonai_plugins-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for praisonai_plugins-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ea5f9c09991249be4df9c0ffe9509137e2edbf1d4ca728bb5a6f5864998c2de8
MD5 95eace0848103a180e880ec9b6251869
BLAKE2b-256 ccea098c044709fd4e27fab6a83d314d9924ce6d8e62ab90fbec3598f4190aad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page