Skip to main content

Python reference SDK for the Ergo rail of Accord Protocol — agent payments, Note operations, LangChain / OpenAI integrations. Mirrors the legacy npm package of the same name; the canonical Python Accord layer will publish later under a different PyPI name.

Project description

ergo-agent-pay (Python)

Python reference SDK for the Ergo rail of Accord Protocol. Agent payments, Note operations, balance + UTxO inspection, LangChain / OpenAI integrations.

The package keeps its legacy npm-mirror name. A canonical Python Accord layer (port of @accord-protocol/core) is not yet published; when it is, it will live under a different PyPI name and import from this package as a rail dependency.

Zero required dependencies — uses Python standard library only.

pip install ergo-agent-pay

Quick start

from ergo_agent_pay import ErgoAgentPay

agent = ErgoAgentPay(address="YOUR_ADDRESS", network="testnet")

# Check balance
balance = agent.get_balance()
print(f"Balance: {balance['ergs']} ERG")

# Inspect a Note
note = agent.check_note("abc123...")
print(f"Note value: {note.value_erg} ERG")
print(f"Expired: {note.is_expired}")
print(f"Task hash: {note.task_hash}")

# Compute task hash for acceptance predicate
task_hash = ErgoAgentPay.compute_task_hash("task output here")

LangChain integration

from ergo_agent_pay import ErgoAgentPay

agent = ErgoAgentPay(address="YOUR_ADDRESS", network="testnet")
tool = agent.as_langchain_tool(server_url="http://localhost:3000")

# Use in any LangChain agent
from langchain.agents import AgentExecutor
tools = [tool]

OpenAI function calling

definition = agent.as_openai_function()

response = openai.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Pay 0.001 ERG to <address>"}],
    tools=[{"type": "function", "function": definition}],
)

Transaction building

Python doesn't have a Fleet SDK equivalent. For full transaction building, use:

  • TypeScript SDK (recommended): run ergo-agent-pay TypeScript server, call via HTTP
  • ergpy: pip install ergpy — AppKit JVM wrapper
  • sigma-rust: Python bindings for Rust-based TX builder

See example 06 for the HTTP delegation pattern.

Note lifecycle — what Python can do

Operation Python TypeScript
Get balance
Get UTxOs
Check note (decode registers)
Compute task hash ✅ (BLAKE2b-256) ✅ (BLAKE2b-256)
LangChain tool
OpenAI function
Build TX (issueNote, pay) Via HTTP server ✅ native
Sign TX External ✅ signer fn
Submit TX

API reference

Full API reference: docs/api-reference.md

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

ergo_agent_pay-0.3.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

ergo_agent_pay-0.3.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file ergo_agent_pay-0.3.0.tar.gz.

File metadata

  • Download URL: ergo_agent_pay-0.3.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ergo_agent_pay-0.3.0.tar.gz
Algorithm Hash digest
SHA256 851d7d3a39a8ea5a76409a07d137137bd7f5a2c6006512c5d079835e1f9619ef
MD5 92962a035391a4c0f20ab96acb154042
BLAKE2b-256 e816afddcb336d66ab792a702cf373b0a0c4de10e3e108dcd9c8f4e72883f8a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ergo_agent_pay-0.3.0.tar.gz:

Publisher: publish-pypi.yml on accord-protocol/accord-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ergo_agent_pay-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ergo_agent_pay-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ergo_agent_pay-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fede9bd197ef7550ee2bf0a21eb0cf0d3b10f8cde80f770e68910f439b893982
MD5 29b3d6e6a0b4cfff475e68435285ec32
BLAKE2b-256 8afb21e8cc9b49366c06a46d84ddb8655ff1de9bc7912a375845b101d54bb794

See more details on using hashes here.

Provenance

The following attestation bundles were made for ergo_agent_pay-0.3.0-py3-none-any.whl:

Publisher: publish-pypi.yml on accord-protocol/accord-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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