💧 haystack-spraay
Spraay x402 Gateway integration for Haystack — multi-chain batch payments, balance checks, RPC calls, and oracle prices for AI agents and pipelines.
What is Spraay?
Spraay is a multi-chain batch payment protocol and x402 gateway that lets AI agents make USDC micropayments across 16+ blockchains. The gateway exposes 76+ paid endpoints covering payments, RPC, oracles, AI inference, storage, and more — all payable via the x402 HTTP payment protocol.
What is Haystack?
Haystack is an open-source AI orchestration framework by deepset for building production-ready LLM applications with modular pipelines and agent workflows.
Installation
pip install haystack-spraay
Quick Start — Agent with Payment Tools
import os
from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack_spraay.tools import spraay_batch_payment, spraay_check_balance, spraay_oracle_price
os.environ["OPENAI_API_KEY"] = "<YOUR_KEY>"
# Create an agent with Spraay payment tools
agent = Agent(
chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"),
tools=[spraay_batch_payment, spraay_check_balance, spraay_oracle_price],
system_prompt="You are a helpful blockchain payment assistant. You can send payments, check balances, and look up token prices across 16+ blockchains.",
)
# Run it
result = agent.run(
messages=[ChatMessage.from_user("What's the current price of ETH in USD?")]
)
print(result["last_message"].text)
Quick Start — Pipeline Component
from haystack import Pipeline
from haystack_spraay.components import SpraayBalanceCheck, SpraayBatchPayment
# Use components directly
balance_checker = SpraayBalanceCheck(chain="base")
result = balance_checker.run(address="0xAd62f03C7514bb8c51f1eA70C2b75C37404695c8")
print(result)
# Or in a pipeline
pipeline = Pipeline()
pipeline.add_component("balance", SpraayBalanceCheck(chain="base"))
result = pipeline.run({"balance": {"address": "0x1234...", "token": "USDC"}})
Available Components
| Component | Description |
|---|---|
SpraayBatchPayment |
Send batch USDC payments to multiple recipients |
SpraayBalanceCheck |
Check token balances on any chain |
SpraayGasPrice |
Get real-time gas prices |
SpraayRPCCall |
Make raw JSON-RPC calls to any chain |
SpraayOraclePrice |
Get real-time token prices |
Available Tools (for Agents)
| Tool | Description |
|---|---|
spraay_batch_payment |
Send multi-recipient payments |
spraay_check_balance |
Query wallet balances |
spraay_gas_price |
Estimate transaction costs |
spraay_rpc_call |
Raw blockchain queries |
spraay_oracle_price |
Token price lookups |
Supported Chains
Base, Ethereum, Arbitrum, Polygon, BNB Chain, Avalanche, Solana, Stellar, XRP Ledger, Bitcoin, BOB, Unichain, Plasma, Bittensor, Stacks.
Advanced: Multi-Step Payment Pipeline
from haystack import Pipeline
from haystack_spraay.components import (
SpraayBalanceCheck,
SpraayGasPrice,
SpraayBatchPayment,
)
# Build a payment pipeline: check balance → estimate gas → send payment
pipeline = Pipeline()
pipeline.add_component("balance", SpraayBalanceCheck(chain="base"))
pipeline.add_component("gas", SpraayGasPrice())
pipeline.add_component("payment", SpraayBatchPayment(chain="base"))
# Run steps individually or connect them with custom routing logic
balance_result = pipeline.run(
{"balance": {"address": "0xSenderAddr", "token": "USDC"}}
)
Advanced: Use with Haystack Agent + Other Tools
from haystack.components.agents import Agent
from haystack.components.generators.chat import OpenAIChatGenerator
from haystack.tools import ComponentTool
from haystack.components.websearch import SerperDevWebSearch
from haystack_spraay.tools import spraay_batch_payment, spraay_oracle_price
# Combine Spraay tools with web search
search_tool = ComponentTool(
component=SerperDevWebSearch(api_key=Secret.from_env_var("SERPERDEV_API_KEY")),
name="web_search",
description="Search the web for information",
)
agent = Agent(
chat_generator=OpenAIChatGenerator(model="gpt-4o"),
tools=[spraay_batch_payment, spraay_oracle_price, search_tool],
system_prompt=(
"You are a crypto research assistant that can search the web, "
"check token prices, and send payments when instructed."
),
)
Architecture
┌──────────────┐ ┌───────────────┐ ┌─────────────────┐
│ Haystack │────▶│ Agent / │────▶│ Spraay Tools │
│ Pipeline │ │ ToolInvoker │ │ & Components │
└──────────────┘ └───────────────┘ └────────┬────────┘
│
┌─────────▼─────────┐
│ Spraay x402 │
│ Gateway │
│ gateway.spraay.app │
└─────────┬─────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌─────▼───┐ ┌─────▼───┐ ┌─────▼───┐
│ Base │ │ Solana │ │ 15+ │
│ │ │ │ │ more │
└─────────┘ └─────────┘ └─────────┘
Contributing
- Clone:
git clone https://github.com/plagtech/haystack-spraay.git - Install dev deps:
pip install -e ".[dev]" - Run tests:
pytest tests/ -v
Links
- Spraay Gateway: gateway.spraay.app
- Spraay Docs: docs.spraay.app
- Spraay MCP Server: @plagtech/spraay-x402-mcp
- Haystack: haystack.deepset.ai
- Haystack Integrations: github.com/deepset-ai/haystack-integrations
- x402 Protocol: github.com/coinbase/x402
Payment Address
All x402 payments route to: 0xAd62f03C7514bb8c51f1eA70C2b75C37404695c8
License
Apache-2.0
Author
Built by @plagtech | @plag on Farcaster | @Spraay_app
Metadata
Release files for haystack-spraay 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| haystack_spraay-0.1.0.tar.gz | 8.6 kB | Without provenance | Details for haystack_spraay-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| haystack_spraay-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for haystack_spraay-0.1.0-py3-none-any.whl |
Total release size: 17.9 kB
Release files / haystack_spraay-0.1.0.tar.gz
| Download URL | haystack_spraay-0.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
045423f24f1a0f20d781fda442ad073a650bc8b687de2a88d51f205fea7ede59
|
|
BLAKE2b-256 checksum How to use checksums |
5662c70b92cbbfb5f11616383c9fd7952a27b9df77a78464cda6c25bbf4a0ef2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / haystack_spraay-0.1.0-py3-none-any.whl
| Download URL | haystack_spraay-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36fca04bf3ecbcd6be1eab983590e72aa42c6a707c56304a84e26181d86dcc6d
|
|
BLAKE2b-256 checksum How to use checksums |
b760e30b19195790c139f5bc3904e84e995b79f95538f57391c5dde54bf889c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for haystack-spraay 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.