# AI Planning Module

The AIPM is an off-chain entity within Stargate designed to dynamically manage credits, fees, and rebates, ensuring optimised liquidity distribution and enhanced efficiency across the protocol. By monitoring cross-chain liquidity flows, the AIPM intelligently reallocates rebates and adjusts fee structures, making Stargate’s credit allocation system adaptable to the demands of each blockchain in real-time.

**Key Features and Functionality:**

* **Dynamic Liquidity Rebalancing**: When a particular pool becomes a popular destination, liquidity within that pool may drop below its ideal balance. At this point, the AIPM can incentivise bridging from that chain to facilitate that liquidity being topped up. This involves increasing incentives on the chain from which liquidity was drawn and may even include treasury rebates for users who bridge assets back to that chain. By actively managing these flows, the AIPM helps maintain liquidity balance across chains and minimises disruptions.
* **Enhanced Gas Efficiency**: In addition to liquidity management, the AIPM fine-tunes gas efficiency across the protocol. By optimising transaction structures and fee parameters, the AIPM enables more gas-efficient operations, lowering costs for users and enhancing the overall user experience.
* **Cost-Effective Protocol Fees**: The AIPM adjusts protocol fees dynamically to ensure they remain competitive and beneficial for users, aligning Stargate’s fee structure with real-time market conditions and liquidity needs.

With the AIPM, Stargate maintains a robust, adaptive system for credit and liquidity management, creating a more resilient and user-friendly cross-chain environment that supports sustainable growth in the DeFi ecosystem.<br>


---

# 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://stargateprotocol.gitbook.io/stargate/v2-user-docs/whats-new-in-stargate-v2/architecture/ai-planning-module.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.
