elastic-agent-complete v8.14.1 was released to fix the issue you're experiencing: [Heartbeat] Move import to cmd for agentbeat by emilioalvap · Pull Request #39818 · elastic/beats · GitHub.
The error should go away if you upgrade to 8.14.1 or latter.
Hope that helps!