Metadata-Version: 2.4
Name: rpa-automationanywhere
Version: 2.0.0
Summary: A professional Python library for high-performance interaction with the Automation Anywhere A360 API.
Project-URL: Repository, https://github.com/21010/rpa-automationanywhere
Author-email: Grzegorz Zioło <grzegorz.ziolo@pl.nsg.com>
License: MIT
License-File: LICENSE.txt
Keywords: a360,api-client,automation,automation-anywhere,rpa
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: cryptography>=41.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: robocorp-vault>=1.0.0
Provides-Extra: dev
Requires-Dist: bandit>=1.7.8; extra == 'dev'
Requires-Dist: ipykernel>=6.0.0; extra == 'dev'
Requires-Dist: pyrefly>=0.1.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: python-dotenv>=1.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Description-Content-Type: text/markdown

# Automation Anywhere A360 Python API Client

A high-performance Python library for interacting with the Automation Anywhere A360 (Control Room) API.

## Business Value

This library enables you to automate the management and orchestration of the Automation Anywhere 360 infrastructure.By providing a structured, type-safe interface to the A360 Control Room, it allows you to:

* **Programmatically manage** devices, users, and lockers to reduce manual administrative overhead.
* **Integrate A360 repository management** and bot deployment into existing CI/CD workflows.
* **Safely manage Credential Vault** entries with built-in RSA encryption and optimized bulk retrieval.
* **Monitor RPA performance** with comprehensive bot metrics and execution history analysis.
* **Execute API Tasks (HotBot)** for high-frequency, low-latency automation needs.
* **Orchestrate Bot Lifecycle (BLM)** by automating the export and import of bots across environments.

## Architecture

The project is built on modern Python standards with a focus on maintainability, security, and developer experience.

### Core Services

The `AAClient` provides access to a comprehensive suite of 16 domain-specific services:

* `credentials`: Secure management of Credential Vault entries.
* `users`: Control Room user and role management.
* `lockers`: Management of lockers, owners, and participants.
* `devices`: Monitoring and management of Bot Runners and device pools.
* `repository`: Interaction with the file repository (Upload, Download, Search).
* `automations`: Bot deployment (v3/v4), activity monitoring, and performance metrics.
* `wlm`: Workload Management (Queues, Work Items, and Models).
* `audit`: Retrieval and filtering of Control Room audit logs.
* `api_task`: Management and execution of API Tasks (HotBot).
* `blm`: Bot Lifecycle Management (Export, Import, and Promotion).
* `aari`: Orchestration of AARI processes and tasks.
* `policy`: Code analysis and policy management.
* `license`: Control Room license monitoring.
* `scheduler`: Management of automation schedules.
* `triggers`: Configuration of event-based triggers.
* `ai_agent_studio`: Integration with AI Agent Studio services.

## Requirements

* Python: 3.10 or higher (Optimized for 3.14+ with `from __future__ import annotations`)
* Key Dependencies:
  * `pydantic` & `pydantic-settings` (v2, data validation and `camelCase` aliasing)
  * `requests` (HTTP communication with connection pooling)
  * `cryptography` (RSA OAEP SHA-256 encryption)
  * `robocorp-vault` (Secret container compatibility)

## Usage

### 1. Initialization

```python
from rpa_automationanywhere import AAClient

# Load connection details from .env (A360_USERNAME, A360_PASSWORD, A360_CONTROL_ROOM_URI)
with AAClient.from_env() as client:
    print(f"Connected to: {client.api_client.base_url}")
    devices = client.devices.list_devices()
```

### 2. Optimized Credential Retrieval

The client automatically handles A360's internal masking logic, ensuring sensitive values are correctly retrieved while optimizing network calls.

```python
# Returns a robocorp.vault.SecretContainer for native compatibility
secret = client.credentials.get_secret("Legacy_ERP_Login")

print(f"Username: {secret.values['username']}")
# Even masked attributes are transparently fetched and available
print(f"Password: {secret.values['password']}")
```

### 3. RPA Metrics & Performance Analysis

Deliver actionable business insights using the built-in metrics engine.

```python
metrics = client.automations.get_execution_metrics()

print(f"Overall Success Rate: {metrics.overall_success_rate:.2f}%")
for bot in metrics.bot_metrics:
    print(f"Bot: {bot.file_name}")
    print(f"  - Success: {bot.success_count}/{bot.total_executions}")
    print(f"  - Avg Duration: {bot.avg_duration:.1f}s")
```

### 4. API Task Execution (HotBot)

Execute high-performance API Tasks by fetching access details and posting input data.

```python
# 1. Get execution details
details = client.api_task.get_access_details(["/Bots/MyTaskBot"])
task = details.list[0]

# 2. Execute with input data
result = client.api_task.execute_task(
    url=task.url,
    headers=task.headers,
    input_data={"customer_id": "12345"}
)
```

### 5. Bot Lifecycle Management (BLM)

Automate bot promotion between Dev, Test, and Prod environments.

```python
# Export a bot package
export_req = BlmExportRequest(file_paths=["/Bots/MainBot"])
response = client.blm.export_bots(export_req)

# Wait for export to complete and download
status = client.blm.get_status(response.request_id, timeout=30)
archive_bytes = client.blm.download_exported_bots(status.download_file_id)
```

## Security

* **Exception Masking:** Error messages are automatically truncated to prevent accidental leakage of sensitive data in logs.
* **Payload Protection:** All sensitive Vault attributes are encrypted locally using RSA OAEP SHA-256 before transmission.
* **Persistent Sessions:** Securely managed `requests.Session` objects handle authentication tokens and connection persistence.

## Testing

The library includes a comprehensive test suite (70+ tests) with 100% coverage goals, utilizing `pytest` and advanced mocking.

```bash
pytest tests/
```

## License

This project is licensed under the MIT License - see the LICENSE.txt file for details.
