# Use FluxBeam

The `Use FluxBeam` tool, part of AgentiPy, allows users to interact with the FluxBeam decentralized exchange on the Solana blockchain. Specifically, this tool provides functionality to create new liquidity pools on FluxBeam.

## Functionality

This tool is implemented in the `FluxBeamManager` class. It interacts directly with the FluxBeam API (`https://api.fluxbeam.xyz`) to request a transaction for creating a pool, and then signs and sends this transaction to the Solana network using the agent's wallet.

### Key Methods:

* `fluxbeam_create_pool(agent: SolanaAgentKit, token_a: Pubkey, token_a_amount: float, token_b: Pubkey, token_b_amount: float) -> str`:
  * Creates a new liquidity pool on FluxBeam with the specified assets.
  * Parameters:
    * `agent`: The `SolanaAgentKit` instance, providing the wallet and connection.
    * `token_a`: `solders.pubkey.Pubkey` of the first token in the pool.
    * `token_a_amount`: The initial amount of token A to deposit (in UI units, e.g., 10.5 tokens).
    * `token_b`: `solders.pubkey.Pubkey` of the second token in the pool.
    * `token_b_amount`: The initial amount of token B to deposit (in UI units).
  * It fetches the decimals for `token_a` and `token_b` (handles SOL as native with 9 decimals).
  * Scales the input amounts to their respective lamport/smallest unit values.
  * Makes a POST request to the FluxBeam API (`/token_pools`) with the payer address (agent's wallet), token mints, and scaled amounts.
  * Receives a serialized transaction from the FluxBeam API.
  * Signs this transaction with the agent's wallet.
  * Sends and confirms the transaction on the Solana network.
  * Returns the transaction signature as a string.

##

**Important Considerations:**

* **Direct API Interaction:** This tool interacts directly with the FluxBeam API to get the transaction details and then submits it to the Solana blockchain. It does not appear to use the Agentipy proxy service.
* **On-Chain Action:** Creating a liquidity pool is a significant on-chain transaction. It will lock up the specified amounts of `token_a` and `token_b` from the agent's wallet into the new pool.
* **Financial Risks:** Providing liquidity has risks, such as impermanent loss. Users should understand these risks before creating pools.
* **Token Decimals:** The tool correctly handles fetching token decimals to convert UI amounts to the required lamport/smallest unit amounts for the transaction.

## Source Code

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


---

# 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/tools/use-fluxbeam.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.
