Passing is_active via agent config or using uvm_agent built in?

The example agent on this page (which extends uvm_component not uvm_agent) uses the agent config object to configure whether the agent is active. However the uvm_agent class contains code to configure its is_active property directly from the uvm_config_db:

  function void build_phase(uvm_phase phase);
    int active;
    super.build_phase(phase);
    if(get_config_int("is_active", active)) is_active = uvm_active_passive_enum'(active);
  endfunction

Therefore, storing the is_active property in the agent config object as shown in the example seems to be redundant, although there is an advantage to keeping all the agent config in one place. Which approach is preferred/recommended?

In reply to miketrim:

It is recommended that you incorporate the is_active property in your agent config object and use the uvm_config_db() with your object config object.

You will periodically come across some older code where is_active is set directly in the uvm_config_db(), but this code will typically originate from OVM code where the configuration database didn’t support classes.

In reply to cgales:

Thanks. So is that code in the uvm_agent class just included for backward compatibility?

In reply to miketrim:

No, it’s not for compatibility. It’s using the old OVM style of configuration and hasn’t been updated to the newer recommended method.