Skip to main content

enact-langchain

LangChain tools for ENACT Protocol — trustless escrow for AI agents on TON. Wraps every method of enact-protocol as a langchain_core.tools.BaseTool.

Install

pip install enact-langchain

enact-protocol is pulled in automatically.

Quick Start (read-only explorer agent)

import asyncio
from enact_protocol import EnactClient
from enact_langchain import get_enact_tools
from langchain_anthropic import ChatAnthropic
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate

async def main():
    client = EnactClient(api_key="YOUR_TONCENTER_KEY")

    tools = get_enact_tools(client)          # read-only (safe default)

    llm = ChatAnthropic(model="claude-haiku-4-5-20251001")
    prompt = ChatPromptTemplate.from_messages([
        ("system", "You are an explorer for ENACT Protocol on TON."),
        ("human", "{input}"),
        ("placeholder", "{agent_scratchpad}"),
    ])
    agent = create_tool_calling_agent(llm, tools, prompt)
    executor = AgentExecutor(agent=agent, tools=tools)

    result = await executor.ainvoke({"input": "How many TON jobs are on ENACT?"})
    print(result["output"])

    await client.close()

asyncio.run(main())

Enabling write tools

Every write tool broadcasts a real TON transaction — burning real TON (and, for jetton jobs, real USDT) on every call. Enable them explicitly:

client = EnactClient(
    mnemonic="word1 word2 ... word24",
    pinata_jwt="YOUR_PINATA_JWT",
    api_key="YOUR_TONCENTER_KEY",
)
tools = get_enact_tools(client, include_write=True)   # opt-in

Put a human-in-the-loop check in front of any write tool in production.

Tool catalog

Read (11): enact_get_wallet_address, enact_get_job_count, enact_get_jetton_job_count, enact_get_job_address, enact_list_jobs, enact_list_jetton_jobs, enact_get_job_status, enact_get_wallet_public_key, enact_decrypt_job_result, enact_generate_agent_keypair, enact_detect_agentic_wallet.

Write TON (10): enact_create_job, enact_fund_job, enact_take_job, enact_submit_result, enact_submit_encrypted_result, enact_evaluate_job, enact_cancel_job, enact_claim_job, enact_quit_job, enact_set_budget.

Write USDT (3): enact_create_jetton_job, enact_set_jetton_wallet, enact_fund_jetton_job.

Agentic Wallets

enact_generate_agent_keypair returns a fresh ed25519 keypair plus a agents.ton.org/create deeplink so the user can mint a TON Tech Agentic Wallet on top of the operator key — no mnemonic ever touches the agent. enact_detect_agentic_wallet probes any TON address for the agentic-wallet get-methods and returns the owner, operator pubkey, NFT index, and revoked state. After the wallet is minted and funded, configure enact_protocol.AgenticWalletProvider directly on the underlying EnactClient to route every write through the operator key. See the Agentic Wallets docs.

Links

License

MIT

Metadata

Release files for enact-langchain 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enact-langchain 0.3.0
File Size Uploaded Provenance Actions
enact_langchain-0.3.0.tar.gz 8.9 kB Without provenance Details for enact_langchain-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enact-langchain 0.3.0
File Interpreter ABI Platform Actions
enact_langchain-0.3.0-py3-none-any.whl Python 3 none any Details for enact_langchain-0.3.0-py3-none-any.whl

Total release size: 19.4 kB

Release files / enact_langchain-0.3.0.tar.gz

Download URL enact_langchain-0.3.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4a7c938c331a56db993d084dfe79d4349d8da0e890a6b5fff7ecf20e831151f0
BLAKE2b-256 checksum
How to use checksums
11ab050b6951d5abe445bb22bd7bd7ed2922a07e1d8ba44854f391975a662473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / enact_langchain-0.3.0-py3-none-any.whl

Download URL enact_langchain-0.3.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be595e6ea09f59bed70029bd3a251fcafe24ab2b6b1ca95b633c4b2302fc9b66
BLAKE2b-256 checksum
How to use checksums
5b23d8884cce86c846fe4554e7162d5137701f69f2ccda715af7c0eaa32218eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for enact-langchain 0.3.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.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page