#311 — Create application filler agent graph

Repo: Twill-AI/twill-llm-engine State: closed | Status: done Assignee: meliascosta

Created: 2025-09-07 · Updated: 2025-09-29

Description

Caused by: https://twillpayments.atlassian.net/wiki/spaces/TD/pages/431915009/AI+powered+document+processing

In order to support the automatic filling of a merchant application from a group of files + text. We need to create a minimalistic agent to support the MVP version described in the confluence page. The agent should take as input a list of documents (PDF, PNG, JPG) and a blob of text. It should output a JSON object with a filled out application

AC:

  • A new module application_extractor.py has been added to twill_llm_engine/graphs
  • A new graph has been defined in the application_extractor.py module that holds the logic to run the agent
  • The graph uses a structured output approach based on the JSON defined in https://github.com/Twill-AI/twill-ai-ui/issues/685
  • Prompts necessary to generate a filled out application have been written and tested
  • There is a correction loop in the agent’s graph that validates the created application with Pay Engine. The graph should receive the pay engine proxy object as part of the config to be able to run that validation.
  • The graph returns not only the actual values from the application but it returns a confidence level for each entry as well.
  • The graphs logic has been covered by unit tests

Example output: UPDATE: adding confidence feature was removed:

{
  "name": {"value": "Test Merchant", "confidence": 100},
  "fee_config_id": {"value": 1, "confidence": 100},
  "business_country": 
 
## Notes
 
_Add implementation notes, blockers, and context here_
 
## Related
 
_Add wikilinks to related people, meetings, or other tickets_