> For the complete documentation index, see [llms.txt](https://docs.agentipy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentipy.fun/tools/use-squads.md).

# Use Squads

The `Use Squads` tool, part of AgentiPy, allows users to interact with the Squads Protocol on Solana. Squads is a platform for creating and managing multi-signature wallets (multisigs) and DAO-like structures. This tool provides functionalities for creating multisigs, creating and managing proposals (approving, rejecting, executing), and managing the multisig treasury. These operations are routed through an Agentipy proxy service.

## Functionality

This tool is implemented in the `SquadsManager` class. All its methods interact with an Agentipy proxy service (`agent.base_proxy_url`), sending encrypted private keys and an OpenAI API key with each request.

### Key Methods:

* `create_squads_multisig(agent: SolanaAgentKit, creator: str) -> Optional[Dict[str, Any]]`:
  * Creates a new Squads multisig.
  * `creator`: The public key of the wallet initiating the multisig creation (likely the agent's wallet or another specified address).
* `create_multisig_proposal(agent: SolanaAgentKit, transaction_index: int) -> Optional[Dict[str, Any]]`:
  * Creates a new proposal within a multisig, referencing a `transaction_index` (which implies transactions are pre-registered or indexed elsewhere, possibly via the proxy or Squads UI).
* `approve_multisig_proposal(agent: SolanaAgentKit, transaction_index: int) -> Optional[Dict[str, Any]]`:
  * Approves an existing multisig proposal identified by `transaction_index`.
* `reject_multisig_proposal(agent: SolanaAgentKit, transaction_index: int) -> Optional[Dict[str, Any]]`:
  * Rejects an existing multisig proposal.
* `execute_multisig_proposal(agent: SolanaAgentKit, transaction_index: int) -> Optional[Dict[str, Any]]`:
  * Executes an approved multisig proposal.
* `deposit_to_multisig_treasury(agent: SolanaAgentKit, amount: float, vault_index: int, mint: Optional[str] = None) -> Optional[Dict[str, Any]]`:
  * Deposits tokens into a multisig's treasury.
  * `amount`: The quantity of tokens to deposit.
  * `vault_index`: The index of the vault within the multisig to deposit into.
  * `mint` (Optional): The mint address of the token being deposited (e.g., USDC, SOL). If not provided, it might default to SOL or require the vault to be specific to a token.
* `transfer_from_multisig_treasury(agent: SolanaAgentKit, amount: float, to: str, vault_index: int, mint: str) -> Optional[Dict[str, Any]]`:
  * Creates a proposal to transfer assets from a multisig treasury.
  * `amount`, `to` (recipient address), `vault_index`, and `mint` of the token. This likely creates a proposal that then needs to be approved and executed.

All methods return a dictionary with the transaction details from the proxy or an error.

##

**Important Considerations:**

* **Proxy Service:** This tool relies on an Agentipy proxy service. The availability, authentication (including the role of the OpenAI API key), and terms of use for this proxy are critical.
* **On-Chain Governance Actions:** All Squads operations (creating multisigs, proposals, treasury management) are significant on-chain transactions that modify state, control assets, and incur SOL fees.
* **Squads Protocol Knowledge:** Users must have a thorough understanding of how Squads multisigs work, including concepts like thresholds, member roles, proposal lifecycles, and vault indexing. Errors can lead to loss of control over assets or failed proposals.
* **Transaction Indexing:** Methods related to proposals often refer to a `transaction_index`. How these indices are determined and managed (likely by the Squads platform or the proxy) is crucial for correct operation.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_squads.py>
