Skip to content

Instructional Prompt – Z-Agent Architecture Refactor to Class Inheritance

Objective

Refactor the Z-Agent architecture from the current code-plugin / function-factory pattern to an Object-Oriented class inheritance pattern. The goal is to:

  • Maintain a type-consistent Service_Plan class with an agent_pool (array of agents).
  • Each agent performs a specific function (e.g., payment status check, service quota management).
  • Agents share COMMON fields from Service_Plan and also have agent-specific parameters and state.
  • Persist configuration in a stable schema (type, name, version, params) without changes when new agent types are introduced.
  • Support clean instantiation from persisted configuration at runtime via a registry.
  • Preserve strong typing inside each agent class without forcing Service_Plan to know each agent’s internal types.

Persisted Schema (unchanged)

We store the service plan configuration in JSON/YAML using a stable structure:

```json { "planId": "SP-123", "common": { "ownerId": "U-42", "tariff": "X" }, "agents": [ { "type": "credit", "name": "Credit PH 2025", "version": "1.0.0", "params": { "hardLimit": 1000 } }, { "type": "quota", "name": "Daily Quota", "version": "2.1.0", "params": { "daily": 50 } } ] }