Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

en_protocol-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

en_protocol-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file en_protocol-0.1.0.tar.gz.

File metadata

  • Download URL: en_protocol-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for en_protocol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e45797de0b801bc1f010ee1b838f6b130f9e3a5ff95d21edff0288c057f16490
MD5 ecd1f15b1ed076354aa2bad44f88d5d0
BLAKE2b-256 e7ad34070613b70c3db8e16c1ba1f204d72816e9e561d8c779a5efe524e14320

See more details on using hashes here.

File details

Details for the file en_protocol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: en_protocol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for en_protocol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 909fea165f6e23f36daad6d3ddadb1b437e064f10edb56d09ee524664648234c
MD5 418373a621220b31f44f6e7fe71029b3
BLAKE2b-256 679449035dff34f96355161c17fdeebea81f5c7c0f9a54414a2847a0a089af59

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