> For the complete documentation index, see [llms.txt](https://docs.elemental.fund/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elemental.fund/elemental-lend/protocol-architecture/operational-logic-and-algorithm-design.md).

# Operational Logic and Algorithm Design

#### Smart Routing Algorithm

Elemental’s smart routing algorithm continuously analyses yields and price impact across all supported pools every few minutes. When certain thresholds are met, it automatically rebalances deposits to optimize returns, otherwise it maintains its current deployment.

This approach strikes an optimal balance between minimizing rebalancing costs and maximizing yield efficiency - ensuring that capital is always working in the most productive configuration without unnecessary transaction overhead.

#### Sub-vaults

In protocols such as Kamino, many lending pools exist. Running a single global algorithm across all of them would be computationally expensive, as the calculations grow exponentially with each additional pool.

To address this, Elemental employs a main and sub-vault architecture. Each sub-vault operates within a specific protocol and runs its own local optimization algorithm. The main vault’s algorithm then coordinates only at the protocol level, deciding how to allocate funds among the various sub-vaults.

This layered approach dramatically improves efficiency, allowing Elemental to scale efficiently.

#### Redundancies

Because the smart routing algorithm must operate continuously, Elemental maintains three RPC endpoints to ensure uninterrupted performance. If one endpoint experiences downtime, the next takes over automatically - with an additional backup ready if needed.

While this setup cannot make the system completely fail-safe, it provides a strong layer of operational resilience. Even in the unlikely event that all algorithmic processes pause, funds remain safely within their respective protocols until the system restores and rebalances them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.elemental.fund/elemental-lend/protocol-architecture/operational-logic-and-algorithm-design.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
