Document AI · Fertilizer & Clean Ammonia (Enterprise)
Plant Operations Email to Metrics Agent
Extraction agent parsing free form daily plant status emails into a fixed 24 field JSON schema for operations reporting, validated against a purpose built 50 sample golden dataset.
- Role
- AI Engineer
- Designed the extraction schema and agent instructions, and built the evaluation dataset and loop.
- Industry
- Fertilizer & Clean Ammonia (Enterprise)
- Timeline
- Delivered
Business impact
- fields extracted
- 24
- evaluation samples
- 50
- failure categories
- 9
- cadence
- Daily
Overview
Built an agent that reads the daily operations status email from a fertilizer production plant and returns a strictly structured JSON object covering production, inventory, staffing, gas, bagging and logistics.
The email arrives as free form prose, sometimes tabular, with inconsistent formatting and frequently missing sections. The agent maps it to a fixed schema, normalizes number formats, distinguishes a genuine zero from missing data, and returns null rather than an estimate. It was validated with a 50 sample evaluation dataset covering the real failure surface, not the happy path.
Technical architecture
- Source
- Daily plant operations status email in free form prose, sometimes tabular
- Agent
- Azure AI Foundry agent with a locked system instruction and a JSON output schema
- Contract
- 24 field schema with per field type and unit definitions and explicit null semantics
- Evaluation
- Golden dataset run through Foundry agent evaluation, structured by failure category
- Sink
- Structured JSON into the operations reporting workbook
Key features
- Fixed 24 field output contract covering production rates, inventory, staffing, gas and bagging
- No invention - anything absent or marked not available returns null, never an estimate
- Genuine zero versus missing distinction, because zero means a shutdown rather than a gap
- Number normalization stripping units, separators and percent signs to plain numeric values
- Strict typing so numeric fields never return strings and field names never vary
- Bounded derivation - arithmetic only for the two fields whose definitions require it
- Multi location inventory tracked separately across site, staging and port
- 50 sample golden dataset in evaluation format with every field present in every ground truth record
Challenges solved
- Free form input against a rigid output - the schema absorbs the variation, not the downstream report
- Zero is not missing - a shutdown day and a missing section look similar to a model but mean opposite things
- Models like to be helpful, so estimation and interpolation are explicitly forbidden outside two named fields
- Proving it works by enumerating the failure surface into 50 labelled samples rather than eyeballing a few emails
Tech stack
- Azure AI Foundry Agent Service
- Azure OpenAI
- Structured Outputs
- Foundry Evaluation
- Python
- Microsoft 365
- JSON Schema