PROJECT 03 / Agentic AI & workflow automation
Maintenance Triage Agent.
Intelligent automation with human control.
A stateful AI workflow combining multi-format document processing, LLM-driven tool selection, deterministic approval policies and persistent human review.
THE COMPILED LANGGRAPH
ONE LANGFUSE TRACE, TWO INVOCATIONS
³ The count includes four legacy router tests. External CRM and risk-alert actions are simulated; this is not a commercial deployment and no decision-accuracy claim is made.
01 / OVERVIEW
Automation needs a place to pause.
The Maintenance Triage Agent is an engineering prototype adapted from a rule-based document classifier (originally called Multi-Format AI System). It accepts email, JSON and PDF inputs, rejects unsupported formats, extracts fields per format, and runs them through a LangGraph StateGraph.
A Groq-backed critic assesses intent and confidence. The workflow then either selects a tool or pauses for a person. Downstream actions, post_to_crm and post_risk_alert, are simulated: there is no real vendor dispatch, notification or CRM.
02 / THE PROBLEM
Not every model decision should become an action.
Real inputs arrive in different shapes, and a confident model can still be wrong about money. The question was how to let a model do the interpretation while keeping approval rules explicit and keeping a paused decision alive until a human answers it, even across a connection boundary.
FastAPI serves a Jinja-rendered interface at GET /ui. The captures below use Swagger UI to show the requests and responses for processing a file and reviewing a thread.
03 / ARCHITECTURE
Classify. Review. Act.
Input is classified as email, JSON, PDF or unsupported, and handled by a format-specific agent. All paths converge at a critic that assesses intent and confidence. A deterministic cost gate or low confidence sends the item to human review, which is checkpointed in PostgreSQL by thread ID. Approval resumes toward tool selection. Rejection returns to the critic with feedback. Tool calling runs a simulated CRM post or risk alert.
Every execution is traced in Langfuse. One request that pauses and later resumes appears as two graph invocations inside a single trace.
04 / DECISIONS & TRADE-OFFS
Intelligence with explicit controls.
A deterministic cost gate, separate from model confidence.
An invoice whose extracted amount is strictly greater than $10,000, or any low-confidence result, goes to review. High confidence alone cannot bypass a successfully extracted cost.
Trade-off. A rule is only as good as its input: if the amount is not extracted, the gate cannot fire.
Persist the pause.
Human review is a stateful boundary checkpointed with PostgreSQL AsyncPostgresSaver, keyed by thread ID, not a transient confirmation in a browser.
Trade-off. Persistence adds a database dependency and a review queue that someone must watch.
Reject means “think again”, not “stop”.
Rejection returns the item to the critic with the reviewer's feedback so intent can be revised.
Trade-off. There is currently no terminal rejection state, so a rejected thread can remain pending.
Simulate downstream effects.
Tool calls record what would happen without contacting any external system.
Trade-off. It keeps the prototype safe, but proves nothing about a real integration.
05 / DEBUGGING
Inspect the path, not only the output.
An action branch that could never fire. Live testing found an action branch that was unreachable. The JSON capture below now completes with a simulated risk alert when a complaint note mentions compliance and fraud.
Completed threads had to be reviewable. Retrieving a review for a thread that had already finished needed handling, as did correlating the initial and resumed runs of one thread in a single trace.
06 / TESTING & EVALUATION
A bounded test result.
18 tests pass, including 4 legacy router tests, with one PyPDF2 deprecation warning. They include a test that an interrupt survives a genuinely fresh database connection.
The review lifecycle below was demonstrated with real calls. A $12,500 invoice stops at pending_review; the same thread is retrieved and approved; a separate thread is rejected with feedback.
- 01
Cost gate
$12,500 exceeds the $10,000 threshold, so the invoice pauses as cost_threshold_exceeded.
- 02
Same thread retrieved
GET /review returns the same pending state by thread ID.
- 03
Approved
POST approved: true resumes the workflow and completes with a simulated risk alert.
- 04
Rejected
A separate thread revises intent to “request revised quote” and stays pending.
WHAT THIS DOES NOT SHOW
Restart recovery is documented historically; the captures show same-thread retrieval, not a process restart. There is no decision-accuracy evaluation, cost-saving claim or real integration.
07 / DEPLOYMENT
Source available. No public deployment.
The repository is available for technical review and its stack includes Docker. No public deployment or live demo is presented, and none should be inferred.
08 / LIMITATIONS
A workflow project, not a dispatch service.
- Cost-gate reliability depends on amount extraction. A narrow invoice regex or a missing amount may let an item bypass the gate, and costs inside nested JSON are not normalised.
- External CRM and risk-alert actions are simulated.
- There is no reviewer authentication, and domain adaptation for maintenance is incomplete.
- A rejection loop can leave a thread pending indefinitely, and strict model-output validation is still needed.
- There is no broad decision-quality evaluation, and PyPDF2 is deprecated.
09 / NEXT STEPS
What I would do next.
- More robust amount extraction, with a fail-safe that sends missing amounts to review.
- An explicit terminal rejection state, and authentication for reviewers.
- Real integrations behind the simulated tools, and a broader evaluation of routing decisions.
These are planned improvements, not completed work.
Read the source and documentation on GitHubWORK WITH ME
Need something like this built?
I take on focused tasks as well as larger implementations. Tell me what you are trying to build.
06GET IN TOUCH
Let's build something
that works.
Open to full-time engineering roles. Relocation across India is fine.
View résuméFocused tasks or full builds. Tell me what you are trying to ship.
See what I can build