A Rough Implementation
I’ve had some experience implementing AI in workflows for both my own work and for clients.
Pattern
Aiming to repeat and improve on a pattern here that i’ve found effective, that being email triage and routing.
The system and idea here is that you:
- Intercept emails landing in a busy inbox
- Feed the emails into an LLM
- Provide the LLM tools to search for more context relevant to that email
- Have the LLM make a decision on how to treat the email
- Feed that decision back into the right tools or system that can act on that decision (i.e. forward to person or group X).
Pattern Implementation
Using the system I built as an example (M365 focused), the steps components were:
- Intercept the emails. Power Automate cloud flow trigger on shared inbox.
- Extract the content. Power Automate steps to extract email sender, title and content
- Extract the attachments. Power Automate step to extract text from attachments via M365 AI builder OCR
- Feed all email content to an LLM. Power Automate step to send content via HTTP to the LLM
- The LLM that receives and processes the content. Azure AI Foundry Prompt Flow Deployment
- Give the LLM the tool to search for more context. Prompt flow has a tool call to a safe read-only API bridge that can access specific read-only endpoints of a REST API enabled database
- LLM makes a decision on the routing target for that email. Prompt flow uses the email content and context, as well as the tool call outputs to make a decisions
- The LLM sends the decision back to the system that can act on that information. LLM sends decision back to another Power Automate flow with a HTTP trigger
- Parse decision and implement guards. That Power Automate flow parses and gates the decision to ensure the response is within bounds (what’s expected) and provides guards to ensure it’s only sent internally (i.e. no outward bound automated emails to customers)
- The system forwards the email. Power Automate step to send the email to the desired inbox
As an extension to this I found I needed a way of capturing and monitoring the output of this decision, to enable a feedback loop for improvements. With that the other components are:
- Save the context (email and tools calls), LLM decision making, and output of each run. Power Automate step to capture all decisions and outputs at the start of the 2nd Power Automate flow that parses, gates and forwards emails. These outputs and decisions are sent to a SharePoint hosted excel spreadsheet
- A feedback loop that identifies and flags incorrectly forwarded emails. A button in the forwarded email that lets users report when the LLM made a wrong decision. The wrong-decision would be marked/saved against the excel spreadsheet list of decisions
Generalised Pattern Components
For this to work for any system or implementation, the core components needed are:
- Workflow Automation: Something that can interact with the delivery or task pipeline sufficiently to complete the task (e.g. can intercept, read and forward emails).
- The Agent: An LLM that can receive and act on requests
- Tools and Context Access: A secure and fail-safe way for that LLM to interact with relevant context and systems via tools
- Guardrails: that restrict and control how the output of the LLM interacts back with the workflow automation
- Measurement and Feedback: to enable measurement of effectiveness for iteration and improvement
Next posts will be a live demonstration of this model.