'messages' have to be a list of message of type HumanMessage/AIMessage/SystemMessage/ToolMessage. You can prepend the context (assuming it's a string) as a SystemMessage to your existing message list and then invoke.
llm.invoke([SystemMessage(content=context)] + existing_messages)