> For the complete documentation index, see [llms.txt](https://docs.glik.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glik.ai/templates/policy-automation/expense-policy-decision-engine/expense-policy-decision-engine-threshold-memory.md). Agents can also search and read this documentation through its [MCP server](https://docs.glik.ai/~gitbook/mcp).

# Expense Policy Decision Engine (Threshold Memory)

Automates policy-driven expense approvals using structured memory, threshold logic, and LLM reasoning to reduce review costs and ensure compliance.

<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](https://docs.glik.ai/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](https://docs.glik.ai/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](https://docs.glik.ai/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](https://docs.glik.ai/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](https://docs.glik.ai/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](https://docs.glik.ai/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](https://docs.glik.ai/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="https://docs.glik.ai/glik-cloud/getting-started/glik-cloud-vs.-glik-studio.md#what-is-glik-studio">GLIK Studio</a> interface and how <a href="https://docs.glik.ai/glik-cloud/app-types-overview.md">app types</a> are structured in GLIK Cloud.</td></tr><tr><td>🧱 Starter Template</td><td>Start with the <a href="https://docs.glik.ai/templates/policy-automation/expense-policy-decision-engine/expense-policy-decision-engine-starter.md">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**](https://docs.glik.ai/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
