Skip to main content

PyReact-Agent

PyReact-Agent is a Python package that provides tools for creating an LLM ReAct agent.

This package also includes tools that an LLM can use for running Bash or Python code inside Docker containers with enhanced control and flexibility. It is designed to be simple to use, making it easy to set up Docker environments and execute Python scripts, even from within a Jupyter Notebook.

Features

  • Create LLM ReAct Agents Easily: Create a ReAct agent with tools in just a few lines of code.
  • Framework for creating custom LLM Tools: Use the ToolSet classes to create custom toolsets, or turn any simple python function into a tool that an LLM can use
  • Build Docker Images: Build Docker images from a Dockerfile with a single function call.
  • Manage Containers: Start, stop, and fetch existing Docker containers programmatically.
  • Run Python Code in Docker: Start and interact with Python Docker containers seamlessly.

Roadmap

  • Integration with Open WebUI using Pipelines: Use Open WebUI's Pipelines to use ReAct agents from this package with the Open WebUI frontend framework
  • Integration with 3rd Party LLM Providers: Use this package with LLM providers. Currently only Ollama is supported.
  • RAG Integration: A simple in-package RAG system + integration with other 3rd party rag providers
  • Memory Management: Ability to self-manage memory for a single query, so that queries with multiple steps can be managed more gracefully.

Installation

To install PyReact-Agent, run:

pip install pyreact_agent

Usage

End-To-End

See example.py for a full end-to-end working example of how to create and run a ReAct agent with code writing tools.

Building a Docker Image

To build a Docker image using the Dockerfile in your project:

from pyreact_agent import docker_utils

docker_utils.build_docker_image(image_name="my-python-env")

Starting a Python Docker Environment

To start a Docker container and run Python code inside:

docker_utils.run_docker_image(
    image_name="my-python-env",
    container_name="my-python-container",
    local_bound_dir="/path/to/your/local/dir"
)

Managing Containers

Start a Stopped Container

docker_utils.start_container_by_name("my-python-container")

Stop a Running Container

docker_utils.stop_container_by_name("my-python-container")

Get an Existing Container

container = docker_utils.get_container("my-python-container")

Get a Docker Image

image = docker_utils.get_image("my-python-env")

Requirements

  • Python 3.9 or higher
  • Docker installed and running
  • Ollama server (if running LLM locally)

Contributing

Contributions are welcome! If you have ideas, suggestions, or bug reports, please feel free to submit a pull request or open an issue on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Author

Cody Maughan GitHub Profile

Acknowledgments

  • Thanks to the Python and Docker communities for their incredible support and tools.

Happy coding with PyReact-Agent!

Metadata

Release files for pyreact-agent 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyreact-agent 0.1.1
File Size Uploaded Provenance
pyreact_agent-0.1.1.tar.gz 13.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyreact-agent 0.1.1
File Interpreter ABI Platform
pyreact_agent-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.2 kB

Release files / pyreact_agent-0.1.1.tar.gz

Download URL pyreact_agent-0.1.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1c51512c9e629118e84d13b380abbc51f01ddfb7503182eaa9d08a40145e5dc4
BLAKE2b-256 checksum
How to use checksums
aafd5a3fdb85ea8aee82552c88ec079122820751221547f60ad0374cf4183d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / pyreact_agent-0.1.1-py3-none-any.whl

Download URL pyreact_agent-0.1.1-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1112415717623922125ee10e29c49773d2334e3c0c54354213cb59b98c940055
BLAKE2b-256 checksum
How to use checksums
5b087bfa10a7fa9fc44804a939ef5acf6465db56786cb0b9c046162a38c7c5cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for pyreact-agent 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page