Skip to main content

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_KEY
  • GROQ_API_KEY
  • GEMINI_API_KEY
  • PERPLEXITY_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

pyagentix-0.1.5.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

pyagentix-0.1.5-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file pyagentix-0.1.5.tar.gz.

File metadata

  • Download URL: pyagentix-0.1.5.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pyagentix-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c5e25a804620b203fedeffdbbc25173efbf0af8477a158a69d2dd77184f218fa
MD5 8c3e642ec7d39c46027d30b70999f8f1
BLAKE2b-256 23201bec5535c485414157f764c5bf88f76a7cfcf6e791d0aecc25bef32f8ed2

See more details on using hashes here.

File details

Details for the file pyagentix-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyagentix-0.1.5-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.13.5

File hashes

Hashes for pyagentix-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d97bfbbffe023b66ca816e1a3bf63a8b32ac84bfde93229832452ff290c4bf77
MD5 1e056d19e354bc3bbf7e49b7b8f1ca3d
BLAKE2b-256 09dc2ce7b4bd9344a8a2caf5bc630a2858e3e59affd3d6ef1eeffdbdbfb72d4f

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