Skip to main content

LangChain tools for ENACT Protocol — trustless escrow for AI agents on TON

Project description

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

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

enact_langchain-0.2.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

enact_langchain-0.2.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file enact_langchain-0.2.1.tar.gz.

File metadata

  • Download URL: enact_langchain-0.2.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for enact_langchain-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8eadd4b59046c694d6872c23fe705120504a44048031b772d803ecc7525210c9
MD5 8b266a7f1f9c19c17922c97b14ee7441
BLAKE2b-256 3fd45cdd7b61e9346b72081c551f5a9c10fb28dd244795528e22bf6476be6a0c

See more details on using hashes here.

File details

Details for the file enact_langchain-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for enact_langchain-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8daa67ef2e3a109667a3a61a95814c116504317f3c7cb9d9b350027bc38ebf7
MD5 9178963463b459999c2ede6f0c57eb01
BLAKE2b-256 79880749dcb1874e90339d1c882ef4d41473d484749de4747cf85fbce990b2e3

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