Skip to main content

A client library for making secure requests within the Elyzo runtime.

Project description

# Elyzo Python Client

[![PyPI version](https://badge.fury.io/py/elyzo.svg)](https://badge.fury.io/py/elyzo)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 requests library.
  • Secret Injection: Triggered by the elyzo_secret keyword. 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.files module. It sends a multipart/form-data POST 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elyzo-0.1.24.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elyzo-0.1.24-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file elyzo-0.1.24.tar.gz.

File metadata

  • Download URL: elyzo-0.1.24.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

Hashes for elyzo-0.1.24.tar.gz
Algorithm Hash digest
SHA256 7bdbe9305847c04a09f4625faa5284cc03e89e59b6a97792cb392b7688b5e4d2
MD5 8e90607775d15840de1d0a3a0fb74693
BLAKE2b-256 aa6e54f41bb2c138df75c51e2e77b2803cd6c52b99489505c8751f48bc72a47e

See more details on using hashes here.

File details

Details for the file elyzo-0.1.24-py3-none-any.whl.

File metadata

  • Download URL: elyzo-0.1.24-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

Hashes for elyzo-0.1.24-py3-none-any.whl
Algorithm Hash digest
SHA256 5fff68ae0d62923f53152fa250a64273e2d0954d284ca21a7c18cff584dfbb98
MD5 bb99825f1d29cc364b20ba697ab2660a
BLAKE2b-256 4b1304f5d274aeb24b8341c400bfdc72776f8a96c8661a0beb5d69e03ef56a79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page