Where To Add Fallback Policy


I am trying to add fallback policy to agent. But I am am getting error as

load() got an unexpected keyword argument 'policies'

Here is my python script

import os
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.channels.channel import RestInput
from rasa_core.policies.fallback import FallbackPolicy
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.utils import EndpointConfig

fallback = FallbackPolicy(fallback_action_name="action_default_fallback",core_threshold=0.25,nlu_threshold=0.25)

nlu_interpreter = RasaNLUInterpreter('/home/stacy/myai/models/nlu/default/nlu')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent=Agent.load('/home/stacy/myai/models/dialogue', interpreter = nlu_interpreter , action_endpoint = action_endpoint, policies=[KerasPolicy(), fallback])
channel = RestInput()
agent.handle_channels([channel], http_port=5005, serve_forever=True )

Resolved, I had to use it while training core

i am unable to use fallback policy can you please help


  • name: FallbackPolicy nlu_threshold: 0.2 core_threshold: 0.2 fallback_action_name: my_fallback_action

domain file:- actions:

  • action_default_fallback

action.py from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher

class ActionFallback(Action):

def name(self) -> Text:
    return "action_default_fallback"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    dispatcher.utter_default("I did not understand what your saying")

    return []


facing same issue File “GenaricAgent/init.py”, line 60, in agent = Agent.load(data[“agent_store”]+“\agents\ChatbotGenricAgent.tar.gz”,action_endpoint=action_endpoint,tracker_store=db,policies=policies) TypeError: load() got an unexpected keyword argument ‘policies’