Craftax follows the gymnax interface. To use it, you need to create an environment using make_craftax_env_from_name, manage JAX PRNG keys for randomness, and use the reset and step methods. Note that env_params (retrieved from env.default_params) must be passed to most environment methods.
import jax
# Setup RNG keys
rng = jax.random.PRNGKey(0)
rng, _rng = jax.random.split(rng)
_rngs = jax.random.split(_rng, 3)
# Create environment
env = make_craftax_env_from_name("Craftax-Symbolic-v1", auto_reset=True)
env_params = env.default_params
# Get an initial state and observation
obs, state = env.reset(_rngs[0], env_params)
# Pick random action
action = env.action_space(env_params).sample(_rngs[1])
# Step environment
obs, state, reward, done, info = env.step(_rngs[2], state, action, env_params)