copilotcloud-rl
Python client for CopilotCloud Reinforcement Learning context API.
Installation
Build and install the package from source:
pip install .
or using a wheel built via:
python -m build
pip install dist/copilotcloud_rl-*.whl
Configuration
The client requires your CopilotCloud API keys and base URL to the API service.
- Environment variables (recommended):
COPILOTCLOUD_API_URL(e.g.https://api.copilotcloud.aior your self-hosted base URL)COPILOTCLOUD_PUBLIC_API_KEY(your public API key)COPILOTCLOUD_PRIVATE_API_KEY(your private API key)
You can also pass these values explicitly to the functions.
Usage
from copilotcloud_rl import get_learning_context
# Provide explicitly or rely on env vars
context = get_learning_context(
prompt="User asked to summarize quarterly KPIs",
agentName="sample_agent",
api_url="https://your-cloud.example.com", # optional if env is set
public_api_key="ck_public_xxx", # optional if env is set
private_api_key="ck_private_xxx", # optional if env is set
limit=10, # optional, limits number of examples
timeout_seconds=15 # optional, request timeout
)
print(context["learningContext"]) # string prepared for few-shot priming
API
get_learning_context(prompt: str, agentName: str, *, api_url: str | None = None, public_api_key: str | None = None, private_api_key: str | None = None, limit: int | None = None, timeout_seconds: int = 15) -> dict
Sends a POST request to /reinforcement-learning/v1/context with body { agentName, prompt, limit } and headers X-CopilotCloud-Public-Api-Key and X-CopilotCloud-Private-Api-Key.
Parameters:
prompt(str): The user prompt or query to get learning context foragentName(str): Name of the agent to get context forapi_url(str, optional): CopilotCloud API base URL (defaults toCOPILOTCLOUD_API_URLenv var)public_api_key(str, optional): Public API key (defaults toCOPILOTCLOUD_PUBLIC_API_KEYenv var)private_api_key(str, optional): Private API key (defaults toCOPILOTCLOUD_PRIVATE_API_KEYenv var)limit(int, optional): Maximum number of learning examples to returntimeout_seconds(int, optional): Request timeout in seconds (default: 15)
Returns: Dictionary containing the parsed JSON response, typically { "learningContext": str }
Raises:
ValueError: If required parameters are missing or invalidRuntimeError: If the API request fails or returns invalid data
Metadata
Release files for copilotcloud-rl 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| copilotcloud_rl-0.1.1.tar.gz | 4.1 kB | Without provenance | Details for copilotcloud_rl-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| copilotcloud_rl-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for copilotcloud_rl-0.1.1-py3-none-any.whl |
Total release size: 9.9 kB
Release files / copilotcloud_rl-0.1.1.tar.gz
| Download URL | copilotcloud_rl-0.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa228a6957522c09f8c39515c31f28bfe012096a787dc105c046d95863b62581
|
|
BLAKE2b-256 checksum How to use checksums |
d183c5e84d38af6c7abcf999f8176f29e7e6132ee2e212163fd07916d84e61e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / copilotcloud_rl-0.1.1-py3-none-any.whl
| Download URL | copilotcloud_rl-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9103c2eb5931b42960740ce389907dc7711f0f49a95985704f90e6e7e4fdfde8
|
|
BLAKE2b-256 checksum How to use checksums |
b31fabdbb8f69993acc28f984654e53fe94e94002e5fe7337ebafea7b6885f06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for copilotcloud-rl 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.