How to access tracker object?

I want to look at the tracker object to get a better understanding and also to use it in python. For this I inserted ipdb.set_trace() statements in the retrieve function in

Further, I did a make install to update the changes. But running rasa debug now, gives me the error below.

Is there any alternate way to get the tracker object?

========================================================================== Bot loaded. Type a message and press enter (use ‘/stop’ to exit): Your input → hi

/Users/samarthaggarwal/wavicle/rasa/rasa/core/ 244 → 245 if sender_id in 246 logger.debug(f"Recreating tracker for id ‘{sender_id}’")

ipdb> 2020-05-06 16:37:36.390 python[62973:1666181] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future. 2020-05-06 16:37:36.390 python[62973:1666181] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /AppleInternal/BuildRoot/Library/Caches/ 2020-05-06 16:37:36.397 python[62973:1666181] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /AppleInternal/BuildRoot/Library/Caches/ 2020-05-06 16:37:36.398 python[62973:1666181] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.’ *** First throw call stack: ( 0 CoreFoundation 0x00007fff32471d07 __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff6b1955bf objc_exception_throw + 48 2 CoreFoundation 0x00007fff3249aec8 +[NSException raise:format:arguments:] + 88 3 Foundation 0x00007fff34b85f3d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 Foundation 0x00007fff34ac26ce +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 440 5 AppKit 0x00007fff2f6632bc -[NSApplication run] + 864 6 libffi.6.dylib 0x000000010bdb6884 ffi_call_unix64 + 76 7 ??? 0x0000700016346840 0x0 + 123145674844224 ) libc++abi.dylib: terminating with uncaught exception of type NSException [1] 62973 abort rasa shell --debug


Hello @samarthaggarwal,

I don’t think it’s necessary to do this, if you run RASA with --debug it already writes it to the console, like below.

2020-05-06 10:36:06 DEBUG rasa.core.policies.memoization - Current tracker state [None, {}, {‘prev_action_session_start’: 1.0}, {‘prev_action_listen’: 1.0, ‘intent_greet’: 1.0}, {‘prev_utter_greet’: 1.0, ‘intent_greet’: 1.0}]

2020-05-06 10:36:06 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {‘prev_utter_greet’: 1.0}]


Thanks for answering Leonardo! I have a followup on that.

The --debug only prints that present state but there are a lot of other things in the tracker object. I want to access the tracker object because I want to pass it to a third party application that will do some processing on top of it. Is there a way to do that?

Hello @samarthaggarwal,

you could build a Custom Tracker Store



There are 2 ways to achieve what you want to do. The first one is to set up an HTTP API for your Rasa server, then you can retrieve the tracker object by requesting it through the API.

The second one is to do it fully in python. You need to define your own Agent from rasa.core.agent, load your model into your Agent, the access the tracker object from Agent.tracker_store.retrieve("sender_id")

If you only care about the latest state of the tracker, another option is to create custom action for anything and output the tracker state in every custom action by using custom json message in dispatcher.