Anlyon Python SDK
The production execution runtime for AI agents. Official Python SDK for Anlyon. Your agent invokes a named action; Anlyon holds the credentials, evaluates policy, waits for approval when required, and makes the production call itself.
Installation
pip install anlyon
Quick start
Define the call once, from an operator key. That is the only place your credential appears:
import os
from anlyon import Client
ops = Client(api_key=os.environ["ANLYON_OPERATOR_KEY"])
ops.secrets.put("STRIPE_KEY", value=os.environ["STRIPE_KEY"])
ops.actions.create(
name="refund-order",
method="POST",
url_template="https://api.stripe.com/v1/refunds",
headers={"Authorization": "Bearer {{secret:STRIPE_KEY}}"},
requires_approval=True,
)
From then on, this is all your agent sees. No URL, no header, no key:
anlyon = Client(api_key=os.environ["ANLYON_AGENT_KEY"])
# Successful calls expose the canonical response envelope.
result = anlyon.actions.invoke("refund-order", {"charge": "ch_3P9x", "amount": 12000})
if result.data["pendingApproval"]:
print("Parked for a human:", result.data["approvalId"])
else:
print("Stripe replied", result.data["responseStatus"])
anlyon.close()
status on an invocation distinguishes failed (the call did not happen, safe
to retry) from unknown (it may have reached the destination, so reconcile
before retrying). Anlyon never retries an action invocation for you. Durable
retries exist, and they belong to delivery: queues, schedules and workflows.
These guarantees cover actions routed through Anlyon. A tool your own code calls directly, with a credential your own process holds, is not routed through Anlyon and is not governed by it.
Supporting state
client = Client(api_key="anlyon_live_xxx")
client.memory.remember(content="The customer prefers email over phone.")
result = client.memory.recall(query="how should we contact this customer?")
for r in result.data["results"]:
print(r["score"], r["content"])
client.close()
Async
import asyncio
from anlyon import AsyncClient
async def main():
async with AsyncClient(api_key="anlyon_live_xxx") as client:
await client.memory.remember(content="The customer prefers email.")
result = await client.memory.recall(query="contact preference?")
print(result.data["results"])
asyncio.run(main())
Configuration
from anlyon import Client, RetryConfig
client = Client(
api_key="anlyon_live_xxx", # falls back to ANLYON_API_KEY
base_url="http://localhost:4000", # falls back to ANLYON_BASE_URL
timeout=10.0,
retry=RetryConfig(max_attempts=5),
)
Resources
client.actionscreate, import_openapi, list, get, update, delete, invoke, invocations, invocation, versions (hosted execution)client.secretsput, list, get, delete (write-only vault; no method returns a value)client.approvals,client.budgetsthe controls around an invocationclient.memoryremember, remember_many, recall, forget, ingest, upload_file, summarize, consolidate, jobs, collectionsclient.messagespublish, publish_batch, list, get, cancelclient.queues,client.schedules,client.url_groups,client.dlqdurable delivery controlsclient.workflowscreate, list, get, update, delete, trigger, list_runs, get_run, list_run_steps, cancel_run, notifyclient.eventspublish, list, get, topics CRUD, subscriptionsclient.filesupload, presign, download, list, get, deleteclient.cachelookup, store, list, get, delete, flush (semantic cache)client.sessions,client.contextpersistent conversations and token-budgeted contextclient.analytics,client.logsusage, delivery analytics, redacted execution history, exportsclient.billing,client.notificationsprovider-safe billing state and notification preferencesclient.flow_control,client.integrationsrate/concurrency controls and Slack/Discord delivery
Write operations accept an idempotency_key so automatic retries can never double-write:
client.memory.remember(content="...", idempotency_key="user-123-pref")
client.messages.publish(url="https://example.com/hook", idempotency_key="order-456")
Error handling
Successful calls return ApiResponse with success, data, pagination,
stats, and request_id, matching the HTTP contract and TypeScript SDK.
For compatibility with the 0.1 release, indexing, iteration, get(), len(),
and equality delegate to response.data; new code should use
response.data explicitly. The legacy shortcut is deprecated for removal in
the next major release.
Failed requests raise typed exceptions (never return an error envelope):
from anlyon import Client, NotFoundError, RateLimitError
client = Client(api_key="anlyon_live_xxx")
try:
client.memory.get("mem_missing")
except NotFoundError:
print("Not found")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
Metadata
Release files for anlyon 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anlyon-0.2.0.tar.gz | 68.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anlyon-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 133.2 kB
Release files / anlyon-0.2.0.tar.gz
| Download URL | anlyon-0.2.0.tar.gz |
|---|---|
| Size | 68.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77222f2e7cd5beab052873dc293ede2d8ef710e33521fe6586b010d8becbfd30
|
|
BLAKE2b-256 checksum How to use checksums |
b3fdf2ba59e8ba436974f3496c6a895fa7def92e91578e7b4da1427927bcfa1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / anlyon-0.2.0-py3-none-any.whl
| Download URL | anlyon-0.2.0-py3-none-any.whl |
|---|---|
| Size | 65.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64daa94e3144a2d96e4b32e63ca10e0dc6ddf3abe68211228cc6173c8e4f096a
|
|
BLAKE2b-256 checksum How to use checksums |
8de48dade26c05c30fe959b3ca10a52823c0966e202b24c8efde59f6f0e8028a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency log