AgentUtil
Basic classes and utilities for developing agent-based applications.
Installation
pip install agentutil
Or, if you are developing locally:
pip install -e .
Or, if you are use uv:
uv add agentutil
Usage
Importing
from agentutil.utils.agentAssistant import TestAgentAssistant, AgentAssistant
from agentutil.agent import Agent # or your custom agent class
from agentutil.utils.models import News
Example: Custom Assistant and Agent
import asyncio
from agentutil.utils.agentAssistant import AgentAssistant
from agentutil.agent import Agent
from agentutil.utils.models import News
class SJAssistant(AgentAssistant):
def __init__(self):
super().__init__()
def publish_article(self, news_id: str, news: News):
print("MY CUSTOM PUBLISH...")
await asyncio.sleep(1)
def update_news_status(
self,
news_id: str,
new_status: str,
title: str = None,
cms_news_id: int = None,
cost: int = None,
duration=None
):
print("MY CUSTOM UPDATE...")
assistant = SJAssistant()
# Example agent class inheriting from Agent
class MasterAgent(Agent):
async def run(self, data):
print("Running MasterAgent...")
agent = MasterAgent(assitant=assistant)
agent.assitant.update_news_status("master_agent", "running")
asyncio.run(agent.assitant.publish_article(News(title="Sample"), "test"))
Custom Agent package structure
ai_engine/graphs/agent1
├── __init__.py
├── agent.py
├── config.py
│
├── form
│ ├── __init__.py
│ └── agent_form.py
│
├── agents
│ ├── __init__.py
│ ├── node1.py
│ ├── node2.py
│ .
│ :
│ └── nodeN.py
│
├── models
│ ├── __init__.py
│ └── models.py
│
├── outputformats
│ ├── __init__.py
│ └── formats.py
│
├── prompts
│ ├── __init__.py
│ └── prompts.py
│
└── tools
├── __init__.py
├── tools1.py
├── tools2.py
.
:
└── toolsN.py
your agent.py file should be like this:
from agentutil.agent import Agent
from .form.agent_form import NewsForm
from .config import AGENT_CONFIG
class MasterAgent(Agent):
def __init__(self, assistant=None, form=None):
super().__init__(assitant=assistant)
self.form = NewsForm
self.config = AGENT_CONFIG
async def run(self, data):
# your custom agent graph
pass
your config.py should contains these fields:
AGENT_CONFIG = {
"name": "نام خط تولید",
"description": "توضیحات مربوط به خط تولید",
"parameters": {
}
}
your form.agent_form.py should be like this:
from django import forms
class NewsForm(forms.Form):
pass
License
MIT
Metadata
Release files for agentutil 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentutil-0.2.0.tar.gz | 10.5 kB | Without provenance | Details for agentutil-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentutil-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for agentutil-0.2.0-py3-none-any.whl |
Total release size: 22.3 kB
Release files / agentutil-0.2.0.tar.gz
| Download URL | agentutil-0.2.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a03cff2817196897004b835a4490c45a0f94ff46c7c29c9e93e9c99946475ae2
|
|
BLAKE2b-256 checksum How to use checksums |
ad79e2f52e70db59b3d79dbbcfd19ddcb7e72a15032bfd51551378e20ec48dbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Release files / agentutil-0.2.0-py3-none-any.whl
| Download URL | agentutil-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
392d24abbce1a81daf20adb67ee084a06ef1e9992ad7e719630b9256ea8fff23
|
|
BLAKE2b-256 checksum How to use checksums |
00c1119d9b903f6cee574b8eec43a060bab27a0719a379c9bb3b82b22aef634c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Security for agentutil 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.