Skip to main content

AI Agents for Solana

Project description

Solana Agent

PyPI - Version Python 3.13-3.14 PyPI - Downloads License: MIT codecov Build Status Ruff Style

Thin public SDK for the hosted Solana Agent platform.

The public package is intentionally small:

  • One agent per client instance.
  • Hosted chat and hosted wallet flows.
  • Hosted account and pricing APIs.
  • MCP plugin support for external tools.

Python Support

We support the current and previous CPython minor versions.

Today that means:

  • Python 3.14
  • Python 3.13

Install

pip install solana-agent

Quick Start

Use the Solana Agent CLI to get a new privy_user_id from the interactive menu:

solana-agent wallet menu
from solana_agent import SolanaAgent

agent = SolanaAgent(
    instructions="You are a Solana trading bot.",
    privy_user_id="my-privy-user-id",
)

context = await agent.context(
    conversation_id="my-conversation-id",
    model="chat",
)

response = await agent.message(
    message="What is the price of SOL?",
    **context
)

print(response)

Hosted Memory

context = await agent.context(
    conversation_id="my-conversation-id",
    model="memory",
    memory_ttl_tier="project",
)

Priority Service Tier

context = await agent.context(
    service_tier="priority",
)

MCP Tools

Connect Streamable HTTP MCP servers by enabling the mcp tool and adding server config:

import os
from solana_agent import SolanaAgent

agent = SolanaAgent(
    config={
        "ai": {
            "instructions": "Use connected MCP tools when they help the user.",
            "privy_user_id": os.environ["PRIVY_USER_ID"],
            "tools": ["mcp"],
        },
        "tools": {
            "mcp": {
                "servers": [
                    {
                        "url": os.environ["MCP_SERVER_URL"],
                        "headers": {
                            "Authorization": f"Bearer {os.environ['MCP_SERVER_TOKEN']}",
                        },
                    }
                ],
                "llm_provider": "openai",
                "api_key": os.environ["OPENAI_API_KEY"],
                "llm_model": "gpt-4.1-mini",
            }
        },
    }
)

context = await agent.context(
    conversation_id="mcp-demo",
    model="chat",
)

response = await agent.message(
    "Use the connected MCP tools to summarize my latest CRM tasks.",
    **context,
)

print(response)

Wallet and Billing Helpers

wallet_address = await agent.get_wallet_address()

summary = await agent.get_account_summary()

report = await agent.get_usage_report(
    "month"
)

forecast = await agent.get_usage_forecast(
    window_days=30,
)

pricing = await agent.get_pricing_info()

tooling_totals = summary.get("tooling", {}).get("lifetime", {}).get("totals", {})
tooling_projection = (
    forecast.get("tooling", {})
    .get("projected_month_end", {})
    .get("totals", {})
)

print(tooling_totals)
print(tooling_projection)

Private Key Export

Export the hosted wallet private key when you want self-custody:

solana-agent wallet export --yes

Pass --wallet-id to export an older rotated wallet from old_wallets.

Rotating Wallets

If a wallet needs to be retired, rotate it from the interactive menu:

solana-agent wallet menu

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solana_agent-34.0.0.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

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

solana_agent-34.0.0-py3-none-any.whl (56.8 kB view details)

Uploaded Python 3

File details

Details for the file solana_agent-34.0.0.tar.gz.

File metadata

  • Download URL: solana_agent-34.0.0.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for solana_agent-34.0.0.tar.gz
Algorithm Hash digest
SHA256 33a5d8655ab442ca285f58aecf7723629dbf5ca5f5b0de57c3e929be5d02c6e8
MD5 3841b6a24bd12719eeb77e3ed73522e2
BLAKE2b-256 a70563f8bf0c9501b441d46b804ca8aab1f408d0dea248cf7f7bff372c9991a1

See more details on using hashes here.

File details

Details for the file solana_agent-34.0.0-py3-none-any.whl.

File metadata

  • Download URL: solana_agent-34.0.0-py3-none-any.whl
  • Upload date:
  • Size: 56.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for solana_agent-34.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a9085f566cc6a88e87b4829460c773acf257ecb27d18764dfc10ffd4aa62d03
MD5 334e4fd3b40b5049b6fb4f9f5ca464db
BLAKE2b-256 cf43ef197cfa4f453d8db2dd12f1ebd64eb8c715ed24a320c76ecb03c246df88

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