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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ergo_agent_pay-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b23d85dafe8d0831981a2cf8ed4038d19756c23db220751698e943929efd6c6c
MD5 7d67f35eb5e68fb361c8c124542e29dd
BLAKE2b-256 625bb1101d3db7b7ca38584b209691a85ac4aebad2ce540a69cdce0e462eba2b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ergo_agent_pay-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a4de8c86fddf0e86b97c67b245d9b0789e645e51e03306b546824817c3734d1
MD5 80f27169f0ece3211cf0377199ed4404
BLAKE2b-256 a57b83f9e4355cbf32f3bb1e2175b5f3ffe316d04401013440ef478d6b5f5f4e

See more details on using hashes here.

Provenance

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