# Different step alignment for agent and environment

**URL:** <https://discuss.ray.io/t/different-step-alignment-for-agent-and-environment/998>\
**Category:** RLlib\
**Created:** [February 24, 2021, 2:20pm UTC](https://discuss.ray.io/t/different-step-alignment-for-agent-and-environment/998 "2021-02-24T14:20:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![redlight](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/redlight/32/527_2.png) [@redlight](https://discuss.ray.io/u/redlight)\
**Post date:** [February 24, 2021, 2:20pm UTC](https://discuss.ray.io/t/different-step-alignment-for-agent-and-environment/998/1 "2021-02-24T14:20:55Z")

</div>

Hi there,

Imagine we have `Discrete(2)` action space consiting of `action_0` and `action_1`.  
In the global `Environment` we dont want to act every `env_step`, so asume `action_0` is a “skip action”. (we know, when we do not need to learn).  
But for any `Policy` `Environment` will return its state for every step. So there is a lot of data we dont want to learn on in the `observation_history` inside the policy.

In the [example](https://docs.ray.io/en/master/rllib-training.html#computing-actions) of computing actions for pretrained agent it is possible to take control over the actions and observations.  
Is it possible to customize same part in the train agent code?  
To make something like (every 100th step use policy, else “skip action”) inside train loop:

> state = env.reset()

while not `done`:

> current\_step: int = env.get\_current\_step()  
> action = policy.compute\_action(state) if current\_step % 100 == 0 else 0  
> next\_state = env.step(action)  
> observation\_history.push(state, next\_state) if current\_step % 100 == 0 else None

(Sorry for inlines, didnt find a way to tabulate)

---

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [July 29, 2021, 5:47pm UTC](https://discuss.ray.io/t/different-step-alignment-for-agent-and-environment/998/2 "2021-07-29T17:47:01Z")

</div>

Hi @redlight,

it’s a time now, but maybe this post [here](https://discuss.ray.io/t/different-step-space-for-different-agents/2988/6) helps.
