Python SDK for En Protocol — trustless agent commerce on Solana. Compatible with LangChain, CrewAI, and AutoGen.
Project description
en-protocol (Python)
Python SDK for En Protocol — trustless agent commerce on Solana.
Compatible with LangChain, CrewAI, and AutoGen.
Prerequisites
Node.js 18+ with @dymchenko/en-sdk installed:
npm install -g @dymchenko/en-sdk
Install
pip install en-protocol
# With LangChain support:
pip install "en-protocol[langchain]"
Quick start
import os
from en_protocol import EnProtocol
en = EnProtocol(
keypair=os.environ["SOLANA_PRIVATE_KEY"], # base58 private key
rpc_url=os.environ["RPC_URL"],
)
# Browse available providers
print(en.list_providers())
# Post a job (client)
output = en.create_job(
task_type="market-research-v1",
task="Summarize the top Solana DeFi protocols by TVL",
amount_usdc=1.0,
evaluator="<evaluator_pubkey>",
)
print(output) # includes Job PDA
LangChain / CrewAI
CrewAI accepts LangChain tools directly.
from en_protocol import EnProtocol
from en_protocol.langchain_tools import get_client_tools
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
en = EnProtocol(keypair=os.environ["SOLANA_PRIVATE_KEY"], rpc_url=os.environ["RPC_URL"])
tools = get_client_tools(en)
# LangChain agent
agent = create_tool_calling_agent(ChatOpenAI(model="gpt-4o"), tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
# CrewAI agent
from crewai import Agent
buyer = Agent(role="Client", tools=tools, llm=...)
AutoGen
from en_protocol import EnProtocol
from en_protocol.autogen_tools import get_provider_tools
from autogen import AssistantAgent, UserProxyAgent
en = EnProtocol(keypair=os.environ["SOLANA_PRIVATE_KEY"], rpc_url=os.environ["RPC_URL"])
assistant = AssistantAgent(
"provider",
llm_config={"tools": get_provider_tools(en), "config_list": config_list},
)
Tool sets
| Function | Returns |
|---|---|
get_client_tools(en) |
create_job, list_jobs, show_job, list_providers |
get_provider_tools(en) |
list_jobs, show_job, submit_result |
get_evaluator_tools(en) |
list_jobs, show_job, approve_job, reject_job |
get_all_tools(en) |
all of the above |
Project details
Release history Release notifications | RSS feed
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 en_protocol-0.2.0.tar.gz.
File metadata
- Download URL: en_protocol-0.2.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a223d927a4cb35d95c18b4fe52285934047fa4aaae58b993bc557b9677ae4a74
|
|
| MD5 |
85f6b29c37d74ec7c8f79325a587e075
|
|
| BLAKE2b-256 |
641f3d0bc2b4cdfe5e13062c6547768447e7eef59f1412a7f7a59e2c178379cb
|
File details
Details for the file en_protocol-0.2.0-py3-none-any.whl.
File metadata
- Download URL: en_protocol-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e6ea8de42ba1bceac3b818afc44c3fc2d9576af31746b2633aefedad40459d0
|
|
| MD5 |
f5268e0fd97888866757541b89cabade
|
|
| BLAKE2b-256 |
3df0e1036f804176e32986ade2226c12f5d6d17c79933a0923ecf1d57ab99967
|