Skip to main content

Python SDK for ZeroQuant agentic DeFi vaults

Project description

ZeroQuant Python SDK

Python SDK for ZeroQuant agentic DeFi vaults with built-in LangChain support.

Installation

pip install zeroquant

With LangChain support

pip install zeroquant[langchain]

Quick Start

import asyncio
from zeroquant import ZeroQuantClient
from zeroquant.models import VaultConfig

async def main():
    client = ZeroQuantClient(
        provider="https://sepolia.infura.io/v3/YOUR_KEY",
        config=VaultConfig(
            owner="0x...",
            permission_manager="0x...",
            factory_address="0x..."
        ),
        private_key="0x..."
    )

    # Create vault
    vault_address = await client.create_vault(salt=12345)
    print(f"Vault created: {vault_address}")

    # Check balance
    balance = await client.get_balance()
    print(f"Balance: {balance / 10**18} ETH")

asyncio.run(main())

LangChain Integration

from langchain.agents import initialize_agent, AgentType
from langchain.chat_models import ChatOpenAI
from zeroquant.langchain import CreateVaultTool, ExecuteSwapTool, GetVaultBalanceTool

tools = [
    CreateVaultTool(client=client),
    ExecuteSwapTool(client=client, swap_intent=swap_intent),
    GetVaultBalanceTool(client=client)
]

agent = initialize_agent(
    tools,
    ChatOpenAI(model="gpt-4"),
    agent=AgentType.OPENAI_FUNCTIONS
)

result = agent.run("Create a vault and swap 1 ETH for USDC")

Authentication Modes

1. Agent Wallet

client = ZeroQuantClient(
    provider="https://...",
    config=config,
    private_key="0x..."  # Agent's private key
)

2. Delegated Signing

client = ZeroQuantClient(
    provider="https://...",
    config=config,
    session_key="0x...",
    delegation_proof="0x..."
)

3. API Key

client = ZeroQuantClient(
    provider="https://...",
    config=config,
    api_key="zq_live_...",
    api_url="https://api.zeroquant.io"
)

Features

  • Async-first - Built with asyncio for efficient I/O
  • Type-safe - Full Pydantic models with validation
  • LangChain tools - Built-in tools for AI agents
  • Multi-modal auth - Wallet, delegated, or API key
  • Comprehensive - Feature parity with TypeScript SDK

Examples

See examples/ directory for complete examples:

  • basic_swap.py - Create vault and execute swap
  • langchain_agent.py - LangChain agent with ZeroQuant tools

Documentation

Full documentation: https://docs.zeroquant.io

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

zeroquant_sdk-0.3.1.tar.gz (62.3 kB view details)

Uploaded Source

Built Distribution

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

zeroquant_sdk-0.3.1-py3-none-any.whl (60.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for zeroquant_sdk-0.3.1.tar.gz
Algorithm Hash digest
SHA256 634db267935526ebf7cdafd0d90c7c7dfcfd89039c23a495961c363d41b4d42a
MD5 7b7b73a403cb1c60a1a3cd952f376c4b
BLAKE2b-256 6a836edea65679007143a5f9d0accd007cc47cc2b71ca95e972c670fb548918a

See more details on using hashes here.

Provenance

The following attestation bundles were made for zeroquant_sdk-0.3.1.tar.gz:

Publisher: publishsdk.yaml on MemeDDLabs/zeroquant-sdk

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

File details

Details for the file zeroquant_sdk-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: zeroquant_sdk-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 60.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zeroquant_sdk-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e68a4d5fce7b6c12a774d7520f208b18ec17a6e9d51f2d26e21cc76cabcaf77a
MD5 f5b6977e4e6d1586bac03e0ba4666c0b
BLAKE2b-256 6e81e4d00f61990411ff45ff2ca8cb6fd2f25d8f83311e3262dcdef06abc9b8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for zeroquant_sdk-0.3.1-py3-none-any.whl:

Publisher: publishsdk.yaml on MemeDDLabs/zeroquant-sdk

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