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.2.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.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ergo_agent_pay-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3cbac445f810c65376f80241768e80e61da507612e6e8f4a3574cff91742619e
MD5 5e4f39fe8c744bae794a1ecf36f56afd
BLAKE2b-256 7005b1eef2fccc333a9831bf03540d7717b6548be327aab87c0d19007020d8e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ergo_agent_pay-0.3.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: ergo_agent_pay-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ba3af199fd765bf5e7b3af6dec3be5ccf0fb09b53f370711337b9914723822f
MD5 cb4e895214da759bfd498255ff9a37be
BLAKE2b-256 ac742bfb8d3a54e7482cacd6e08131aa4a7375ae42b0ad7feb296ea4bbe711c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ergo_agent_pay-0.3.2-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