tree:

take(tree, count)

Returns a copy of the given tree, with the additional restriction that the new tree’s keys method will return only (at most) the first count keys.

$ cat letters.yaml
a: The letter A
b: The letter B
c: The letter C
$ ori take letters.yaml, 2
a: The letter A
b: The letter B
g a The letter A ->a a b The letter B ->b b c The letter C ->c c
g a The letter A ->a a b The letter B ->b b
Input tree
Result

See also deepTake.