Skip to main content

Playgrounds Tool Specs

playgrounds_subgraph_connector

pip install llama-index-tools-playgrounds

Playgrounds API is a service provided by Playgrounds Analytics to streamline interfacing with decentralized subgraphs (indexed blockchain datasets).

The PlaygroundsSubgraphConnector is a tool designed for LLM agents to seamlessly interface with and query subgraphs on The Graph's decentralized network via Playgrounds API.

This tool is specifically designed to be used alongside Llama index or langchain

Advantages of this tool:

  • Easy access to Decentralized Subgraphs (Datasets): No need for wallet or GRT management.
  • LLM x Blockchain data: Develop Ai applications that leverage blockchain data seamlessly.

Basic Usage:

To utilize the tool, simply initialize it with the appropriate identifier (Subgraph ID or Deployment ID) and api_key. Optionally, specify if you're using a deployment ID.

import openai
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.playgrounds import PlaygroundsSubgraphConnectorToolSpec


async def simple_test():
    """
    Run a simple test querying the financialsDailySnapshots from Uniswap V3 subgraph using FunctionAgent and Playgrounds API.
    """

    # Initialize the tool specification with the subgraph's identifier and the Playgrounds API key
    connector_spec = PlaygroundsSubgraphConnectorToolSpec(
        identifier="YOUR_SUBGRAPH_OR_DEPLOYMENT_IDENTIFIER",
        api_key="YOUR_PLAYGROUNDS_API_KEY",
        use_deployment_id=False,  # Set to True if using Deployment ID
    )

    # Setup agent with the tool
    agent = FunctionAgent(
        tools=connector_spec.to_tool_list(),
        llm=OpenAI(model="gpt-4.1"),
    )

    # Make a query using the agent
    response = await agent.run(
        "query the financialsDailySnapshots for id, timestamp, totalValueLockedUSD, and dailyVolumeUSD. only give me the first 2 rows"
    )
    print(response)


if __name__ == "__main__":
    import asyncio

    asyncio.run(simple_test())

Visit here for more in-depth Examples.

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.

playgrounds_subgraph_inspector

Playgrounds API is a service provided by Playgrounds Analytics to facilitate interactions with decentralized subgraphs (indexed blockchain datasets).

The PlaygroundsSubgraphInspectorToolSpec is a tool designed for LLM agents to introspect and understand the schema of subgraphs on The Graph's decentralized network via the Playgrounds API.

This tool is specifically designed to be used alongside Llama index or langchain.

  • To learn more about Playgrounds API, please visit our website: Playgrounds Network
  • Obtain your Playgrounds API Key and get started for free here.
  • Discover any Subgraph (dataset) you need here.

Advantages of this tool:

  • Introspection of Decentralized Subgraphs (Datasets): Understand the schema of any subgraph without hassle.
  • LLM x Blockchain Data: Develop AI applications that leverage introspective insights from blockchain data.

Basic Usage:

To utilize the tool, initialize it with the appropriate identifier (Subgraph ID or Deployment ID), api_key, and specify if you're using a deployment ID.

import openai
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.playgrounds import PlaygroundsSubgraphInspectorToolSpec


async def inspect_subgraph(
    openai_api_key: str,
    playgrounds_api_key: str,
    identifier: str,
    use_deployment_id: bool,
    user_prompt: str,
):
    """
    Introspect a subgraph using FunctionAgent and Playgrounds API with the provided parameters.

    Args:
        openai_api_key (str): API key for OpenAI.
        playgrounds_api_key (str): API key for Playgrounds.
        identifier (str): Identifier for the subgraph or deployment.
        use_deployment_id (bool): If True, uses deployment ID in the URL.
        user_prompt (str): User's question or prompt for the agent.

    Returns:
        str: Agent's response.
    """
    # Initialize the inspector with the provided parameters
    inspector_spec = PlaygroundsSubgraphInspectorToolSpec(
        identifier=identifier,
        api_key=playgrounds_api_key,
        use_deployment_id=use_deployment_id,
    )

    # Integrate the tool with the agent
    agent = FunctionAgent(
        tools=inspector_spec.to_tool_list(),
        llm=OpenAI(model="gpt-4.1", api_key=openai_api_key),
    )

    # Send the user prompt to the agent
    response = await agent.run(user_prompt)
    return response


if __name__ == "__main__":
    import asyncio

    resp = asyncio.run(
        inspect_subgraph(
            openai_api_key="YOUR_OPENAI_API_KEY",
            playgrounds_api_key="YOUR_PLAYGROUNDS_API_KEY",
            identifier="YOUR_SUBGRAPH_OR_DEPLOYMENT_IDENTIFIER",
            use_deployment_id=False,
            user_prompt="Which entities will help me understand the usage of Uniswap V3?",
        )
    )
    print(resp)

Visit here for more in-depth Examples.

This inspector is designed to be used as a way to understand the schema of subgraphs and subgraph data being loaded into LlamaIndex.

Metadata

Release files for llama-index-tools-playgrounds 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-playgrounds 0.6.0
File Size Uploaded Provenance Actions
llama_index_tools_playgrounds-0.6.0.tar.gz 7.9 kB Without provenance Details for llama_index_tools_playgrounds-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-playgrounds 0.6.0
File Interpreter ABI Platform Actions
llama_index_tools_playgrounds-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_tools_playgrounds-0.6.0-py3-none-any.whl

Total release size: 16.8 kB

Release files / llama_index_tools_playgrounds-0.6.0.tar.gz

Download URL llama_index_tools_playgrounds-0.6.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8da714f909f3ee37a7c5601e516a1b2471573bf1703479b2310f33891287c072
BLAKE2b-256 checksum
How to use checksums
a4d7c3beb8939972fa52bc208711466846733fe6fbb61fe5f7d852b69b185aa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_tools_playgrounds-0.6.0-py3-none-any.whl

Download URL llama_index_tools_playgrounds-0.6.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c1e17f74cb05d20c7cd272c9e3ed4b5b06e7eba1481b164ab899b2d0700422f
BLAKE2b-256 checksum
How to use checksums
9785571c045b178ba314528afd97d1428e8cb593b4733926758060c0fe2031bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-tools-playgrounds 0.6.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page