Cyber-Physical Systems (CPS) combine computational and physical elements, whose inherent complexity continues to motivate research on rigorous and repeatable engineering methods. This paper presents an agent-oriented Model-Driven Development for Cyber-Physical Systems (MDD4CPS) process that ensures end-to-end traceability from high-level intentions to executable code. The proposed approach integrates agent orientation at the Computation-Independent Model (CIM) stage and formalises its transformation through a domain-specific language (DSL) into Platform-Independent (PIM) and Platform-Specific (PSM) models. A formal metamodel defines the DSL structure, notation, and semantics, providing a foundation for consistency and transformation automation across stages. The process is supported by a tool integrated with the web-based modelling platform diagrams.net, enabling automated model-to-model and model-to-code transformations. Its feasibility is demonstrated through a proof of concept applied to greenhouse automation, where the generated software is deployed on Arduino-based units to validate communication and control among sensors and actuators. The proof of concept demonstrates the feasibility of the proposed agent-oriented MDD approach and illustrates how traceability can be preserved from conceptual design to physical execution.