### Core Engine Responsibilities. [[Siva]] ##### To keep 1. Maintain memory array to send to the llm 2. isProcessing so that multi thread cant happen and mess up the memor? 3. call handlers, and update state changes due to them 1. state machine state change 2. iterations of calling llm 3. current code 4. current action 5. curent reason 6. sandboxid 7. Basically the ChatSessionState object 4. Emit Events, of whats going on inside, like waiting for user input etc 1. Most times events are emitted before integrations are called 5. Then finally save the state ##### To Remove 1. Integrations, (_because it telling to save the message_) 1. like ports.integrations.saveUserMessage('USER_INPUT', userInput.text) 2. charlie says keep it as ask only, remaining moves out and listens to the emitted events 2. The entire logic in handleAwaitMcpReAuthenticate has nothing with llm or e2b or state change or anything. Let's consider removing this from the engine. 3. The UI should have connection to cf worker backend for mcp logic 4. ##### Comments 1. ![Screenshot 2025 08 28 at 7.06.37 PM](https://img.codeanand.com/2025/08/28/Screenshot%202025-08-28%20at%207.06.37%20PM.png) 2. in the above screenshot, the agent is informing the integration on the input it was passed to it. that does not make sense 3. saveSystemMessage, Max iterations reached. 4.