# Expense Policy Decision Engine (Threshold Memory)

<details>

<summary>In Progress</summary>

This page is currently under active development. Content may be incomplete, evolving, or placeholder-only. Please check back later for finalized documentation and fully structured examples.

</details>

This workshop guides you through the **Threshold Memory** version of the [Expense Policy Decision Engine template](/templates/policy-automation/expense-policy-decision-engine.md) — a rules-based workflow for automating expense report approvals using GLIK Cloud.

This version builds upon the Starter template, adding memory-aware decision logic and fallback pathways using [LLM reasoning](/system-architecture/blocks-and-nodes/input-and-extraction/llm-block/llm-reasoning.md). It demonstrates how policies can be encoded, recalled, and applied using conversation variables, branching logic, and optional escalation.

{% embed url="<https://www.mermaidchart.com/raw/e93c59d6-2588-475e-a63a-34308c379357?theme=light&version=v0.1&format=svg>" %}
This diagram shows how GLIK workflows dynamically apply memory-based policy thresholds using conditional logic. If no clear rule matches, fallback to LLM ensures decisions remain explainable.
{% endembed %}

### 🧭 What You’ll Learn

{% hint style="info" %}
**How Thresholds Work:** This [workflow](/glik-cloud/what-is-a-workflow.md) evaluates uploaded invoices against policy thresholds stored in memory (policy\_memory). If the invoice exceeds a category-specific limit or the global threshold, the system either rejects or escalates. For unmatched or ambiguous cases, it falls back to [LLM reasoning](/system-architecture/blocks-and-nodes/input-and-extraction/llm-block/llm-reasoning.md) for justification.
{% endhint %}

* How to structure a policy-driven approval agent in [GLIK Studio](/glik-cloud/getting-started/glik-cloud-vs.-glik-studio.md)
* How to extract structured data from uploaded files
* How to apply policy thresholds using [IF/ELSE logic blocks](/system-architecture/blocks-and-nodes/logic-blocks/if-else-branch.md)
* How to use conversation memory (`policy_memory`, `invoice_data`, etc.)
* How to handle ambiguity with [LLM fallback responses](/system-architecture/decision-routing/llm-fallthrough-patterns.md)

### 🛠️ Prerequisites

<table data-view="cards"><thead><tr><th>Topic</th><th>Description</th></tr></thead><tbody><tr><td>🎛️ GLIK Studio Interface</td><td>Review the <a href="/pages/vTNkPbBIP0Dat2aFCEvr#what-is-glik-studio">GLIK Studio</a> interface and how <a href="/pages/UFldUHuantb6E36Sc5dZ">app types</a> are structured in GLIK Cloud.</td></tr><tr><td>🧱 Starter Template</td><td>Start with the <a href="/pages/mSMfZOLcHsCLoinwCsUJ">Expense Policy Starter</a> version before continuing with this Threshold Memory variant.</td></tr><tr><td>📂 Sample Files</td><td>Have a <a href="https://drive.google.com/drive/u/4/folders/18_aO02dinEDpndkjF3olUKsiEgrfEjqB">sample invoice</a> (PDF format) and, optionally, a policy document ready for upload.</td></tr></tbody></table>

### 🧱 Workshop Sections

1. **Template Overview**\
   A summary of all blocks and variables used.
2. **Block-by-Block Walkthrough**\
   Detailed breakdown of each node’s purpose and configuration.
3. **Threshold Logic & Memory Usage**\
   How policy thresholds are applied using memory variables.
4. [**LLM Fallback for Ambiguity**](/system-architecture/decision-routing/llm-fallthrough-patterns.md)\
   How to design graceful degradation to language models.
5. **Deployment & Testing**\
   Steps to test the flow and validate decision logic.

***

### 📁 Files & Resources

Use these practice files to simulate real-world invoice reviews. Upload them via the Start Block to test dynamic threshold evaluation and LLM fallback behavior.

* 📝 [Sample Expense Policy Book](https://drive.google.com/drive/u/4/folders/18_aO02dinEDpndkjF3olUKsiEgrfEjqB)
* 📄 [Example Chrome River-style invoice PDF](https://drive.google.com/drive/u/4/folders/18_aO02dinEDpndkjF3olUKsiEgrfEjqB) (upload via Start Block)
* 🧠 Coming soon: `policy_book.yml` for structured rule ingestion


---

# 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.glik.ai/templates/policy-automation/expense-policy-decision-engine/expense-policy-decision-engine-threshold-memory.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.
