Weekend Creative Agent Challenge: LeadSentry
Childhood lead exposure is largely preventable, but prevention teams face a difficult allocation problem: there may be thousands of homes to consider and only enough time or funding to contact a small fraction of them. I built LeadSentry, a childhood lead-exposure risk triage agent that turns an address into an explainable risk assessment and a recommended next action.
Childhood lead exposure is largely preventable, but prevention teams face a difficult allocation problem: there may be thousands of homes to consider and only enough time or funding to contact a small fraction of them. A health department may already have testing programs, filters, outreach staff, and remediation partners. What it often lacks is a transparent way to decide where those limited resources should go first.
I built LeadSentry, a childhood lead-exposure risk triage agent that turns an address into an explainable risk assessment and a recommended next action. Instead of pretending to diagnose a child or confirm contamination, LeadSentry acts as a prioritization layer. It helps an operator decide whether an address belongs on a monitoring list, should receive a test kit, or warrants priority outreach.
The goal is captured by one question: which door should the team knock on first?
What LeadSentry does
LeadSentry combines physical-world and public demographic data rather than asking a language model to invent a risk score. For each address, it retrieves environmental context from Mireye, including nearby Superfund sites, brownfields, RCRA treatment and storage facilities, leaking underground storage tank signals, community water service coverage, and domestic-well density.
Mireye does not provide a year-built field, so I join its `tract_geoid` result to the US Census American Community Survey, Table B25034. This supplies the tract-level share of homes built before 1980, an important indicator for legacy lead-paint risk.
A deterministic scoring tool then calculates three components:
Component | Points | Data source |
|---|---|---|
Pre-1980 housing share | 0-50 | US Census ACS B25034 |
Legacy contamination | 0-30 | EPA-derived signals through Mireye |
Water service gap | 0-20 | EPA water service and well-density signals through Mireye |
The final score is classified as low (0-30), moderate (31-60), or priority (61-100). The agent reasons around that score instead of replacing it. It considers missing fields, location precision, and parcel-grade quality before assigning confidence and selecting an operational action. Every score component includes a human-readable reason and source.
The full command-line workflow supports a vendor-neutral LLM agent, deterministic offline fallback, ZIP-level screening, address deep dives, redacted public reports, and generated outreach artifacts. The AWS-hosted challenge endpoint intentionally runs a predictable demo configuration, allowing judges to evaluate the complete request, scoring, response, and persistence flow without requiring private third-party credentials.
How I built it
I started with the scoring rubric because explainability mattered more than model cleverness. The scorer is a pure TypeScript function with explicit weights and boundaries. That made it straightforward to test edge cases such as missing Census data, null environmental fields, distance thresholds, count boosts, and the exact boundaries between low, moderate, and priority bands.
Next, I wrapped the scorer with an agent workflow. Tools fetch Mireye data, look up Census housing age, calculate the score, and record an assessment. The agent can reason about confidence and choose an action, while a separate rule baseline makes disagreements visible. When no model key is available, the same pipeline still completes through deterministic offline triage.
I also added ZIP screening because sending every address through the expensive path would be wasteful. LeadSentry first ranks Census tracts, creates a canvassing plan, and only samples individual addresses in the highest-priority areas. This two-stage design treats API calls and staff attention as budgets rather than unlimited resources.
For AWS deployment, I avoided rewriting the application as a separate cloud-only implementation. I added a small API Gateway v2 Lambda handler around the existing scoring workflow. The handler validates that the request contains one address, returns clear 400, 405, or 500 responses, and passes valid requests into the existing LeadSentry service. Each completed assessment receives an ID and timestamp before being written to DynamoDB.
Testing locally first was valuable. AWS SAM and Docker let me run API Gateway, the Node.js 22 Lambda runtime, and DynamoDB Local before deploying. I added a swappable `DYNAMODB_ENDPOINT`, so local execution uses `host.docker.internal:8000`, while AWS leaves the endpoint blank and automatically uses the regional DynamoDB service.
Several practical challenges appeared during this process. DynamoDB Local could accept a TCP connection before it was ready to create a table, so I added bounded retries to the initialization script. The first Lambda bundle used ESM, but a bundled dependency dynamically required `node:https`; switching the SAM esbuild output to explicit CommonJS resolved the runtime error. On Windows, direct SAM sync commands could not find the project-local esbuild binary, so I routed build and sync commands through npm, which adds `node_modules/.bin` to `PATH`.
AWS architecture
The deployed request path is:
1. A client sends `POST /score` with an address.
2. An Amazon API Gateway HTTP API or Lambda Function URL invokes the function.
3. AWS Lambda runs the Node.js 22 LeadSentry scoring workflow.
4. The workflow returns the risk score, band, evidence, confidence, and recommended action.
5. Amazon DynamoDB stores the complete assessment for later review.

The infrastructure is defined in one AWS SAM template and deployed through AWS CloudFormation. SAM creates the Lambda function, HTTP API route, public Function URL, DynamoDB table, least-scope DynamoDB policy, and Lambda execution role. The public challenge endpoint uses
AuthType: NONE so it can be evaluated without an AWS account; authentication would be required before using the same endpoint for a production workload.AWS services used:
– AWS Lambda for serverless scoring
– Amazon API Gateway for the
POST /score HTTP route– Amazon DynamoDB for assessment persistence
– AWS CloudFormation through AWS SAM for repeatable infrastructure
– AWS IAM for Lambda execution and DynamoDB access



Validation and what I learned
A risk-ranking tool needs more than a polished demo. I compared LeadSentry’s ZIP scores with public childhood blood-lead outcomes from the New York State Department of Health. Across 26 ZIP codes in Erie County, the land-weighted mean score produced a Spearman correlation of 0.55 and a Pearson correlation of 0.44 with elevated blood-lead incidence per 1,000 children tested. That does not make the score a diagnosis, but it is encouraging evidence that the ranking captures a useful signal.
The project reinforced several lessons. First, an agent is more trustworthy when deterministic tools own calculations and the model owns interpretation. Second, missing data and geocoding precision are part of the result, not implementation details to hide. Third, a negative screen is valuable: deciding not to spend an address-level budget can be as useful as identifying a high-priority tract.
Finally, AWS SAM made the local-to-cloud boundary much smaller than I expected. The same handler, environment contract, and infrastructure template powered local Docker testing and the deployed AWS endpoint.
LeadSentry is not a substitute for environmental inspection, blood testing, or clinical judgment. It is a transparent triage assistant designed to help public-health teams focus scarce preventive resources sooner.
Try it and view the source
Example request:
curl -X POST \ https://re2lvepriq3f6ewmr7mpe6fagi0tzdya.lambda-url.us-east-1.on.aws/ \ -H "Content-Type: application/json" \ -d '{"address":"123 Main Rd, Buffalo, NY 14213"}'For the public demo, try the documented illustrative Buffalo address above. The response identifies the score as priority, explains the contributing evidence, recommends a test-kit dispatch, and records the assessment in DynamoDB.
Happy Developing!
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article