> For the complete documentation index, see [llms.txt](https://usestrawberry.gitbook.io/strawberryai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://usestrawberry.gitbook.io/strawberryai/product-suite/0xluigi/technicals.md).

# Technicals

As mentioned previously, Luigi is a reasoning agent, below we'll describe some of the technical aspects that brings Luigi to life.

<figure><img src="https://1851689597-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3133n8teeU8fHCPjehdn%2Fuploads%2FqF2rI7MmLR6bn2H5WMmb%2Fluigimap.JPG?alt=media&amp;token=97c4422b-0e7e-40a7-8b14-89cf24ec499d" alt=""><figcaption></figcaption></figure>

## Architecture

* Built on [LangChain's](https://www.langchain.com/langchain) StateGraph (learn more [here](https://medium.com/@gitmaxd/understanding-state-in-langgraph-a-comprehensive-guide-191462220997)).
* Token-Aware System utilizing 32,000 tokens for dynamic chunking and recursive summary.
* DAG workflow for modular execution and intra-agent cooperation.
* Custom APIs to feed the model pipelines with social media/market data.
* Semantic clustering allows groups' related information to preserve overall coherence across data  processing stages.
* Iterative refinement employs asychronous node execution and state persistence for enhanced decision-making.

Below, we can see the flow of information `in` to a resulting publication `out`. Summarized below as,

* Raw data ingestion
* Chunking
* Market data processing
* Semantic/sentiment analysis and clustering
* Ranking
* Iterative looping and refinement
* Synthesis and publication production

First, market summary node fetches data, implements dynamic chunking, token-aware, maintaining context windows of 32,000 tokens.

<figure><img src="https://1851689597-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3133n8teeU8fHCPjehdn%2Fuploads%2FgrNGwBCTpNOYZcN6gRcm%2Fimage.png?alt=media&amp;token=8920c2b2-5d7f-41f9-b148-c208953cd125" alt=""><figcaption></figcaption></figure>

Overall Market Analysis is then performed

<figure><img src="https://1851689597-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3133n8teeU8fHCPjehdn%2Fuploads%2FzfEQVwPqGk6UQsmkKo2o%2Fimage.png?alt=media&amp;token=19b52939-5953-4cea-a4d3-2a5fe4dd4e8f" alt=""><figcaption></figcaption></figure>

From here, ranking system takes over via ticker and narrative rankings.

* Ticker: frequency analysis, sentiment scoring, volume metrics, historical correlates are all applied.
* Narrative: topic modeling and trend detection, as well as semantic clustering.

Next, the iterative refinement looping (three loops maximum to prevent overfitting), where Luigi refines its analysis in multiple stages: identification, verification, and storage via DAG.

<figure><img src="https://1851689597-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3133n8teeU8fHCPjehdn%2Fuploads%2FuosTFt9stgluRqEOgsM8%2Fimage.png?alt=media&amp;token=471a1d8f-4bec-4c00-834c-0a31fb148c69" alt=""><figcaption></figcaption></figure>

Within Luigi's DAG,

* Nodes represent tastks like data digestion, rankings, and synthesis
* Edges define dependencies *between* tasks
* Token management ensures efficient processing of the dataset, which is important for semantic and narrative preservation.

<figure><img src="https://1851689597-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3133n8teeU8fHCPjehdn%2Fuploads%2FIwugMhJutPDnpI85W41q%2Fimage.png?alt=media&amp;token=43d570d9-0a96-4d24-a098-70d923e06e84" alt=""><figcaption></figcaption></figure>
