building flexible AI agents