# 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="/files/pcqU9KvM4cKoAW6hvW47" 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="/files/lQihFifbTjtwYy6Bp19G" alt=""><figcaption></figcaption></figure>

Overall Market Analysis is then performed

<figure><img src="/files/lEgGoI0DptW3WqkYBG8T" 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="/files/z2Fo5qa4gAxiRN9VXAU1" 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="/files/8PEeXxvc05oN7HzoJ10I" alt=""><figcaption></figcaption></figure>


---

# 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://usestrawberry.gitbook.io/strawberryai/product-suite/0xluigi/technicals.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.
