A client library for making secure requests within the Elyzo runtime.
Project description
# Elyzo Python Client
[](https://badge.fury.io/py/elyzo)
[](https://opensource.org/licenses/MIT)
A client library for making secure, policy-aware HTTP requests and saving artifact files from within the Elyzo runtime.
This library allows your agent to use sensitive credentials and save output files without the secret values or the host filesystem ever being exposed to the agent's environment.
## Installation
```bash
pip install elyzo
Usage
The library is designed to be simple and intuitive.
Making Secure API Calls
Most modern APIs, including OpenAI, GitHub, Stripe, and many others, use Authorization: Bearer <token> for authentication. The elyzo.requests library makes this the simple, default behavior. Just provide the secret's name.
from elyzo import requests
# The agent only needs to know the secret's NAME, not its value.
response = requests.get(
"[https://api.openai.com/v1/models](https://api.openai.com/v1/models)",
elyzo_secret="my-openai-key"
)
print(response.json())
Saving Artifacts
Use elyzo.files to save files from the agent's environment to the host. The most common case is saving a file from a path.
from elyzo import files
# Create a file inside the agent
with open("results.txt", "w") as f:
f.write("This is the agent's output.")
# Save the file to the host artifacts directory.
# This is memory-efficient and streams large files.
files.save_file("results.txt")
Advanced Usage
Combining Secrets, Headers, and a JSON Body
All standard requests arguments like headers and json work seamlessly with elyzo_secret.
from elyzo import requests
# All arguments work together in a single call.
response = requests.post(
"[https://api.github.com/repos/owner/repo/issues](https://api.github.com/repos/owner/repo/issues)",
headers={"Accept": "application/vnd.github.v3+json"},
json={"title": "New bug found"},
elyzo_secret="my-github-token"
)
print(response.json())
Injecting Secrets into Custom Headers
For APIs that require a key in a different header (like X-Api-Key), provide a dictionary to elyzo_secret.
from elyzo import requests
response = requests.post(
"[https://some-legacy-api.com/data](https://some-legacy-api.com/data)",
elyzo_secret={
"name": "my-legacy-key",
"inject_as": "header",
"header_name": "X-Api-Key"
}
)
Saving In-Memory Data as an Artifact
If your data is already in memory (e.g., a dynamically generated JSON string), you can use files.save().
from elyzo import files
report = '{"status": "complete", "accuracy": 0.98}'
files.save(filename="report.json", data=report)
AI Integration & Technical Details
This section provides structured context for AI assistants and developers.
- Mechanism: This is a wrapper around the standard
requestslibrary. - Secret Injection: Triggered by the
elyzo_secretkeyword. It constructs a JSON "request descriptor" and sends it to an internal proxy endpoint (http://elyzo.internal/v1/proxy/request). The Elyzo Proxy then retrieves the secret from a secure store (e.g., OS Keychain), executes the real request with the secret injected, and returns the response. - Artifacts: Triggered by the
elyzo.filesmodule. It sends amultipart/form-dataPOST request to an internal endpoint (http://elyzo.internal/v1/artifacts). The Elyzo Proxy is responsible for enforcing security, quotas, sanitizing the filename, and saving the file to the host. - Security Model: This "terminating proxy" model for both secrets and artifacts ensures that sensitive credentials and the host filesystem are never directly exposed to the sandboxed agent environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elyzo-0.1.25.tar.gz.
File metadata
- Download URL: elyzo-0.1.25.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19913301f6f05dde042ed08c5b7e8c2412fe99698d1528ccab307a5bf9d6a673
|
|
| MD5 |
34459f3a6bb9bd73264f9baf90c3a206
|
|
| BLAKE2b-256 |
320276a24c7aceb2a6630c4c00140a41c6d14a47aa0f02103a09a3edf6a68012
|
File details
Details for the file elyzo-0.1.25-py3-none-any.whl.
File metadata
- Download URL: elyzo-0.1.25-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
022a7c700a4752d76b9f34d9799e16839cc648d5eb62faae39a8005dcd02df79
|
|
| MD5 |
8d0331ffb07d0009f36914818e7664ec
|
|
| BLAKE2b-256 |
a0309cd05b475192c590a4eb8e996b5023e2398f5088ad7166d83ba5df53d947
|