praisonai-plugins 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- praisonai_plugins-0.0.2/PKG-INFO +51 -0
- praisonai_plugins-0.0.2/README.md +42 -0
- praisonai_plugins-0.0.2/praisonai_plugins/__init__.py +3 -0
- praisonai_plugins-0.0.2/praisonai_plugins/hooks/__init__.py +3 -0
- praisonai_plugins-0.0.2/praisonai_plugins/hooks/simple_logger.py +45 -0
- praisonai_plugins-0.0.2/praisonai_plugins/observability/__init__.py +3 -0
- praisonai_plugins-0.0.2/praisonai_plugins/observability/custom_tracer.py +35 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/PKG-INFO +51 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/SOURCES.txt +13 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/dependency_links.txt +1 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/entry_points.txt +3 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/requires.txt +1 -0
- praisonai_plugins-0.0.2/praisonai_plugins.egg-info/top_level.txt +1 -0
- praisonai_plugins-0.0.2/pyproject.toml +24 -0
- praisonai_plugins-0.0.2/setup.cfg +4 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: praisonai-plugins
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Protocol-driven plugins for PraisonAI Agents
|
|
5
|
+
Author: Mervin Praison
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: praisonaiagents>=0.1.0
|
|
9
|
+
|
|
10
|
+
# PraisonAI Plugins
|
|
11
|
+
|
|
12
|
+
Protocol-driven plugins for PraisonAI Agents. This repository contains officially supported plugins that hook into the core agent lifecycle events.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install praisonai-plugins
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you are developing plugins locally:
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/MervinPraison/PraisonAI-Plugins.git
|
|
23
|
+
cd PraisonAI-Plugins
|
|
24
|
+
pip install -e .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
PraisonAI's core SDK introduces a `discover_entry_points()` mechanism in its `PluginManager`.
|
|
30
|
+
When you install `praisonai-plugins`, the entry points declared in `pyproject.toml` are registered in your Python environment under the `praisonai.plugins` group.
|
|
31
|
+
|
|
32
|
+
To load them in your agent:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from praisonaiagents.plugins.manager import get_plugin_manager
|
|
36
|
+
|
|
37
|
+
manager = get_plugin_manager()
|
|
38
|
+
manager.discover_entry_points()
|
|
39
|
+
|
|
40
|
+
# Your agent will now use the installed plugins!
|
|
41
|
+
from praisonaiagents import Agent
|
|
42
|
+
agent = Agent(name="Assistant", instructions="Be helpful.")
|
|
43
|
+
agent.start("Hello!")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Adding New Plugins
|
|
47
|
+
|
|
48
|
+
1. Create your plugin class extending `praisonaiagents.plugins.plugin.Plugin`.
|
|
49
|
+
2. Implement your desired hooks (`before_agent`, `after_tool`, etc.).
|
|
50
|
+
3. Add an entry to the `[project.entry-points."praisonai.plugins"]` section in `pyproject.toml`.
|
|
51
|
+
4. Run `pip install -e .` to register your new entry point during testing.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# PraisonAI Plugins
|
|
2
|
+
|
|
3
|
+
Protocol-driven plugins for PraisonAI Agents. This repository contains officially supported plugins that hook into the core agent lifecycle events.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install praisonai-plugins
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
If you are developing plugins locally:
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/MervinPraison/PraisonAI-Plugins.git
|
|
14
|
+
cd PraisonAI-Plugins
|
|
15
|
+
pip install -e .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## How It Works
|
|
19
|
+
|
|
20
|
+
PraisonAI's core SDK introduces a `discover_entry_points()` mechanism in its `PluginManager`.
|
|
21
|
+
When you install `praisonai-plugins`, the entry points declared in `pyproject.toml` are registered in your Python environment under the `praisonai.plugins` group.
|
|
22
|
+
|
|
23
|
+
To load them in your agent:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from praisonaiagents.plugins.manager import get_plugin_manager
|
|
27
|
+
|
|
28
|
+
manager = get_plugin_manager()
|
|
29
|
+
manager.discover_entry_points()
|
|
30
|
+
|
|
31
|
+
# Your agent will now use the installed plugins!
|
|
32
|
+
from praisonaiagents import Agent
|
|
33
|
+
agent = Agent(name="Assistant", instructions="Be helpful.")
|
|
34
|
+
agent.start("Hello!")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Adding New Plugins
|
|
38
|
+
|
|
39
|
+
1. Create your plugin class extending `praisonaiagents.plugins.plugin.Plugin`.
|
|
40
|
+
2. Implement your desired hooks (`before_agent`, `after_tool`, etc.).
|
|
41
|
+
3. Add an entry to the `[project.entry-points."praisonai.plugins"]` section in `pyproject.toml`.
|
|
42
|
+
4. Run `pip install -e .` to register your new entry point during testing.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Simple Logger Plugin for PraisonAI Agents.
|
|
3
|
+
"""
|
|
4
|
+
from praisonaiagents.plugins.plugin import Plugin, PluginInfo, PluginHook
|
|
5
|
+
from praisonaiagents._logging import get_logger
|
|
6
|
+
from typing import Dict, Any
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
class SimpleLoggerPlugin(Plugin):
|
|
11
|
+
"""
|
|
12
|
+
A simple protocol-driven plugin that logs when an agent starts and finishes,
|
|
13
|
+
and when a tool is called and finishes.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def info(self) -> PluginInfo:
|
|
18
|
+
return PluginInfo(
|
|
19
|
+
name="simple_logger",
|
|
20
|
+
version="1.0.0",
|
|
21
|
+
description="Logs agent and tool execution steps.",
|
|
22
|
+
author="PraisonAI",
|
|
23
|
+
hooks=[
|
|
24
|
+
PluginHook.BEFORE_AGENT,
|
|
25
|
+
PluginHook.AFTER_AGENT,
|
|
26
|
+
PluginHook.BEFORE_TOOL,
|
|
27
|
+
PluginHook.AFTER_TOOL
|
|
28
|
+
]
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def before_agent(self, prompt: str, context: Dict[str, Any]) -> str:
|
|
32
|
+
logger.info(f"Agent starting with prompt length: {len(prompt)}")
|
|
33
|
+
return prompt
|
|
34
|
+
|
|
35
|
+
def after_agent(self, response: str, context: Dict[str, Any]) -> str:
|
|
36
|
+
logger.info(f"Agent finished. Response length: {len(response)}")
|
|
37
|
+
return response
|
|
38
|
+
|
|
39
|
+
def before_tool(self, tool_name: str, args: Dict[str, Any]) -> Dict[str, Any]:
|
|
40
|
+
logger.info(f"Tool executing: {tool_name} with args: {args}")
|
|
41
|
+
return args
|
|
42
|
+
|
|
43
|
+
def after_tool(self, tool_name: str, result: Any) -> Any:
|
|
44
|
+
logger.info(f"Tool {tool_name} finished. Result: {result}")
|
|
45
|
+
return result
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Custom Tracer Plugin for PraisonAI Agents.
|
|
3
|
+
"""
|
|
4
|
+
from praisonaiagents.plugins.plugin import Plugin, PluginInfo, PluginHook
|
|
5
|
+
from praisonaiagents._logging import get_logger
|
|
6
|
+
from typing import Dict, Any, List
|
|
7
|
+
|
|
8
|
+
logger = get_logger(__name__)
|
|
9
|
+
|
|
10
|
+
class CustomTracerPlugin(Plugin):
|
|
11
|
+
"""
|
|
12
|
+
A simple protocol-driven plugin that traces LLM calls.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def info(self) -> PluginInfo:
|
|
17
|
+
return PluginInfo(
|
|
18
|
+
name="custom_tracer",
|
|
19
|
+
version="1.0.0",
|
|
20
|
+
description="Traces LLM completion calls.",
|
|
21
|
+
author="PraisonAI",
|
|
22
|
+
hooks=[
|
|
23
|
+
PluginHook.BEFORE_LLM,
|
|
24
|
+
PluginHook.AFTER_LLM
|
|
25
|
+
]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
def before_llm(self, messages: List[Dict], params: Dict[str, Any]) -> tuple:
|
|
29
|
+
logger.info(f"[Trace] Sending {len(messages)} messages to LLM model {params.get('model', 'unknown')}")
|
|
30
|
+
return messages, params
|
|
31
|
+
|
|
32
|
+
def after_llm(self, response: str, usage: Dict[str, Any]) -> str:
|
|
33
|
+
tokens = usage.get('total_tokens', 0) if usage else 0
|
|
34
|
+
logger.info(f"[Trace] LLM responded. Tokens used: {tokens}")
|
|
35
|
+
return response
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: praisonai-plugins
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Protocol-driven plugins for PraisonAI Agents
|
|
5
|
+
Author: Mervin Praison
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: praisonaiagents>=0.1.0
|
|
9
|
+
|
|
10
|
+
# PraisonAI Plugins
|
|
11
|
+
|
|
12
|
+
Protocol-driven plugins for PraisonAI Agents. This repository contains officially supported plugins that hook into the core agent lifecycle events.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install praisonai-plugins
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you are developing plugins locally:
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/MervinPraison/PraisonAI-Plugins.git
|
|
23
|
+
cd PraisonAI-Plugins
|
|
24
|
+
pip install -e .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
PraisonAI's core SDK introduces a `discover_entry_points()` mechanism in its `PluginManager`.
|
|
30
|
+
When you install `praisonai-plugins`, the entry points declared in `pyproject.toml` are registered in your Python environment under the `praisonai.plugins` group.
|
|
31
|
+
|
|
32
|
+
To load them in your agent:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from praisonaiagents.plugins.manager import get_plugin_manager
|
|
36
|
+
|
|
37
|
+
manager = get_plugin_manager()
|
|
38
|
+
manager.discover_entry_points()
|
|
39
|
+
|
|
40
|
+
# Your agent will now use the installed plugins!
|
|
41
|
+
from praisonaiagents import Agent
|
|
42
|
+
agent = Agent(name="Assistant", instructions="Be helpful.")
|
|
43
|
+
agent.start("Hello!")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Adding New Plugins
|
|
47
|
+
|
|
48
|
+
1. Create your plugin class extending `praisonaiagents.plugins.plugin.Plugin`.
|
|
49
|
+
2. Implement your desired hooks (`before_agent`, `after_tool`, etc.).
|
|
50
|
+
3. Add an entry to the `[project.entry-points."praisonai.plugins"]` section in `pyproject.toml`.
|
|
51
|
+
4. Run `pip install -e .` to register your new entry point during testing.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
praisonai_plugins/__init__.py
|
|
4
|
+
praisonai_plugins.egg-info/PKG-INFO
|
|
5
|
+
praisonai_plugins.egg-info/SOURCES.txt
|
|
6
|
+
praisonai_plugins.egg-info/dependency_links.txt
|
|
7
|
+
praisonai_plugins.egg-info/entry_points.txt
|
|
8
|
+
praisonai_plugins.egg-info/requires.txt
|
|
9
|
+
praisonai_plugins.egg-info/top_level.txt
|
|
10
|
+
praisonai_plugins/hooks/__init__.py
|
|
11
|
+
praisonai_plugins/hooks/simple_logger.py
|
|
12
|
+
praisonai_plugins/observability/__init__.py
|
|
13
|
+
praisonai_plugins/observability/custom_tracer.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
praisonaiagents>=0.1.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
praisonai_plugins
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "praisonai-plugins"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
description = "Protocol-driven plugins for PraisonAI Agents"
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Mervin Praison"},
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"praisonaiagents>=0.1.0",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.entry-points."praisonai.plugins"]
|
|
19
|
+
simple_logger = "praisonai_plugins.hooks.simple_logger:SimpleLoggerPlugin"
|
|
20
|
+
custom_tracer = "praisonai_plugins.observability.custom_tracer:CustomTracerPlugin"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["."]
|
|
24
|
+
include = ["praisonai_plugins", "praisonai_plugins.*"]
|