How does function tool generate a custom event and return a value at the same time?

If I use the non_async function tool, I can’t get the custom event on the frontend; if I use the async function tool, the agent can’t get the return value. Is there any way for the frontend to receive the custom event and for the agent to get the return value?