agentx-python 0.1__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.
- agentx-python-0.1/LICENSE +21 -0
- agentx-python-0.1/PKG-INFO +30 -0
- agentx-python-0.1/README.md +16 -0
- agentx-python-0.1/agentx_python/__init__.py +19 -0
- agentx-python-0.1/agentx_python/agent.py +55 -0
- agentx-python-0.1/agentx_python/version.py +1 -0
- agentx-python-0.1/agentx_python.egg-info/PKG-INFO +30 -0
- agentx-python-0.1/agentx_python.egg-info/SOURCES.txt +11 -0
- agentx-python-0.1/agentx_python.egg-info/dependency_links.txt +1 -0
- agentx-python-0.1/agentx_python.egg-info/requires.txt +2 -0
- agentx-python-0.1/agentx_python.egg-info/top_level.txt +1 -0
- agentx-python-0.1/setup.cfg +4 -0
- agentx-python-0.1/setup.py +23 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-2024 AgentX, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: agentx-python
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Offical Python SDK for AgentX (https://www.agentx.so/)
|
|
5
|
+
Home-page: https://github.com/AgentX-ai/AgentX-python-sdk
|
|
6
|
+
Author: Robin Wang and AgentX Team
|
|
7
|
+
Author-email: contact@agentx.so
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
# AgentX Python SDK
|
|
16
|
+
|
|
17
|
+
This is a python SDK for AgentX (https://www.agentx.so/)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install --upgrade agentx-python
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
from agentx_python import agent
|
|
29
|
+
print(agent.get_agent("your-agent-id-here"))
|
|
30
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# AgentX Python SDK
|
|
2
|
+
|
|
3
|
+
This is a python SDK for AgentX (https://www.agentx.so/)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install --upgrade agentx-python
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
from agentx_python import agent
|
|
15
|
+
print(agent.get_agent("your-agent-id-here"))
|
|
16
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from agentx_python.agent import Agent
|
|
5
|
+
from agentx_python.version import VERSION
|
|
6
|
+
|
|
7
|
+
logging.basicConfig(
|
|
8
|
+
level=logging.INFO,
|
|
9
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
10
|
+
datefmt="%Y-%m-%d %H:%M:%S %Z",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
api_key = os.environ.get("OPENAI_API_KEY")
|
|
15
|
+
|
|
16
|
+
Agent = Agent()
|
|
17
|
+
|
|
18
|
+
__version__ = VERSION
|
|
19
|
+
__all__ = ["api_key", "Agent"]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import os
|
|
3
|
+
import logging
|
|
4
|
+
import agentx_python as agentx
|
|
5
|
+
from functools import wraps
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def api_key_check_decorator(method):
|
|
9
|
+
@wraps(method)
|
|
10
|
+
def wrapper(self, *args, **kwargs):
|
|
11
|
+
self.middleware()
|
|
12
|
+
return method(self, *args, **kwargs)
|
|
13
|
+
|
|
14
|
+
return wrapper
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Agent:
|
|
18
|
+
|
|
19
|
+
def middleware(self):
|
|
20
|
+
self.api_key = os.getenv("AGENTX_API_KEY") or agentx.api_key
|
|
21
|
+
if not self.api_key:
|
|
22
|
+
raise Exception(
|
|
23
|
+
"No API key provided. You can set your API key in code using 'agentx.api_key = <API-KEY>', or you can set the environment variable AGENTX_API_KEY=<API-KEY>). You can generate API keys in the AgentX https://app.agentx.so."
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
@api_key_check_decorator
|
|
27
|
+
def get_agent(self, id: str):
|
|
28
|
+
url = f"https://api.agentx.so/api/v1/access/agents/{id}"
|
|
29
|
+
headers = {"accept": "*/*", "x-api-key": self.api_key}
|
|
30
|
+
|
|
31
|
+
# Make a GET request to the AgentX API
|
|
32
|
+
response = requests.get(url, headers=headers)
|
|
33
|
+
# Check if response was successful
|
|
34
|
+
if response.status_code == 200:
|
|
35
|
+
return response.json()
|
|
36
|
+
else:
|
|
37
|
+
logging.info(
|
|
38
|
+
response.json()
|
|
39
|
+
) # Print text content of response (or process it as needed)
|
|
40
|
+
raise Exception(
|
|
41
|
+
f"Failed to retrieve agent details: {response.status_code} - {response.reason}"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
@api_key_check_decorator
|
|
45
|
+
def list_agents(self):
|
|
46
|
+
url = "https://api.agentx.so/api/v1/access/agents"
|
|
47
|
+
headers = {"accept": "*/*", "x-api-key": self.api_key}
|
|
48
|
+
|
|
49
|
+
# Make a GET request to the AgentX API
|
|
50
|
+
response = requests.get(url, headers=headers)
|
|
51
|
+
# Check if response was successful
|
|
52
|
+
if response.status_code == 200:
|
|
53
|
+
return response.json()
|
|
54
|
+
else:
|
|
55
|
+
logging.info(response.json())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.1.0"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: agentx-python
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Offical Python SDK for AgentX (https://www.agentx.so/)
|
|
5
|
+
Home-page: https://github.com/AgentX-ai/AgentX-python-sdk
|
|
6
|
+
Author: Robin Wang and AgentX Team
|
|
7
|
+
Author-email: contact@agentx.so
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
# AgentX Python SDK
|
|
16
|
+
|
|
17
|
+
This is a python SDK for AgentX (https://www.agentx.so/)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install --upgrade agentx-python
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
from agentx_python import agent
|
|
29
|
+
print(agent.get_agent("your-agent-id-here"))
|
|
30
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
agentx_python/__init__.py
|
|
5
|
+
agentx_python/agent.py
|
|
6
|
+
agentx_python/version.py
|
|
7
|
+
agentx_python.egg-info/PKG-INFO
|
|
8
|
+
agentx_python.egg-info/SOURCES.txt
|
|
9
|
+
agentx_python.egg-info/dependency_links.txt
|
|
10
|
+
agentx_python.egg-info/requires.txt
|
|
11
|
+
agentx_python.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
agentx_python
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="agentx-python",
|
|
5
|
+
version="0.1",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
"urllib3>=1.26.11",
|
|
9
|
+
"certifi",
|
|
10
|
+
],
|
|
11
|
+
author="Robin Wang and AgentX Team",
|
|
12
|
+
author_email="contact@agentx.so",
|
|
13
|
+
description="Offical Python SDK for AgentX (https://www.agentx.so/)",
|
|
14
|
+
long_description=open("README.md").read(),
|
|
15
|
+
long_description_content_type="text/markdown",
|
|
16
|
+
url="https://github.com/AgentX-ai/AgentX-python-sdk",
|
|
17
|
+
classifiers=[
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
],
|
|
22
|
+
python_requires=">=3.6",
|
|
23
|
+
)
|