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.2.tar.gz (9.3 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.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyagentix-0.1.2.tar.gz
Algorithm Hash digest
SHA256 29e5f3be5d10fc73accd7b9f8a0d6d339b49e99aa1ffb85051fac948920e4970
MD5 e5ecea21d353cf50f2525a17d7525e00
BLAKE2b-256 8ea41b964651598410fe7172d9a979b72ab12c93c990e8d70a1dc3c8e8655119

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyagentix-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyagentix-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99a4e14fe3f842a261aea6b901ea8e1dccae1e279d5a4e8107fb586d154d7496
MD5 187294fc2f22620770265198af74bac8
BLAKE2b-256 7b74165b0f0e62b24e7dab95d7addbfa465929e2152dc3a16cac5e68c45c015e

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