🌾 Inspiration: When 4 Hours Destroys a Harvest
In regional agricultural heartlands like the Salinas Valley, smallholder farmer cooperatives store their freshly harvested produce in community cold-storage chambers before regional distribution.
At 14:00 on a sweltering afternoon, a power surge trips the secondary cooling compressor in Chamber CR-4. Inside sit 14,200 kg of premium Roma tomatoes worth $9,230. The internal chamber temperature begins climbing from its safe 11.5°C up toward 18.2°C.
For perishable commodities like tomatoes, this is a crisis. Within 4 hours above 13.0°C, skin elasticity collapses, bacterial soft rot accelerates exponentially, and commercial value plummets toward zero.
In the traditional world:
- The breach is discovered hours or days later.
- Insurance adjusters take 3 to 6 weeks to inspect spoiled produce.
- Disagreements arise over whether the failure was mechanical or negligence.
- 14 tons of edible food end up in a landfill, and smallholder growers absorb catastrophic losses.
We asked: What if an autonomous AI agent could monitor cold rooms, verify breaches with zero human delay, calculate multi-destination salvage logistics in seconds, and pause execution behind a cryptographic Human-in-the-Loop gate so the cooperative manager retains complete control?
That is why we built PerishLock.
⚙️ What It Does
PerishLock is an autonomous cold-chain disruption defense and parametric salvage protocol:
- Dual-Sensor Telemetry Consensus: Continuously streams readings from dual calibrated IoT sensors (AHT20 Primary & SHT31 Secondary), enforcing an automated drift tolerance check ($|\Delta T| \le 1.5^\circ\text{C}$) to guarantee alerts are physically genuine.
- Deterministic Parametric Trigger: Mathematically tracks cumulative temperature breach duration. When sustained above 13.0°C for $\ge 240$ minutes, the zero-adjuster parametric policy triggers automatically.
- Cognitive Salvage Synthesis: Leverages the AWS Strands Agents SDK to parse messy, real-world receiver dock schedules, compute transit travel times, and calculate optimal split allocations across canneries, secondary markets, and local food banks.
- SHA-256 Merkle Evidence Vault: Cryptographically hashes 14 sensor and audit artifacts into an immutable Merkle tree stored under S3 Object Lock, providing banks and underwriters with zero-dispute proof.
- Anti-Replay Human-in-the-Loop Gate: The agent prepares options but pauses execution. Real-world dispatch orders and parametric payout releases require an authorized coordinator to sign a single-use HMAC token.
In our Salinas Valley benchmark:
- Option A (Commercial Max): Diverts 8,000 kg to cannery and 6,000 kg to dehydrators, netting $4,459.52 salvage.
- Option B (Community Food Relief): Diverts 4,500 kg (4.5 tons) to Hope Community Food Bank (feeding 1,800 local families) while securing a 95.0% guaranteed return for farmers.
- Net Farmer Realization: $8,768.50 recovered (95.0% value retention) vs a 100% total landfill loss.
🏗️ How We Built It: AWS Strands Agents SDK Deep Dive
PerishLock is architected around four core AWS Strands Agents SDK primitives and Amazon Bedrock AgentCore:
1. 11 Typed Domain Tools (@tool)
Rather than relying on ungrounded conversational text, our Strands agent executes its cognitive workflow through strictly typed domain tools:
load_incident_scope: Ingests policy limits, chamber ID, and member lots.get_sensor_evidence: Computes temperature percentiles and validates dual-probe drift.get_trigger_evaluation: Runs deterministic parametric threshold checking.get_weather_context: Ingests ambient regional heatwave data and mandatory reefer rules.find_eligible_partners&calculate_route_matrix: Evaluates regional processors, cold hubs, and food banks, calculating transit times and freight costs.prepare_response_options: Reconciles messy receiver constraints into mathematically optimized multi-destination salvage strategies.seal_incident_packet: Computes the SHA-256 Merkle tree root across all 14 evidence leaves.draft_claim_notice: Computes parametric yield-gap indemnification.request_coordinator_approval: Issues a single-use cryptographic approval token and halts execution.publish_sandbox_contact: Post-approval carrier and receiver dispatch.
2. Deterministic Lifecycle Hooks (HookProvider)
RateLimiterHook: InterceptsBeforeToolCallEventto track tool call velocity per turn, cutting off potential agent infinite loops at 25 calls.ColdRoomSafetyHook: Intercepts any call topublish_sandbox_contact. If a valid, non-mockapproval_idis missing, execution is halted immediately.
3. Dynamic Knowledge via AgentSkills
skills/fresh-tomatoes/SKILL.md: Encapsulates temperature-dependent decay kinetics ($Q_{10}$ coefficients), chill injury boundaries ($<10^\circ\text{C}$), skin softening rates, and USDA grade criteria. Loaded dynamically only when a tomato breach occurs.
4. Real-Time Trajectory Steering (SteeringHandler)
DispatchApprovalSteeringHandler: Inspects chronological tool calls usingLedgerProvider. If the agent attempts to finalize dispatch before preparing response options and requesting coordinator approval, the handler returnsGuide(...)instructing the agent to complete the approval workflow first.ToneGuardrailHandler: Steers post-model outputs to maintain cooperative empathy with stressed growers.
☁️ Amazon Bedrock AgentCore Integration
- AgentCore Memory Deployed Live in
us-east-1:- ARN:
arn:aws:bedrock-agentcore:us-east-1:226579698869:memory/perishlock_memory_demo-dG2s8s7mXm - Maintains persistent episodic memory across incidents, remembering receiver dock quirks, carrier reliability scores, and historical settlement precedents.
- ARN:
- Model Agility: Native support for Amazon Nova Pro (
amazon.nova-pro-v1:0) and Anthropic Claude 3.5 Sonnet on Amazon Bedrock.
🔒 Cryptographic Defense & Human-in-the-Loop Safety
- SHA-256 Merkle Evidence Manifest: Every telemetry series, validator log, partner quote, and policy event is hashed into a canonical Merkle tree. Any post-incident tampering with cold-room temperatures immediately breaks the cryptographic root hash.
- Anti-Replay Token Gate:
When the agent finishes calculating options, it issues a single-use HMAC token (
sec-tok-salinas-99a2c1). The coordinator must review the trade-offs on Mission Control and click "Authorize Dispatch". Once used, the token is permanently consumed and invalidated.
🚧 Challenges We Ran Into
- Semi-Structured Intake Data: Partner docks communicate via informal notes ("Shift B dock closes at 18:00 for boiler maintenance"). Combining Strands tools with trajectory steering enabled us to reliably convert informal scheduling notes into rigid freight constraints.
- Sensor Drift vs Physical Breach: Real cold rooms experience sensor calibration drift. We implemented cross-sensor differential checking ($|\Delta T| \le 1.5^\circ\text{C}$) to guarantee sensor failure never triggers false insurance claims.
- True Human Authority: Ensuring the AI agent never possesses autonomous dispatch authority over physical trucks or insurance funds.
🏆 Accomplishments That We're Proud Of
- Live AWS Bedrock AgentCore Memory Deployment: Successfully provisioned and integrated active AgentCore memory in
us-east-1. - 95.0% Value Recovery (Simulated): Rescuing $8,768.50 out of $9,230 in contracted value while saving 4.5 tons of food to feed 1,800 families.
- Auditable Architecture: Verified policy math; strict mathematical triggers paired with transparent human governance.
🔮 What's Next for PerishLock
- Direct IoT telemetry integration with reefer fleet telematics for dynamic in-transit rerouting.
- Implement various parts of the solution with real-time/live data for calibration and optimization
- Expansion to other perishables such as dairy, seafood, and vaccine cold-chain monitoring.
Built With
- amazon-bedrock
- amazon-bedrock-agentcore
- amazon-web-services
- fastapi
- iot
- next.js
- parametric-insurance
- python
- react
- sha-256
- strands-agents-sdk
- typescript
Log in or sign up for Devpost to join the conversation.