smarts.zoo.agent_spec module
- class smarts.zoo.agent_spec.AgentSpec(interface: ~smarts.core.agent_interface.AgentInterface | None = None, agent_builder: ~typing.Callable[[...], ~smarts.core.agent.Agent] | None = None, agent_params: ~typing.Any | None = None, observation_adapter: ~typing.Callable = <function AgentSpec.<lambda>>, action_adapter: ~typing.Callable = <function AgentSpec.<lambda>>, reward_adapter: ~typing.Callable = <function AgentSpec.<lambda>>, info_adapter: ~typing.Callable = <function AgentSpec.<lambda>>)[source]
A configuration that is used by SMARTS environments.
agent_spec = AgentSpec( interface=AgentInterface.from_type(AgentType.Laner), agent_params={"agent_function": lambda _: "keep_lane"}, agent_builder=Agent.from_function, ) env = gym.make( "smarts.env:hiway-v1", scenarios=["scenarios/sumo/loop"], agent_specs={agent_id: agent_spec}, ) agent = agent_spec.build_agent()
Refer to the Agent documentation.
- action_adapter()
Deprecated. Do not use. An adaptor that allows shaping of the action. Defaults to lambda act: act.
- agent_builder: Callable[[...], Agent] | None = None
A callable to build an smarts.core.agent.Agent given AgentSpec.agent_params (default None)
- agent_params: Any | None = None
Parameters to be given to AgentSpec.agent_builder (default None)
- info_adapter(reward, info)
Deprecated. Do not use. An adaptor that allows shaping of info. Defaults to lambda obs, reward, info: info.
- interface: AgentInterface | None = None
the adaptor used to wrap agent observation and action flow (default None)
- observation_adapter()
Deprecated. Do not use. An adaptor that allows shaping of the observations. Defaults to lambda obs: obs.
- reward_adapter(reward)
Deprecated. Do not use. An adaptor that allows shaping of the reward. Defaults to lambda obs, reward: reward.