Why Rasa agent is not maintaining state of conversation for forms?

I have trained RASA for sample form data with multiple slots. The trained model for the forms is working in RASA shell,but when i loaded the same model in agent,agent is not maintaining the state of conversation

from rasa.core.agent import Agent
from rasa.utils.endpoints import EndpointConfig
from rasa.core.tracker_store import SQLTrackerStore,InMemoryTrackerStore
from rasa.shared.core.domain import Domain
from rasa.core.tracker_store import DialogueStateTracker
import asyncio

class Bot:
    def __init__(self, model_path, endpoint_url, domain,sender_id):
        endpoint = EndpointConfig(url=endpoint_url)
        tracker_store = InMemoryTrackerStore(max_event_history=100, domain=domain,sender_id=sender_id)
        self.agent = Agent.load(model_path, action_endpoint=endpoint, tracker_store=tracker_store, domain=domain)

    async def get_response(self, user_message, sender_id):
        parsed = await self.agent.parse_message(user_message)
        intent = parsed['intent']['name']
        confidence = parsed['intent']['confidence']
        response = await self.agent.handle_text(user_message,sender_id=sender_id)
        result = {'text': response, 'intent': intent,'Confidence':confidence}
    
        return result

async def main():
    domain = Domain.load("form_bot/domain.yml")
    endpoint_url = "http://localhost:5055/webhook"
    sender_id = "1234"
    bot = Bot("form_bot/models", endpoint_url, domain,sender_id)
    response = await bot.get_response("book a restaurant", sender_id)
    print(response)
    
   
asyncio.run(main())

What could be the issue in my code ,why agent is forgetting the events and not maintaining the state of conversation ?

Can you confirm that you are loading the full model and not just nlu? I would also compare the debug output from the shell vs. agent.