Background Tool Execution with LiveKit Agents

Hi,

Is it possible to execute a tool (for example, an API call or backend operation) in the background while the agent continues to handle ongoing user queries in real time?

More specifically, I’m trying to achieve a multitasking flow where:

  • A user request triggers a tool execution

  • The tool runs asynchronously (non-blocking)

  • Meanwhile, the agent continues the conversation with the user

  • Once the tool completes, the agent can return the result to the user

Does LiveKit provide built-in support or recommended patterns for this kind of concurrent tool execution within voice agents?

@darryncampbell adding you to check if this is possible

@sahil.dutta Not completely but partially.

Use an async function tool to start the operation, immediately acknowledge it, and keep state in session/context. When the task completes, inject the result back into the session and have the agent speak it.
This aligns with LiveKit’s long-running tool example - agents/examples/voice_agents/long_running_function.py at main · livekit/agents · GitHub

1 Like

+1 to the above response, but the team are also launching async tool calls, add AsyncToolset by longcw · Pull Request #5127 · livekit/agents · GitHub. We are very excited about this, so look out for the official release soon. :lk-launch:

1 Like

Thanks mate for your insights :raising_hands:

Where can I see the official release date ?

It’s not yet officially released, it will be in the next drop of Python agents, then Node.js support should follow soon after