[Custom Component] Fallback Conversation Agent: Use multiple conversation agents with a single Assist

I have seen many times people saying they wish they could control their devices with the built in conversation agent in Home Assistant, but then forward other requests to ChatGPT (for example), and after not seeing anyone else do it, I decided to dip my toes into writing my first ever Home Assistant custom component: Fallback Conversation Agent.

Here’s an example of it in use (with some debugging enabled to make it clear):
Screenshot 2024-02-11 at 7.50.10 PM

Features

This custom component allows you to use two conversation agents, falling back if your primary agent fails to handle the intent.

An example use case of this is to use the built-in Home Assistant conversation agent to handle manipulating devices, but then fallback to using ChatGPT for example to handle general questions such as the capital of a country or measurement conversions.

The options provide 3 debug levels:

  • No Debug: This silently handles fallback, and pipes back the raw response to you.
  • Low Debug: This will add information such as what agent is responding to the response. This way you can determine if fallback is working as you expect.
  • Verbose Debug: Will provide you with more information, including the error of the previous response.

For now, this only allows a primary and a fallback conversation agent, but I do plan on adding the ability to have a list so you can specify as many as you’d like, but I figured I’d let people have access to it in the meantime, and get some feedback.

Installation

  1. Install via registering as a custom repository of HACS or by copying the fallback_conversation folder into <config>/custom_components.
  2. Restart Home Assistant.
  3. Go to Settings > Devices & Services.
  4. In the bottom right corner, select the Add Integration button.
  5. Set a name and your preferred debug level.
  6. Click on Fallback Conversation Agent and select Configure on your created agent.
  7. Set the primary and fallback conversations agents from the list.
  8. Go to Settings > Voice Assistants.
  9. Click to edit Assistant (named “Home Assistant” by default).
  10. Select the name of your Fallback Conversation Agent from the “Conversation agent” tab
8 Likes

This is exactly what I was looking for, nice work. Best of both worlds

1 Like

Thank you so much. This is very useful.

1 Like

tyvm for this awesome intigration and i hope you continue your work :wink:

Can we have this but with local ollama assistant?

I love this. It is exactly what I am looking for but I either don’t understand how to use it or it is broken in 2024.8

The most recent update (to v1.1.0) of this Integration mentioned that we would need to go back into the Integration settings menu of HA, hit ‘configure’, then ‘submit’.

I’ve done that but get this error in the log:

This error originated from a custom integration.

Logger: custom_components.fallback_conversation
Source: custom_components/fallback_conversation/init.py:43
integration: Fallback Conversation Agent (documentation, issues)
First occurred: 13:01:18 (1 occurrences)
Last logged: 13:01:18

Cannot upgrade models that were created prior to v0.3. Please delete and re-create them.

I’m not sure what model it is referring to since the voice model is not part of this integration… I must be missing something here.

Wow this is amazing. Great job.