Skip to main content

AutoGen tool for x402 service discovery — find any x402-payable API endpoint at runtime

Project description

autogen-x402-discovery

AutoGen tool for x402 service discovery — let your AutoGen agents find and call any paid API endpoint at runtime.

When your AutoGen agent needs web search, image generation, data enrichment, or any other external capability, it calls x402_discover to find the best available service from the live x402 discovery catalog.

Installation

pip install autogen-x402-discovery

Quick Start

import autogen
from autogen_x402_discovery import register_with_autogen

config_list = [{"model": "gpt-4o", "api_key": "your-key"}]

assistant = autogen.ConversableAgent(
    "assistant",
    llm_config={"config_list": config_list},
    system_message="Use x402_discover to find paid API services when needed.",
)

# Register the discovery tool
register_with_autogen(assistant)

user_proxy = autogen.UserProxyAgent("user", human_input_mode="NEVER")
user_proxy.initiate_chat(assistant, message="Find a crypto price API under $0.01/call")

OpenAI Function Calling Schema

from autogen_x402_discovery import get_autogen_tool_schema, x402_discover

# Get the schema for use with any OpenAI-compatible API
schema = get_autogen_tool_schema()

# Call the function directly
result = x402_discover("web search", max_price_usd=0.10)
print(result)

Tool Parameters

Parameter Type Default Description
query str required Natural language description of the capability needed
max_price_usd float 0.50 Maximum acceptable price per call in USD

How It Works

  1. Agent calls x402_discover("web search")
  2. Tool fetches the free catalog
  3. Services are filtered by max_price_usd and matched by keyword
  4. Results are ranked by uptime % and latency
  5. Returns endpoint URL, price, and a Python snippet

Links

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

autogen_x402_discovery-1.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

autogen_x402_discovery-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file autogen_x402_discovery-1.0.1.tar.gz.

File metadata

  • Download URL: autogen_x402_discovery-1.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for autogen_x402_discovery-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2523bbb239327f9571218bf8b79393688c3472ac1f29eec03e371cf33a8c4ced
MD5 122b5efa7703aa191d0b6ef747e5dbab
BLAKE2b-256 c3b8d035151d15314760c5398c8594d7cb99eaeb95e80b6571acdbfeaac011c9

See more details on using hashes here.

File details

Details for the file autogen_x402_discovery-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for autogen_x402_discovery-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1529459a8d9a69e004c132ec9f88c20baf080b2cdf89016ed1d5023752d4d775
MD5 167c72f9cd423361d1cfbcdca5bd6824
BLAKE2b-256 c0672e28f71800077386ff7281574fa9fd80ccae368020479af37b2756d78adf

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