# SolanaAgentKit

The `SolanaAgentKit` is a fundamental component of AgentiPy, providing the necessary tools and configurations for AI agents to interact with the Solana blockchain. It encapsulates the connection to a Solana RPC endpoint and manages the wallet (private key) required for signing transactions.

## Purpose

* **Blockchain Connection:** Establishes and maintains the connection to a Solana RPC node, enabling communication with the Solana network.
* **Wallet Management:** Securely handles the private key associated with a Solana wallet, which is essential for authorizing transactions and interacting with on-chain programs.
* **Transaction Signing:** Provides methods for signing transactions before they are submitted to the Solana network.
* **Context Provider:** Acts as a central context object that is passed to various AgentiPy tools, giving them access to the blockchain connection and wallet information.

## Usage

To use `SolanaAgentKit`, you need to initialize it with your Solana wallet's private key and the URL of a Solana RPC endpoint.

### Initialization Example

```python
from agentipy.agent import SolanaAgentKit

# !! IMPORTANT SECURITY WARNING !!
# NEVER hardcode your private key directly into your code, ESPECIALLY for Mainnet.
# This is for demonstration purposes ONLY.
# In a real application, use environment variables, secure key vaults, or other
# secure key management practices. Compromising your private key can lead to
# loss of funds.

PRIVATE_KEY = "YOUR_PRIVATE_KEY_HERE"  # ⚠️ REPLACE THIS SECURELY! ⚠️
RPC_URL = "https://api.mainnet-beta.solana.com"  # Mainnet RPC endpoint, change to devnet or testnet as needed

# Initialize the SolanaAgentKit
agent = SolanaAgentKit(
    private_key=PRIVATE_KEY,
    rpc_url=RPC_URL
)

print(f"SolanaAgentKit initialized. Using RPC: {agent.rpc_url}")
# You can now pass this 'agent' object to other AgentiPy tools.
```

**Security Note:** Always handle private keys with extreme care. For production environments, use secure methods like environment variables or dedicated secret management services instead of hardcoding them.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/core-concepts/solanaagentkit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
