Client library to interact with Hive Agents.
Join our Discord community for support and discussion.
- Python 3.6 or higher
To use the HiveAgentClient
library, you first need to ensure that you have Python installed on your system and then install the required dependencies.
-
Install Poetry
If you don't have Poetry installed, you can install it using the following commands:
$ curl -sSL https://install.python-poetry.org | python3 - $ export PATH="$HOME/.local/bin:$PATH"
-
Activate the Virtual Environment Activate the virtual environment created by Poetry with the following command:
$ poetry shell
-
Install Dependencies
$ poetry install --no-root
To use the HiveAgentClient
library in your project, you need to import the HiveAgentClient
class from the library and then create an instance of the class with the appropriate configuration.
from hive_agent_client import HiveAgentClient
# initialize the client with the base URL of your Hive Agent's chat API
client = HiveAgentClient(base_url="http://localhost:8000", timeout=30)
# send a message and receive the response
try:
response = await client.chat(user_id="user123", session_id="session123", content="Hello, Hive Agent!")
print(response)
except Exception as e:
print(f"an error occurred: {e}")
The complete tutorial can be found at ./tutorial.md.