Skip to content

[IMP][P1] Hourly tracking: env-gated Postgres read tools #24

Description

@mishrapravin114

Type

Implementation — merge a PR with working code. Not investigation.

Goal

Replace hardcoded mock data in hourly_tracking/tools.py with env-gated read-only Postgres queries for finance pilot demos.

Files to change

examples/templates/hourly_tracking/tools.py ← UPDATE
examples/templates/hourly_tracking/.env.example ← NEW
examples/templates/hourly_tracking/README.md ← UPDATE (Production wiring section)

Implementation checklist

  • When HOURLY_TRACKING_USE_LIVE=1 and CLIENT_DB_URL set: run read-only SQL for broker + investor feeds
  • When unset: keep current mock behavior (CI + demos still work)
  • Use stdlib or existing deps only — do not add new dependencies without approval
  • Parameterized queries only; no string interpolation of user input
  • ./engine validate examples/templates/hourly_tracking passes
  • ./engine run examples/templates/hourly_tracking --input '{}' works with mocks

SQL sketch (implement in tools.py)

-- broker transactions last hour (read-only user)
SELECT transaction_id, broker_id, investor_id, input_amount, output_amount, fees
FROM broker_transactions
WHERE created_at > now() - interval '1 hour';

Done when

  • PR merged
  • README shows mock vs live toggle
  • .env.example documents CLIENT_DB_URL, HOURLY_TRACKING_USE_LIVE

Out of scope

  • Client-specific schema migration
  • Write access to client DB

Related (context only)

#15 Section 2.4 hourly_tracking example · Closed #2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestphase-1Phase 1 — pilot / GTMpriority-p1P1 — high / next after P0type-agentVertical agent template

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions