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 (9):
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.
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.
Links
- Docs: https://enact.info/docs/langchain
- Core SDK: https://pypi.org/project/enact-protocol/
- Source: https://github.com/ENACT-protocol/enact-protocol/tree/master/python/enact-langchain
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file enact_langchain-0.1.3.tar.gz.
File metadata
- Download URL: enact_langchain-0.1.3.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e34b2e905f9bbe7b4fba3b7c45640b90223a64d16602f71539b2ff5d2a726afe
|
|
| MD5 |
75067e208eaff942f3e028b0f940bccc
|
|
| BLAKE2b-256 |
6ad916d3a462447be11316a4a6c33a887acd4cc1aced9f5440ebc2398ad0bce1
|
File details
Details for the file enact_langchain-0.1.3-py3-none-any.whl.
File metadata
- Download URL: enact_langchain-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c997455e264c76139a218bba5b567e8c16e7ff2799327e75c1b690da736f35ce
|
|
| MD5 |
6964a87227a68cedb4dd1a01248768ce
|
|
| BLAKE2b-256 |
0c06e71b29c45594cdf070c17cf2c7e3da549ea6a9d7d2c36ebae9668b4a93b1
|