In UVM TB,do we need config_obj both at env and agent level,only at agent level will not suffice?

In general, each component, including agents and environments, will have a configuration object associated with it. The environment may be configured to set the number of masters on the bus, for example. This would be set from the test by doing something like

uvm_config_db#(env_cfg)::set(this, "env", "env_cfg", env_cfg);

Then, the environment will get it’s configuration object to know how many agents to instantiate. It may then configure each agent by separately, like

uvm_config_db#(agent_cfg)::set(this,"agent1", "agent_cfg", agent_cfg[1]);
uvm_config_db#(agent_cfg)::set(this,"agent2", "agent_cfg", agent_cfg[2]);

In some cases, you may decide that the env_cfg object should include, in addition to the environment-specific fields, each of the desired agent_cfg objects so that the whole thing may be configured from the test. In this case, the env would do:

uvm_config_db#(agent_cfg)::set(this,"agent1", "agent_cfg", env_cfg.agent_cfg[1]);
uvm_config_db#(agent_cfg)::set(this,"agent2", "agent_cfg", env_cfg.agent_cfg[2]);

It’s really up to you. The key is to preserve reusability as much as possible. Having the env just pass config objects from its own config down to the agents is more reusable than an environment that has to figure out what do to. However, in either case, each agent just gets its own config object that tells it what to do.
Good luck,
-Tom