A wandering trader spawned in my world. I started playing around with it, and I summoned a zombie. The llama spit at the zombie, but kept spitting after the zombie was killed.
Note that the llama stopped when I logged out and back in.
/summon trader_llama ~ ~ ~
/summon zombie ~ ~ ~
- Llama spits at zombie
- Zombie dies
- Llama continues spitting at nothing