Inspiration

Sri Lanka's SME pharmacy sector loses an estimated LKR 4.06 billion a year to stock wastage, and 45.4% of patients face medicine non-availability — not from a lack of data, but from demg tens of percent away from actual consumption undermanual, phone-and-spreadsheet procurement (Asian Development Bank, 2025).

We weren't guessing at this problem. Members of our teamloyed two real ERP platforms into the Sri Lankan pharmacy sector — one a full inventory/POS/forecasting system with a live ML engine, the other a broader procurement–finance–HR–legal operational suite built for HackELITE 2.0. That firsthand experience — watching real pharmacy owners fight the same stockouts, wastage, and compliance gaps the ADB later quantified — is where this idea came from. NeuroX 1.0's framing, agency over augmentation, gave us the reason to design something neither prior platform had: a network of agents that acts on that operational knowledge instead of just displaying it.


What it does

PharmaCore ERP is a newly designed network of eleven specialised agents, purpose-built for this hackathon, each scoped to one operational module and sharing a single Agent Layer, Tool Registry,

  • Inventory Intelligence — cross-branch stock-risk reasoning, autonomous reorder-point triggering
  • Procurement & Restocking — queries every distributor API at once, ranks by price/lead-time/reliability, drafts a purchase order
  • Expiry & Liquidation — flags near-expiry batches w/liquidation offers
  • Demand Forecasting — converts ML forecast output into goals the other agents act on
  • Financial Reconciliation — audits invoice line itedrafts disputes
  • Regulatory Compliance — tracks controlled-substance thresholds, drafts (never submits) filings
  • Fraud & Loss-Prevention — detects drift between POrfaces evidence
  • Contract Intelligence — tracks distributor contract renewal windows, drafts amendments
  • Workforce Compliance — tracks staff licence and statutory filing deadlines
  • Branch Optimization — recommends inter-branch stoc
  • Executive Assistant — synthesises a daily/weekly KPI briefing from every other agent's outcome log

Every agent runs the same loop: perceive → reason → act through a tool → handle ambiguity → check risk → pause for a human when the action is high-stakes → execute → log.

Nothing here talks to, dispenses to, or advises an indiv a business or institutional party — distributor,regulator, branch, staff — by design, to stay strictly inside NeuroX's B2B scope.


How we built it

The agent architecture in this submission is new work, designed specifically for NeuroX Phase 1 — the Agent Layer, Tool Registry, Human-Control Gateway, and all eleven agents' reasoning loops did not exist before this hackathon.

What we brought in was knowledge, not code: our team'sd operating two real pharmacy platforms — SmartERP /pharmacy-erp (Next.js, Prisma, PostgreSQL, a live XGBoost forecasting service) and CoreERP / PharmaCoreERP (React, Node/Express, Firebase, built for HackELITE 2.0) — told us exactly whi actually struggles with, which data those systemsalready capture, and which external touchpoints (distributors, regulators, logistics) are real rather than assumed. We used that grounding to design a realistic modular monolith — Agent Layer, T one deployable unit to remove network latency from every agent's reasoning loop, with module boundaries still enforced in code — containerised behind a load balancer with rolling deployment, and an offline-first PWA client that queues pending approvals l

We mapped six external B2B tools the agents call through a shared registry:

  1. Wholesale Supplier API
  2. Regulatory Filing API
  3. Communication API
  4. B2B Liquidation Marketplace API
  5. Logistics / Transfer API
  6. Invoice / Payment Gateway API

We then wrote out, agent by agent, the full perceive → reason → act → handle-error → check-risk → pause-for-human → execute → log cycle, using the Procurement & Restocking Agent as the fully worked example in our report.


Challenges we ran into

  • Designing new agent logic without leaning on old code. It would have been easy to describe the agents in terms of features our existing platforms already had. Instead, we had to design genuineambiguity handling, error recovery, risk thresholds —that neither platform's codebase actually implements yet.
  • Making the human checkpoint real, not decorative. s across eleven agents carry enough financial,contractual, or regulatory weight to deserve one, without turning the owner into a rubber stamp. We settled on five: high-value POs, invoice disputes, regulatory filings, liquidation offers, and fraud escalations, each with a genuine reject → feedback loop.
  • Keeping the scope strictly B2B. Several natural idription chat) were explicitly out of scope under NeuroX's rules, which forced sharper thinking about the real automatable judgment calls — invoice disputes, distributor negotiation, compliance filings — rather than the more obvious patient-facing angle.
  • Forecast credibility. Getting the ML engine's error rate down from a 64–191% manual baseline to a double-digit MAPE, and being precise about exactly which number we stand behind.

Accomplishments that we're proud of

  • A newly designed eleven-agent system, grounded in real operational insight from two platforms we've actually built and deployed — not a guess at what pharmacies need.
  • A field-tested ML forecasting engine already beating the ADB's reported manual-baseline error by a wide margin.
  • Every agent sharing one reasoning loop, one tool registry, and one human-control gateway — not eleven bolted-on scripts.
  • A concrete Solution Matching table tying every cited ADB statistic to a specific agent and a specific target outcome, so the value proposition isn't abstract.

What we learned

The hardest design problem in agentic B2B software isn'tit's deciding, module by module, exactly where autonomyshould stop. A dashboard fails by being ignored; an agent that's too autonomous fails by acting on a bad judgment call with real money or regulatory exposure behind it. Proportional autonomy — letting a single-branch pharmacy and a ten-branch chain each set their own risk threshold — turned out to matter more than any individua


What's next for PharmaCore ERP

Phase 2 is implementation: wiring the newly designed Ageto our existing SmartERP/CoreERP codebases, starting with the Procurement & Restocking Agent end-to-end against a sandboxed distributor API, then the Expiry & Liquidation and Financial Reconciliation agents. We'll run the onboarding flow's "shadow mode" internally first — logging what each agent would do against our own historical databefore it's allowed to act — before demoing live agent execution with real human-control-point approvals.

Built With

Share this project:

Updates

Submission history