# Agents Client
A comprehensive package for interacting with the Agents API, providing both a Python client library and a command-line interface (CLI).
## Components
This package consists of two main components:
1. **agent_client**: A Python client library providing a simple, OpenAI-like API for interacting with agents
2. **agent_client_cli**: A command-line interface (CLI) for interacting with the Agents API
## Installation
### Basic Installation
```bash
pip install agents-client
```
### Installation with CLI Support
```bash
pip install "agents-client[cli]"
```
### Development Installation
```bash
pip install "agents-client[dev]"
```
## Client Library Usage
### Quick Start
```python
from agent_client import Agent
# Initialize the agent
agent = Agent(
agent_id="your-agent-id",
api_key="your-api-key"
)
# Define a callback function for streaming responses
def handle_response(response):
print(f"Received: {response.get('type')} - {response.get('message')}")
# Start streaming responses in a background thread
agent.start_streaming(handle_response)
# Send a message to the agent
response = agent.message("Hello, Agent!")
print(f"Message sent! Response ID: {response.get('row_id')}")
# Responses will be streamed to your callback function
# When done, stop streaming
agent.stop_streaming()
```
### Client Features
#### Agent Class
The `Agent` class provides a simple interface similar to OpenAI's API:
```python
# Initialize with required parameters
agent = Agent(
agent_id="your-agent-id",
api_key="your-api-key",
base_url="http://localhost:6665", # Optional
stream_callback=handle_response # Optional, can be provided later
)
```
#### Sending Messages
```python
# Send a simple text message
agent.message("Hello, agent!")
# Send a message with additional parameters
agent.message("Process this data",
priority="high",
format="json"
)
```
#### Streaming Responses
```python
# Define a callback to handle streaming responses
def handle_response(response):
print(f"Received: {response}")
# Start streaming with the callback
agent.start_streaming(handle_response)
# Or provide the callback during initialization
agent = Agent(
agent_id="your-agent-id",
api_key="your-api-key",
stream_callback=handle_response
)
agent.start_streaming()
# When done, stop streaming
agent.stop_streaming()
```
#### File Upload
```python
# Upload a file to the agent
with open("document.pdf", "rb") as file:
agent.upload_file("/destination/path.pdf", file)
```
## CLI Usage
After installing with CLI support, you can use the `agents-cli` command:
### Setup and Configuration
```bash
# Initial setup
agents-cli setup
# View or update configuration
agents-cli config
```
### Managing Agents and API Keys
```bash
# List all your agents
agents-cli agents
# List your API keys
agents-cli api-keys
# Create a new API key
agents-cli create-key --name "My New Key"
# Show usage statistics
agents-cli usage
# Get detailed information about a specific agent
agents-cli agent-info <agent_id>
```
### Interacting with Agents
```bash
# Send a message to an agent
agents-cli send message '{"text":"Hello"}' --api-key mykey --agent-id myagent
# Upload a file to an agent
agents-cli upload /data/file.txt ./local.txt --api-key mykey --agent-id myagent
# Connect to the WebSocket stream for an agent
agents-cli stream --api-key mykey --agent-id myagent
```
## Examples
See the `examples/` directory for complete usage examples for both the client library and CLI.
## Legacy Functions
For backward compatibility, the package also provides standalone functions:
```python
from agent_client import send_operation, upload_file
# Send an operation
send_operation("message", {"text": "Hello"}, "api-key", "agent-id")
# Upload a file
with open("file.txt", "rb") as f:
upload_file("api-key", "agent-id", "/path/to/store.txt", f)
```
## Development and Release
The project includes a release script to automate versioning, building, and publishing to PyPI.
### Release Script
The `release.py` script automates:
1. Version incrementing in pyproject.toml
2. Running tests
3. Package building
4. PyPI uploading
#### Basic Usage
```bash
# Make the script executable if needed
chmod +x release.py
# Run with default options (patch version increment)
./release.py
```
This will:
1. Increment the patch version (e.g., 0.2.0 → 0.2.1)
2. Run tests to validate the package
3. Build the package
4. Upload to PyPI
#### Command Line Options
```bash
# Show help message
./release.py --help
# Release a minor version (e.g., 0.2.0 → 0.3.0)
./release.py --level minor
# Release a major version (e.g., 0.2.0 → 1.0.0)
./release.py --level major
# Build without uploading to PyPI
./release.py --build-only
# Skip running tests (use with caution)
./release.py --skip-tests
```
#### PyPI Authentication
When uploading to PyPI, you'll be prompted for your PyPI credentials. To avoid this:
1. Create a `.pypirc` file in your home directory:
```
[pypi]
username = your_username
password = your_password
```
2. Secure the file: `chmod 600 ~/.pypirc`
Alternatively, use API tokens for more secure authentication.
## License
Apache Software License
Raw data
{
"_id": null,
"home_page": null,
"name": "agents-client",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "agents, api, client, chatbot, ai, cli",
"author": null,
"author_email": "Levangie Laboratories <brayden@levangielaboratories.com>",
"download_url": "https://files.pythonhosted.org/packages/d8/eb/c61906414690e57c98ca1f63a2d3cca1139ba451b1495fa9469eb31e24e0/agents_client-0.2.9.tar.gz",
"platform": null,
"description": "# Agents Client\n\nA comprehensive package for interacting with the Agents API, providing both a Python client library and a command-line interface (CLI).\n\n## Components\n\nThis package consists of two main components:\n\n1. **agent_client**: A Python client library providing a simple, OpenAI-like API for interacting with agents\n2. **agent_client_cli**: A command-line interface (CLI) for interacting with the Agents API\n\n## Installation\n\n### Basic Installation\n\n```bash\npip install agents-client\n```\n\n### Installation with CLI Support\n\n```bash\npip install \"agents-client[cli]\"\n```\n\n### Development Installation\n\n```bash\npip install \"agents-client[dev]\"\n```\n\n## Client Library Usage\n\n### Quick Start\n\n```python\nfrom agent_client import Agent\n\n# Initialize the agent\nagent = Agent(\n agent_id=\"your-agent-id\",\n api_key=\"your-api-key\"\n)\n\n# Define a callback function for streaming responses\ndef handle_response(response):\n print(f\"Received: {response.get('type')} - {response.get('message')}\")\n\n# Start streaming responses in a background thread\nagent.start_streaming(handle_response)\n\n# Send a message to the agent\nresponse = agent.message(\"Hello, Agent!\")\nprint(f\"Message sent! Response ID: {response.get('row_id')}\")\n\n# Responses will be streamed to your callback function\n\n# When done, stop streaming\nagent.stop_streaming()\n```\n\n### Client Features\n\n#### Agent Class\n\nThe `Agent` class provides a simple interface similar to OpenAI's API:\n\n```python\n# Initialize with required parameters\nagent = Agent(\n agent_id=\"your-agent-id\",\n api_key=\"your-api-key\",\n base_url=\"http://localhost:6665\", # Optional\n stream_callback=handle_response # Optional, can be provided later\n)\n```\n\n#### Sending Messages\n\n```python\n# Send a simple text message\nagent.message(\"Hello, agent!\")\n\n# Send a message with additional parameters\nagent.message(\"Process this data\", \n priority=\"high\", \n format=\"json\"\n)\n```\n\n#### Streaming Responses\n\n```python\n# Define a callback to handle streaming responses\ndef handle_response(response):\n print(f\"Received: {response}\")\n\n# Start streaming with the callback\nagent.start_streaming(handle_response)\n\n# Or provide the callback during initialization\nagent = Agent(\n agent_id=\"your-agent-id\",\n api_key=\"your-api-key\",\n stream_callback=handle_response\n)\nagent.start_streaming()\n\n# When done, stop streaming\nagent.stop_streaming()\n```\n\n#### File Upload\n\n```python\n# Upload a file to the agent\nwith open(\"document.pdf\", \"rb\") as file:\n agent.upload_file(\"/destination/path.pdf\", file)\n```\n\n## CLI Usage\n\nAfter installing with CLI support, you can use the `agents-cli` command:\n\n### Setup and Configuration\n\n```bash\n# Initial setup\nagents-cli setup\n\n# View or update configuration\nagents-cli config\n```\n\n### Managing Agents and API Keys\n\n```bash\n# List all your agents\nagents-cli agents\n\n# List your API keys\nagents-cli api-keys\n\n# Create a new API key\nagents-cli create-key --name \"My New Key\"\n\n# Show usage statistics\nagents-cli usage\n\n# Get detailed information about a specific agent\nagents-cli agent-info <agent_id>\n```\n\n### Interacting with Agents\n\n```bash\n# Send a message to an agent\nagents-cli send message '{\"text\":\"Hello\"}' --api-key mykey --agent-id myagent\n\n# Upload a file to an agent\nagents-cli upload /data/file.txt ./local.txt --api-key mykey --agent-id myagent\n\n# Connect to the WebSocket stream for an agent\nagents-cli stream --api-key mykey --agent-id myagent\n```\n\n## Examples\n\nSee the `examples/` directory for complete usage examples for both the client library and CLI.\n\n## Legacy Functions\n\nFor backward compatibility, the package also provides standalone functions:\n\n```python\nfrom agent_client import send_operation, upload_file\n\n# Send an operation\nsend_operation(\"message\", {\"text\": \"Hello\"}, \"api-key\", \"agent-id\")\n\n# Upload a file\nwith open(\"file.txt\", \"rb\") as f:\n upload_file(\"api-key\", \"agent-id\", \"/path/to/store.txt\", f)\n```\n\n## Development and Release\n\nThe project includes a release script to automate versioning, building, and publishing to PyPI.\n\n### Release Script\n\nThe `release.py` script automates:\n1. Version incrementing in pyproject.toml\n2. Running tests\n3. Package building\n4. PyPI uploading\n\n#### Basic Usage\n\n```bash\n# Make the script executable if needed\nchmod +x release.py\n\n# Run with default options (patch version increment)\n./release.py\n```\n\nThis will:\n1. Increment the patch version (e.g., 0.2.0 \u2192 0.2.1)\n2. Run tests to validate the package\n3. Build the package\n4. Upload to PyPI\n\n#### Command Line Options\n\n```bash\n# Show help message\n./release.py --help\n\n# Release a minor version (e.g., 0.2.0 \u2192 0.3.0)\n./release.py --level minor\n\n# Release a major version (e.g., 0.2.0 \u2192 1.0.0)\n./release.py --level major\n\n# Build without uploading to PyPI\n./release.py --build-only\n\n# Skip running tests (use with caution)\n./release.py --skip-tests\n```\n\n#### PyPI Authentication\n\nWhen uploading to PyPI, you'll be prompted for your PyPI credentials. To avoid this:\n\n1. Create a `.pypirc` file in your home directory:\n ```\n [pypi]\n username = your_username\n password = your_password\n ```\n\n2. Secure the file: `chmod 600 ~/.pypirc`\n\nAlternatively, use API tokens for more secure authentication.\n\n## License\n\nApache Software License\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "A comprehensive client library and CLI for interacting with the Agents API",
"version": "0.2.9",
"project_urls": {
"Documentation": "https://api.levangielaboratories.com/docs",
"Homepage": "https://github.com/Levangie-Laboratories/agents-client"
},
"split_keywords": [
"agents",
" api",
" client",
" chatbot",
" ai",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "14c616eb2660159c2596010cbddfe04c90674171072e5b56603d4a27899155b1",
"md5": "2c3629552c44de51bcb3819ffe51775b",
"sha256": "4515e99527f7173bd25fc61158bf07bb0abbede09ffe40510800381fd2d05d05"
},
"downloads": -1,
"filename": "agents_client-0.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c3629552c44de51bcb3819ffe51775b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 16912,
"upload_time": "2025-03-21T15:28:46",
"upload_time_iso_8601": "2025-03-21T15:28:46.333385Z",
"url": "https://files.pythonhosted.org/packages/14/c6/16eb2660159c2596010cbddfe04c90674171072e5b56603d4a27899155b1/agents_client-0.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d8ebc61906414690e57c98ca1f63a2d3cca1139ba451b1495fa9469eb31e24e0",
"md5": "d601e1d45cd4f5bb98a1866f66e67e02",
"sha256": "11114523b95feb62a71cd8fdf53a74fe0821b4c495da780db4ef4da166db85dc"
},
"downloads": -1,
"filename": "agents_client-0.2.9.tar.gz",
"has_sig": false,
"md5_digest": "d601e1d45cd4f5bb98a1866f66e67e02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18812,
"upload_time": "2025-03-21T15:28:49",
"upload_time_iso_8601": "2025-03-21T15:28:49.233917Z",
"url": "https://files.pythonhosted.org/packages/d8/eb/c61906414690e57c98ca1f63a2d3cca1139ba451b1495fa9469eb31e24e0/agents_client-0.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-21 15:28:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Levangie-Laboratories",
"github_project": "agents-client",
"github_not_found": true,
"lcname": "agents-client"
}