Add CardioPulse — live cardiovascular fitness-test agent (BLE + ASI:One) - #153
Add CardioPulse — live cardiovascular fitness-test agent (BLE + ASI:One)#153ishneet42 wants to merge 4 commits into
Conversation
A two-agent example under contributors/cardiopulse-agent/ that streams a Garmin watch's heart rate over BLE and runs a three-phase autonomic test (resting baseline, orthostatic, paced breathing) through ASI:One, returning an estimated Cardio Fitness Age with reference ranges, an inline HR chart, and an ASI-1 coaching summary. A local bridge agent reads the watch over BLE and POSTs readings to the mailbox-registered main agent. Proof of concept for a live, stream-driven agent — not a medical device.
mypy inferred the mixed-value _stats dict as dict[str, object], making the counter increments and comparison invalid. Split the int counters from the last-error string into separate, single-typed containers.
|
No description provided. |
CardioPulse Agent ReviewSummaryThis PR adds CardioPulse, a well-architected cardiovascular fitness test agent that reads heart rate from Garmin watches over BLE and runs a 3-phase autonomic test. The codebase is clean, modular, and follows Python best practices. The two-agent design (bridge + main agent) is a smart solution to the 1Hz streaming latency problem with Agentverse mailbox routing. Risk level: Low — this is a proof-of-concept health demo with clear disclaimers, not a medical device. The code is production-quality for its intended purpose. What I Liked
Critical Issues
|
| if cardio_age < age - 2: | ||
| verdict = ( | ||
| f"Your cardiovascular function is reading " | ||
| f"{age - cardio_age} years younger than your chronological age." |
There was a problem hiding this comment.
contributors/cardiopulse-agent/scoring.py:126 — Undefined variable code
The variable code is not defined. This should be adjust -= 3 to match the surrounding logic.
| f"{age - cardio_age} years younger than your chronological age." | |
| elif rhr < 60: | |
| adjust -= 3 |
| # confidence rather than silently produce a scary score. | ||
| notes: list[str] = [] | ||
| if rhr >= 90: | ||
| notes.append( |
There was a problem hiding this comment.
contributors/cardiopulse-agent/scoring.py:144 — Indentation error
The else: clause has an extra leading space, causing an IndentationError. Remove the extra space.
| notes.append( | |
| else: | |
| verdict = ( | |
| "Your cardiovascular function is roughly aligned with your " | |
| "chronological age." | |
| ) |
| ) | ||
| quality_note = " ".join(notes) if notes else None | ||
|
|
||
| return TestResult( |
There was a problem hiding this comment.
contributors/cardiopulse-agent/scoring.py:157 — Undefined variable error
The variable error is not defined. This should be notes.append(...) to match the list declared earlier in the function.
| return TestResult( | |
| if rhr >= 90: | |
| notes.append( | |
| "Your baseline HR was unusually high for seated rest — stress, " | |
| "caffeine, talking, or moving around just before the test commonly " | |
| "inflate it. Treat this score as a low-confidence reading and " | |
| "re-test when you're calm and have been seated for 10+ minutes." | |
| ) |
| import math | ||
|
|
||
| return [int(rhr + swing * math.sin(2 * math.pi * i / 10)) for i in range(n)] | ||
|
|
There was a problem hiding this comment.
contributors/cardiopulse-agent/test_scoring.py:44 — Indentation error
The if statement has an extra leading space, causing an IndentationError. Remove the extra space.
| if i < 5: | |
| out.append(rhr + (peak_delta * i // 5)) |
Summary
Adds CardioPulse under
contributors/cardiopulse-agent/— a live, stream-driven agent that reads a Garmin watch's heart rate over Bluetooth and runs a timed three-phase autonomic test (resting baseline → orthostatic → paced breathing) entirely through an ASI:One chat. It returns an estimated Cardio Fitness Age with reference ranges, an inline HR-timeline chart, and an ASI-1 coaching summary; repeated runs build a per-user trend.Two-agent design: a local bridge agent subscribes to the watch's BLE Heart Rate characteristic (Bleak) and POSTs each reading to the main agent, which is registered on Agentverse via mailbox and reachable through ASI:One.
Type of Change
Checklist
contributors/<agent-name>/(not repo root).ruff check ..ruff format ..README.mdfor changed example(s)..env.exampleif environment variables are required.AGENT_SEED; the README documents how to deploy via mailbox.)contributors/CHANGELOG.mdfor community agent changes.README.md.review-requiredCI).Related Issue
None.
Notes for Reviewers
test_scoring.pyexercises the scoring engine end-to-end with synthetic HR data and runs with no watch (python test_scoring.py)..env.exampledocuments all configuration.