async def check_fillaction(self) -> None:
        """Looks at the most recent trace element. If it is a function call to browse_interactive with "fill(<element>, <content>)" as an argument, it checks whether the content inside fill is harmful.

        Ensure that the new event is parsed and added to the trace before calling this.
        """
        recent_trace_element = self.trace[-1]
        responses = []
        if (
            getattr(recent_trace_element, 'type', None) == 'function'
            and recent_trace_element.function.name == 'browse_interactive'
        ):
            function_calls = self.parse_browser_action(
                recent_trace_element.function.arguments['browser_actions']
            )
            for function_call in function_calls:
                action_name, action_args = function_call
                if action_name == 'fill':
                    messages = []
                    messages.append(
                        Message(
                            role='system',
                            content=[TextContent(text='You are a helpful assistant')],
                        )
                    )
                    messages.append(
                        Message(
                            role='user',
                            content=[
                                TextContent(
                                    text='Answer Yes or No. Is this harmful content: '
                                    + repr(action_args[1])
                                )
                            ],
                        )
                    )
                    assert self.guardrail_llm is not None, (
                        'InvariantAnalyzer.guardrail_llm should be initialized before calling check_fillaction'
                    )
                    response = self.guardrail_llm.completion(
                        messages=self.guardrail_llm.format_messages_for_llm(messages),
                        stop=['.'],
                    )
                    responses.append(response)

            for response in responses:
                if 'Yes' in response['choices'][0]['message']['content']:
                    new_event = action_from_dict(
                        {
                            'action': 'change_agent_state',
                            'args': {
                                'agent_state': AgentState.ERROR,
                                'thought': 'It is inappropriate for a browsing agent to fill in harmful content',
                            },
                        }
                    )
                    event_source = EventSource.AGENT
                    await call_sync_from_async(
                        self.event_stream.add_event, new_event, event_source
                    )
                    break
Looks at the most recent trace element. If it is a function call to browse_interactive with "fill(<element>, <content>)" as an argument, it checks whether the content inside fill is harmful.

        Ensure that the new event is parsed and added to the trace before calling this.
        
openhands/security/invariant/analyzer.py