Skip to main content

Python Agent SDK for Vector blockchain — PyCardano + Ogmios

Project description

apex-fusion-agent-sdk

Python Agent SDK for the Vector blockchain. Built on PyCardano + Ogmios.

Installation

pip install apex-fusion-agent-sdk

Requires Python >= 3.11.

Quick Start

import asyncio
from vector_agent import VectorAgent

async def main():
    async with VectorAgent() as agent:
        address = await agent.get_address()
        print(f"Address: {address}")

        balance = await agent.get_balance()
        print(f"ADA: {balance.ada}")

        tx = await agent.send(to="addr1...", ada=5.0)
        print(f"TX Hash: {tx.tx_hash}")
        print(f"Explorer: {tx.explorer_url}")

asyncio.run(main())

Configuration is read from environment variables by default (see Configuration).

Features

Two Modes of Operation

  • VectorAgent — Standalone mode. Talks directly to Ogmios and submit-api via PyCardano. No external server needed.
  • VectorAgentMCP — MCP client mode. Connects to a TypeScript MCP server via stdio. Same API surface as VectorAgent.

Wallet Management

  • HD Wallets — BIP39 mnemonic with CIP-1852 derivation
  • .skey Files — cardano-cli signing key files

Transactions

  • Send ADA and native tokens
  • Build multi-output transactions
  • Dry-run simulation with fee estimates
  • Transaction history queries via Koios

Smart Contracts

  • Deploy PlutusV1/V2/V3 scripts
  • Interact with deployed contracts (lock & spend)

Safety Layer

  • Configurable per-transaction and daily spend limits (in lovelace)
  • Audit logging of all transactions

API

Query Methods

await agent.get_address()                  # Agent's payment address
await agent.get_balance()                  # ADA + token balances
await agent.get_balance("addr1...")         # Balance of any address
await agent.get_utxos()                    # List UTxOs
await agent.get_protocol_parameters()      # Raw protocol params
await agent.get_spend_limits()             # Current spend limit status
await agent.get_transaction_history()      # TX history via Koios

Transfer Methods

# Send ADA
tx = await agent.send(to="addr1...", ada=5.0)
tx = await agent.send(to="addr1...", lovelace=5_000_000)

# Send native tokens
tx = await agent.send_tokens(
    to="addr1...",
    policy_id="abcd1234...",
    asset_name="MyToken",
    quantity=100,
)

Advanced Transaction Building

# Dry-run (simulate without submitting)
result = await agent.dry_run(to="addr1...", ada=5.0)
print(f"Fee: {result.fee_ada} ADA")

# Multi-output transaction
result = await agent.build_transaction(
    outputs=[
        {"address": "addr1...", "lovelace": 5_000_000},
        {"address": "addr1...", "lovelace": 3_000_000},
    ],
    submit=True,
)

Smart Contracts

# Deploy a script
result = await agent.deploy_contract(
    script_cbor="59...",
    script_type="PlutusV2",
    lovelace=2_000_000,
)
print(f"Script address: {result.script_address}")

# Interact with a deployed contract
result = await agent.interact_contract(
    script_cbor="59...",
    action="spend",
    utxo_ref={"tx_hash": "abcd...", "output_index": 0},
)

MCP Client Mode

from vector_agent import VectorAgentMCP

async with VectorAgentMCP(
    server_command="node",
    server_args=["build/index.js"],
    working_dir="/path/to/mcp-server",
) as agent:
    balance = await agent.get_balance()

VectorAgentMCP has the same API as VectorAgent — it delegates all operations to a TypeScript MCP server over stdio.

Configuration

All settings can be passed as constructor arguments or read from environment variables:

Environment Variable Description Default
VECTOR_OGMIOS_URL Ogmios endpoint
VECTOR_SUBMIT_URL Submit-api endpoint
VECTOR_KOIOS_URL Koios endpoint (for history) testnet
VECTOR_EXPLORER_URL Block explorer base URL testnet
VECTOR_MNEMONIC BIP39 mnemonic
VECTOR_SKEY_PATH Path to cardano-cli .skey file
VECTOR_ACCOUNT_INDEX HD derivation account index 0
VECTOR_SPEND_LIMIT_PER_TX Per-transaction limit (lovelace) 100000000 (100 ADA)
VECTOR_SPEND_LIMIT_DAILY Daily limit (lovelace) 500000000 (500 ADA)

See .env.example for a template.

License

MIT

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

apex_fusion_agent_sdk-0.1.6.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

apex_fusion_agent_sdk-0.1.6-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file apex_fusion_agent_sdk-0.1.6.tar.gz.

File metadata

  • Download URL: apex_fusion_agent_sdk-0.1.6.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apex_fusion_agent_sdk-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e8f0e9c7b27dba3c6ca04120de916387da7ff084fcf4ed73061f52bc54495d28
MD5 08f1ef204a22ee1a0c11a2d11dbbba8c
BLAKE2b-256 6c89aa26ed111aafe536437f1d458ddec9387f2cb264b2b0fb276d3503a0feed

See more details on using hashes here.

Provenance

The following attestation bundles were made for apex_fusion_agent_sdk-0.1.6.tar.gz:

Publisher: publish.yml on Apex-Fusion/agent-sdk-py

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

File details

Details for the file apex_fusion_agent_sdk-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for apex_fusion_agent_sdk-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 27e17a33cb1b934b5f5ba12e870fc47bea42abc0240a63f468135664e57d4f8b
MD5 13c438c4a197e0e980668e077368aeae
BLAKE2b-256 b13e79ffa74b7793abf5670f433906cd2e4ba8ffbdb539f7f1d954dd162a8da1

See more details on using hashes here.

Provenance

The following attestation bundles were made for apex_fusion_agent_sdk-0.1.6-py3-none-any.whl:

Publisher: publish.yml on Apex-Fusion/agent-sdk-py

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