Foundations of Agentic AI: Components, Workflows, and Safety