In reply to siddu Angadi:
Does c.print() work correctly? Can you try the following?
assert(testenv#(`a)::get_type == c.get_object_type());
If that fails, then you have incompatible types that cannot be cast.
We need to see the code used to declare and construct “testenv” inside your agent. The parameter types need to match coming from the same package).