Skip to main content

LlamaIndex FunctionTool for x402 Service Discovery — find paid API services at runtime

Project description

llama-index-x402-discovery

A LlamaIndex FunctionTool that lets any LlamaIndex agent or query engine discover x402-payable API services at runtime via the x402 Service Discovery API. Returns quality-ranked results so your agent can find the best available endpoint without hardcoded URLs.

Install

pip install llama-index-x402-discovery
# or without PyPI:
pip install requests llama-index-core
# and copy x402discovery_llama/__init__.py into your project

Usage

from x402discovery_llama import X402DiscoveryTool
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-4o-mini")
agent = ReActAgent.from_tools([X402DiscoveryTool], llm=llm, verbose=True)
response = agent.chat("Find a data enrichment service under $0.05 per call")
print(response)

The agent calls x402_discover and returns up to 5 quality-ranked services with endpoint URLs and pricing so it can choose the best one.

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

llama_index_x402_discovery-1.0.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

llama_index_x402_discovery-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_x402_discovery-1.0.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_x402_discovery-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6dd141c9b984336d6e2d3c6e093249a79c638fe43ffb206605bf9a4f8df0b92e
MD5 72b2e792ce53105f476edfe9b0fee647
BLAKE2b-256 439d1694fc0fdf56995b46e99666abe6ada04709f1ea2679f7440c0e0c1836ca

See more details on using hashes here.

File details

Details for the file llama_index_x402_discovery-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_x402_discovery-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9de7c61f9f09ed0df5880d944f9733d3ca701b3ccc3d436902313e9663fad4a4
MD5 397ed5a989ea134f8145ad218a3b55e2
BLAKE2b-256 b8e22ad1455e2b3a07276953114d3f7f2e5a864b539fdc2be769621772ad4f46

See more details on using hashes here.

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