PyAgentix is a lightweight Python library that enables quick and easy creation of model-agnostic AI agents.
Project description
PyAgentix
PyAgentix is a Python framework to build AI agents and chatbots using large language models (LLMs). It supports agents, groups of agents, synchronous and asynchronous calls, JSON and text responses, and includes a basic CLI chatbot.
Installation
pip install pyagentix
Note: This package requires Python 3.8+.
Features
- Agent and AgentGroup abstractions
- Synchronous and asynchronous support
- JSON and text response formats
- CLI chatbot with file upload support
Quick Start
1. Create and use a text response agent
from pyagentix.agent import AgentUnit
agent = AgentUnit(
instruction="You are a helpful assistant."
)
agent.llm.provider = "openai"
response = agent.work("Who is the first person walking on the Moon?")
print("Text response:", response.content)
2. Create and use a JSON response agent
from pyagentix.agent import AgentUnit
json_agent = AgentUnit(
instruction=(
"You are a helpful assistant. Always respond with a JSON object "
"with exactly two keys: 'first_name' and 'last_name'."
),
response_format="json_object"
)
json_agent.llm.provider = "openai"
json_response = json_agent.work("Who is the first person walking on the Moon?")
print("JSON response:", json_response.data)
3. Use the agent asynchronously
import asyncio
query = "Who is the first person walking on the Moon?"
text_response = asyncio.run(agent.work_async(query))
print("Async text response:", text_response.content)
4. Run the CLI chatbot
from pyagentix.agent import AgentUnit
from pyagentix.chatbot import Chatbot
agent = AgentUnit(
instruction="You are a helpful assistant."
)
agent.llm.provider = "openai"
chatbot = Chatbot(client=agent)
chatbot.cli_run()
Configuration
PyAgentix reads API keys from environment variables by default:
OPENAI_API_KEYGROQ_API_KEYGEMINI_API_KEYPERPLEXITY_API_KEY
You can also set API keys and providers programmatically on the agent's LLM instance.
Contributing
Contributions are welcome. Please open issues or pull requests on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
If you have questions or need help, feel free to open an issue or contact the maintainer.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyagentix-0.1.4.tar.gz.
File metadata
- Download URL: pyagentix-0.1.4.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcef45d1ce9932096530a32a8f0b5e057834a328565aa7a1e8f763681a0c5225
|
|
| MD5 |
46b27c61b3fa55ac3509027b68cb6559
|
|
| BLAKE2b-256 |
3b47fbe120e15eca17e19ebb75f8d13d7c28d35033b6811f8fe02a34e15cbd58
|
File details
Details for the file pyagentix-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pyagentix-0.1.4-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aaf26917a26edf026b140b488fe6736e5e37205f513c5340d630b433596833f
|
|
| MD5 |
f7620bbf8b1876892c5b02938eb7dbd3
|
|
| BLAKE2b-256 |
eba1dd83a1a6b3dc7c83c65d0564dc62553798f84d7adcf749ffc0fe49b51286
|