diff --git a/src/dfcx_scrapi/core/agents.py b/src/dfcx_scrapi/core/agents.py index 7e441528..a6b855db 100644 --- a/src/dfcx_scrapi/core/agents.py +++ b/src/dfcx_scrapi/core/agents.py @@ -505,20 +505,21 @@ def update_agent( return response @scrapi_base.api_call_counter_decorator - def delete_agent(self, agent_id: str) -> str: + def delete_agent(self, agent_id: str = None, obj: types.Agent = None): """Deletes the specified Dialogflow CX Agent. Args: agent_id: CX Agent ID string in the following format projects//locations//agents/ - - Returns: - String "Agent '(agent_id)' successfully deleted." + obj: (Optional) a CX Agent object of types.Agent """ + if not agent_id: + agent_id = self.agent_id + + if obj: + agent_id = obj.name + client_options = self._set_region(agent_id) client = services.agents.AgentsClient( - credentials=self.creds, client_options=client_options - ) + credentials=self.creds, client_options=client_options) client.delete_agent(name=agent_id) - - return "Agent '{agent_id}' successfully deleted."