anlyon-langchain
LangChain integration for Anlyon. action_tools turns Anlyon actions into LangChain tools. AnlyonTracer records a chain or agent invocation as an Anlyon run with nested spans.
Actions as tools
from anlyon import Client
from anlyon_langchain import action_tools
client = Client(api_key="anlyon_live_...")
# Declare once, from an operator key. This makes the action governed.
client.actions.declare(
"send-email",
impact={"dimension": "emails", "amount": "count(input.to)", "bound": "exact"},
verify={"url": "https://api.example.com/v1/messages/{{response.id}}", "status": 200},
)
tools = action_tools(client) # one tool per enabled action
send_email = next(tool for tool in tools if tool.name == "send-email")
print(send_email.description)
# Sends an email. Declared impact: emails. Each call counts toward any shared limit set for this environment.
result = send_email.invoke({"to": ["a@example.com"], "subject": "Hi"})
print(result["grade"]) # "confirmed", "acknowledged", "unknown", "failed", "refused", "denied" or "pending"
Each tool calls client.actions.invoke(). Anlyon holds the credential, evaluates policy and makes the call. A tool your own code calls directly is not routed through Anlyon and is not governed by it. The description carries the declared impact when the action declares one. It says what one call counts. It does not say a limit is configured. The result is the invocation as a dict. grade is the receipt grade of a governed action, and None for an action that is not governed. A gated action comes back with pendingApproval and an approvalId.
Pass names=[...] to keep a subset. Bind the tools to a model with model.bind_tools(tools).
Act for your users
Build the tools from client.for_user(user_id). Each call then uses that
user's own connections, limits and approvals. No tool schema has an end-user
field, so the model cannot choose or switch the user. When the user has not
connected the integration, the tool returns instead of raising:
tools = action_tools(client.for_user(session.user_id), names=["gmail-send-email"])
# A tool result when Gmail is not connected:
# {"status": "connect_required", "integration": "gmail",
# "connectUrl": "https://...", "message": "The user has not connected gmail yet, ..."}
status is reconnect_required for a revoked connection, and connectUrl is
None when the environment has no default redirect URL. See the anlyon
README for connecting a user and the confirm step.
Trace a LangChain invocation
from anlyon import Client
from anlyon_langchain import AnlyonTracer
client = Client(api_key="anlyon_live_...")
tracer = AnlyonTracer(client, application="support-agent")
# Pass the callback to any LangChain runnable/agent invocation.
result = chain.invoke({"question": "Where is my order?"}, config={"callbacks": [tracer]})
The handler creates one Anlyon run for the root callback and parent-linked
workflow_step, model_call, and tool_call spans for nested callbacks. It is
best-effort: Anlyon transport failures never change the application result.
Installation
pip install anlyon-langchain
See the Anlyon docs for the full guide.
License
MIT
Earlier namespaces remain available through the API for existing workspaces. See the billing docs.
Metadata
Release files for anlyon-langchain 0.4.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 | Provenance | Actions |
|---|---|---|---|---|
| anlyon_langchain-0.4.0.tar.gz | 13.1 kB | With provenance | Details for anlyon_langchain-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anlyon_langchain-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for anlyon_langchain-0.4.0-py3-none-any.whl |
Total release size: 24.8 kB
Release files / anlyon_langchain-0.4.0.tar.gz
| Download URL | anlyon_langchain-0.4.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4673aa434914751af0add4becc43893778a5fd55c25c504fac40602d773eaae
|
|
BLAKE2b-256 checksum How to use checksums |
4f464e044cb652d5936829308ba1b326c734dad8aad5a85d5561983562fc08fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 28, 2026.
Transparency logRelease files / anlyon_langchain-0.4.0-py3-none-any.whl
| Download URL | anlyon_langchain-0.4.0-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f50f2b7b9c7dbc631cec8c368fcfe8d2f8485ca0fcd0004bd6e71ae4346f5693
|
|
BLAKE2b-256 checksum How to use checksums |
b406bb2fdff708be9a67e1c76b93a8d36beb673fa2aa5ab290e43650cf0b3ccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 28, 2026.
Transparency logSecurity for anlyon-langchain 0.4.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for anlyon_langchain-0.4.0.tar.gz
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 Oct 28, 2026.
Transparency logA 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.