Skills: Framework and Contract#
This page gives the skill framework of the procedure tier (work package WP9 of Farm Benchmark Suite: Design, sections 6.2 to 6.5). It is the contract for each agent that adds a skill. The code is in Fast/acres_batch/skills/. The checks are in Benchmark/acres_bench/skills/run.py. The tests are in Tests/Fast/test_skill_framework.py and in one test file for each skill.
Two skills are the worked examples of the whole path: K10 dock (K10: Dock) and K13 wait (K13: Wait). Group (c) added K11 sync (K11: Sync), K12 transfer (K12: Transfer) and K16 change_implement (K16: Change Implement). The task T5 is scored from K11 (T5: Rendezvous with a Working Harvester). Group (b) added K3 gate (K3: Pass Gate) and K5 cover_field (K5: Cover Field). The skill K17 mow (K17: Mow, 13 November 2026) is a variant of K5 with the mower-conditioner.
The skill K1 drive is in the library as the actor of the scenes of other skills. It has no bank of its own.
1. What a Skill Is#
A skill is a Python class with two parts. The definition is the task of level L1: the verifier reads only this part. The reference is the classical skill: a controller of level L2.
| Part | Attribute or Function | Content |
|---|---|---|
| Definition | name, kid, task |
The name in code (dock), the ID of section 6.2 (K10), the task of the event log (k10) |
| Definition | PARAMS |
The arguments of a call (Param: name, unit, range, meaning). They are the columns of args [B, P_MAX]. |
| Definition | start_ok(env, args) |
The start condition [B]. A call whose start condition is false fails at once (reason start). |
| Definition | time_limit(env, args) |
The time limit [B] of a call in seconds. The environment ends a call that runs longer (reason timeout). |
| Definition | MONITORS, monitor_start, monitor |
The measures of the end condition. The environment writes them at each decision while the call runs. |
| Definition | scene(rng, split, index) |
The scene generator of the bank of the skill |
| Definition | grade(row, meta) |
The verdict of one call from the episode summary, on the host. Its formulas are those of section 6. |
| Definition | passes(m, a) |
The part of the verdict of a success that the monitors m and the arguments a of the call decide (by name: device columns or the host floats of a row). The grade and the environment use this one rule. |
| Definition | EFFECT, effect(env, rows) |
What a running call changes in the scene at each decision: the load of a transfer (K12), the implement of a change (K16). The state of the effect of a call is sk_fx [B, 4]. It is 0 at the start of a call. |
| Reference | STATES |
The named states of the reference. The first state is the state at the start of a call. The framework adds the terminal states success, failure and ask. |
| Reference | transition(env, lib, rows) |
The one transition function of the state machine of each row. A terminal state reports its outcome. |
| Reference | aim(env, lib, rows) |
The route and the stop arc of each row in this decision |
| Reference | act(env, lib, rows, cmd) |
The proposal of each row: a chunk, a hold, the commands of the items and the resources |
The state of the reference of each row is in the library (library.Library), not in the environment. Thus a replay of the logged commands needs no controller.
The call of a row is a state machine of the environment (skill.CALL_STATES):
| From | Event | To |
|---|---|---|
| any state | a call whose start condition is true | running |
| any state | a call whose start condition is false | failure (reason start) |
| running | the controller reports success, failure or ask | success, failure or ask |
| running | the controller reports success, and the monitors fail the skill's passes |
failure (reason verdict) |
| running | the time limit, a contact, the corridor left | failure (reason timeout, contact, corridor) |
The reason of a reported outcome is an index into the REASONS of the skill. The reason of an end by the environment is negative (skill.ENV_REASONS). A new call replaces an ended call.
Thus the environment reports no success that the grade refuses (12 November 2026). Before, a success of the controller was a success of the call, and the grade judged it later. In P1 with two vehicles, the environment ended 12 calls of K3 as a success that failed their grade. The next node of each chain then started (a rule of the verifier broken).
Some parts of a grade need the meta of the scene. These are the dose of K5, the expected end of K13, the exit of K11 and the capacity of K12. These parts and the kind after K16 stay in the grade only. The test test_skill_verdict.py runs the reference on each L1 bank and compares the environment's outcome with the grade, call by call.
The command python -m acres_bench.skills.verdict --n 64 does the same on the test bank of 64 scenes of ten skills (Results/Benchmarks/skill_verdict_validity.json: commit dfd3194, 13 Nov 2026, the fitted Maxxum, an NVIDIA L40S). No call ends as a success of the environment that the grade refuses. The environment refused the success of the controller in one call: one call of K7 (pick_up). In K5 (cover_field) and K13 (wait) the grade passes the expected failures. The environment ends 49 and 45 calls as a success. The grade passes 64 and 64.
2. The Command of a Decision#
Each controller gives one skill.Command for all rows at each decision. The fields are the streams of the event log (skill.STREAMS):
| Stream | Shape and Type | Meaning |
|---|---|---|
call |
[B] int8 |
A new call: the index of the skill in the library (-1: none) |
args |
[B, 8] float32 |
The arguments of the new call |
drive |
[B, 5] float32 |
The chunk of chunk.py of a row whose call runs. A hold is the stand action. |
keep |
[B] bool |
No new chunk: the plan of the row goes on |
outcome |
[B] int8 |
The report: 0 goes on, 1 success, 2 failure, 3 ask |
reason |
[B] int8 |
The reason of the report (the REASONS of the skill) |
route |
[B] int8 |
A new route of the route table of the scene (-1: keep). A new route starts at its arc 0. |
stop |
[B] float32 |
The stop arc on the route in metres (infinity: none). The window of the route ends there. |
engage |
[B] int16 |
Take the item of this index (-1: none) |
release |
[B] int16 |
Put the carried item into this slot (-1: on the ground, -2: none) |
claim |
[B, 32] bool |
The resources that the row wants in this decision |
sections |
[B] int32 |
The live sections of the implement of the row: bit s is section s (0: all off). The pickup of a baler is bit 0. |
skill.NEUTRAL gives the value of each stream that does nothing. Command.none makes the command that does nothing. It is the do-nothing controller (macro.do_nothing).
3. The Order of the Calls#
3.1 Each Decision#
The runner (macro.decision and SkillEnv.step) does these steps in this order:
- The caller gives the new calls. At L1 the caller is
macro.FirstCall: the calls of the scene at the first decision. env.call(call, args)starts the calls at once. Thus the controller sees them in this decision.- The controller makes its command. A reference calls
env.aim(route, stop, rows)before its drive. - The suite's actors make their commands. The runner merges them into the rows of the actors (
state["actor"]). env.step(cmd)applies the call again. A call starts once in a decision, so the second apply does nothing.- The step ends a running call whose controller reports an outcome.
- The step applies the route and the stop arc of the command again. The values are the same.
- The step calls
items.engageanditems.release, and then the payload of each row. - The step calls
items.resource_stepand thenitems.shed_step. When the scenes have a field, the step callswork.decide(the live sections, the no-spray cells of the wind). - The step makes the bodies (
vehicle.bodyanditems.body), the cull (items.cull) and the things of each row. - The step calls
env.Env.takewith the body of each row: the checker accepts or refuses the chunk. - The step runs the physics of the decision (section 3.2).
- The step updates the progress on the route and the counters of each row.
- The step calls the
effectof each skill withEFFECTfor its running calls. Then it callsloads.step(the trucks, the fill states), the things of the trucks and the payload of each row. - The step calls the
monitorof each running call. Then it ends a call at its time limit, a contact or a corridor exit. - The step ends a scene when the calls of all its subject rows end, or at its time limit.
A row whose call does not run stands. The checker does not take its chunks.
3.2 Each Physics Step#
The physics of a decision has 10 physics steps of 0.05 s. In each physics step, in this order:
- The follower, the vehicle step with the kind and the payload of each row, and the trailer (
vehicle.tow). - The harvester of each scene (
harvester.step): its clock, its pose, the fill of its bunker and its things. - When the scenes have a field,
work.step. It stamps the sections and the tyres (fields.stamp_sections) and drains the tank. The baler takes the windrow (items.pickup) and forms bales (items.form). A wheel runs over the windrow (items.run_over). items.carry: each carried item stays on the spear of its holder.- The things of each row: the scene's things, the peers, the culled items (
items.refresh) and the shed. items.contactof the frame boxes against the things that are not items.items.contactof the vehicle box and the carried item against the culled items.- Each second physics step, the shield.
With the fast paths on, the physics kernel runs one physics step for each launch in four cases. The scenes have items, a harvester, a field, or more than one agent.
4. The Scene Bank#
A scene is a dictionary of numpy arrays of fixed sizes (bank.py). The keys of the harvester and the loads are optional. SkillEnv gives their neutral values to a scene without them. It has the route table and the capsule pool of lanes.pack, and these fields:
| Field | Content |
|---|---|
n_agents, kind, implement |
The agent rows of the scene, and the vehicle kind and implement of each row |
route0, arc0 |
The route of each row at the start and its arc on the route. The start pose is the route there. |
call, args, actor |
The call of each row at the first decision. The suite drives an actor row, not the controller under test. |
things |
4 static things (the targets) |
res_kind, res_box, res_leaf, res_arc, claim0 |
The resources, their regions on each route, and the claims at the start |
shed |
The door, the post and the check place of the worker, the check time |
items0, slots0 |
The items and the slots at the start |
weather, t_offset |
The weather series and the farm time of the first decision in it |
t_max |
The time limit of the scene |
mover, mover_parts, crop |
Optional: the script of the harvester, the things that move with it, the field and its crop (harvester.py) |
stores |
Optional: the stores of the bulk loads, their owners, capacities, levels and rates (loads.py) |
field, fld_target, fld_forbid, fld_crop, fld_windrow |
The field of a scene of K5 (work.py). It has the work and its parameters, the target cells and the no-spray cells of each wind class. It also has the crop off the tramlines and the windrow segments. A mower's field (K17) has the crop cells in fld_target, the yield and the swath width in field, and the optional key fld_side (the plan's side of the header at each metre of the route). |
The scene of index i of split S has the seed SPLIT_SEED[S] + i. The splits train, val and test share no seed. bank.build(name, split, n) makes a bank. bank.identity gives the identity of a scene for the event log. bank.scene_of makes the scene again from its identity and compares its sha256.
5. The Verifier and the L1 Check#
skills/verify.grade grades a scene from its episode summary (SkillEnv.episode_log). It calls the grade of the skill of each subject row. A scene succeeds when each subject row succeeds.
python -m acres_bench.skills.run validity NAME --n 64 does the checks of section 9.3 of the design on the test bank of the skill:
- The do-nothing controller runs on each scene. It must fail each scene.
- The reference runs on each scene. It must pass 0.9 of the scenes or more.
- Each log runs again from its commands (
replay). Each log must repeat bit for bit. - The verifier grades its own run, not the log.
The result file is Results/Benchmarks/skill_<task>_check.json. It has the summary of each controller, the grade of each scene, the solvable bank (checks.summary) and the L1 statistics of the reference (macro.l1_stats). python -m acres_bench.verify LOG.json grades a file of logs of any task. The verifier knows a task when its name is in acres_bench/verify.py TASKS.
6. Procedures (WP10)#
A procedure is a caller. At each decision it gives the new calls of the rows from the state of the environment. A procedure reads the result of a call from env.state:
| Key | Content |
|---|---|
call |
The state of the call (CALL_STATES) |
sk_id, sk_args |
The skill and its arguments |
sk_reason |
The reason of the end |
sk_t0, sk_t1 |
The start and the end of the call (-1: not ended) |
sk_mon |
The monitors of the call |
At L2 the controller below the procedure is the reference library (library.Library). At L3 it is the solver's own skills, with the same Command. A branch (a retry, an alternative, stop_and_ask) is a new call. Set SkillEnv.ends_with_calls to False for a procedure: a scene then ends only at its time limit or at the procedure's own end.
The abstract mode of WP10 samples the outcome and the duration of a call. macro.l1_stats gives the input: the share of each end and the quantiles of the duration on the bank of the skill. The layer of the procedures (the task graph, its state machines, the metrics, the verifier, the abstract mode) is on the page Procedure Layer.
7. A New Skill#
Do these steps for each new skill:
- Make
Fast/acres_batch/skills/<name>.pywith a subclass ofskill.Skilland the objectSKILL. - Write the module text: the arguments, the formulas of the definition, the states of the reference, the scenes.
- Give
PARAMS(at most 8),MONITORS(at most 8),STATESandREASONS. - Write
start_ok,time_limit,monitorandgradewith the formulas of section 6.2 of the design. - Write the reference:
transition,aimandact. UseLibrary.drivefor a drive along the route. - Write
scene. Draw each value from the generator that the bank gives. - Add
SKILLto the end ofSKILLSinskills/__init__.py. Do not change the order of the skills before it. - Add the task of the skill to
TASKSinBenchmark/acres_bench/verify.py. - Make
Tests/Fast/test_skill_<name>.pywith unit tests of the scenes and the grade, and the GPU checks. - Run the check on the test bank and keep the result file in
Results/Benchmarks/. - Write the page
Docs/Benchmarks/k<number>.mdand add it to the navigation inmkdocs.yml.
Put a helper that two skills use in skills/motion.py or in the framework. Do not copy it into a second skill.
8. Naming#
| Thing | Name |
|---|---|
| Module and skill name | The name of section 6.2 without its verb part when it is clear: dock, wait, place |
| Task of the event log | k and the number of section 6.2: k10 |
| Result file | Results/Benchmarks/skill_<task>_check.json |
| Page | Docs/Benchmarks/k<number>.md |
| Test file | Tests/Fast/test_skill_<name>.py |
| States, monitors, reasons | Short lower-case words: approach, e_pos, missed. A monitor of a time starts with t_. |
No name has a version number.
9. Acceptance of Each Skill#
A skill is complete when all these conditions are true:
- The do-nothing controller fails each scene of the test bank.
- The reference passes 0.9 of the test bank or more.
- Each log of the check repeats through
eventlog.pyandacres_bench/verify.py. - The formulas of
gradeare those of section 6 of the design. The module text gives them. - The tests of the skill pass in the unit tier and in the integration tier.
- All the tests of ACRES and the tests of FARMS against this tree pass as before.
- Each number on the page of the skill comes from a result file in
Results/Benchmarks/.
10. What Is Not There Yet#
| Missing Part | Who Needs It |
|---|---|
| A route that a controller makes during an episode. The route table of a scene is fixed when the scene is made. | Not needed by K7: the call names the bale. The reference leaves a field route with chunks of its own (K7 and K8: Take and Carry, section 2) |
A grain cart as a body (a trailer in vehicle.TRAILERS). The cart of K12 is a store of the tractor, not a body. |
P2 |
Trucks that arrive and leave on the lanes. A truck of loads.py appears at the pad and goes away there. |
P2 |
Things that move along a path of their own other than the harvester (things_move is False) |
WP10 |
The round baler's body in the skill banks. The K5 bank and the K3 bank tow the body of the square baler (a stand-in). P1 tows the round baler's own body (vehicle.TRAILERS round_baler, since 12 November 2026). |
K3 and K5 with the true body |
The ground surrogate (ground.py): slip, ruts, fuel |
All groups. The cost columns of L1 have no fuel yet. |
| The maps of section 3.2 in the skill scenes | All groups. The scenes are procedural. The split is by the seed. |
| The procedure environments of P1, P2 and P3 (the layer, the abstract mode and the event log of a procedure: Procedure Layer) | WP10 |
The contact of the physics kernel and its shield use the body of the Polaris. The environment computes the contact again with the body of each row (items.contact). The shield of a Maxxum row still uses the box of the Polaris.
11. The Three Groups#
| Group | Skills | Notes |
|---|---|---|
| (a) | K7 pick_up, K9 place, K8 carry as a mode of driving with a load |
Round bales on a spear (the decision of the owner). Use items.engage, items.release, the stack rule of items.stack_slots and the shed with its door and worker. K8 is a skill or a mode of K1 with the payload of items.payload. Give the target bale to the cull as exclude. |
| (b) | K5 cover_field (the baler on windrows first, then a sprayer with section control), K3 pass_gate |
Add the baler steps to the physics step in the order of WP8. Use fields.py for the coverage. K3 uses a resource of kind gate and its claim. |
| (c) | K11 sync, K12 transfer, K16 change_implement |
Built. The harvester (harvester.py) and the bulk loads (loads.py) have explicit state machines: the harvester, the outlet (auger or pump), the fill of each store and the truck. The score of T5 comes from K11. |
Each group changes the framework files only to add what section 10 lists. A change to the framework must keep the results of the other skills.
12. What the Follow-On Agents Must Not Do#
- Do not write a second environment, a second runner or a second verifier. Extend
SkillEnv,run.pyandverify.py. - Do not copy the reference drive, the meeting rule, the checker or the functions of
items.py. Call them. - Do not change the order of
SKILLSor the meaning of a stream. The logs of the other skills depend on them. - Do not add a host sync to
SkillEnv.step. The framework test checks it. - Do not change the behaviour of
env.py,env_drive.py,env_rounds.py,fast.pyoritems.pyfor the code that exists. - Do not load code or configuration at run time. Do not use threads, async code or callbacks for the control flow.
- Do not give a number on a page without its result file.
13. How to Run#
export ACRES_RUNTIME_BUILD=<ACRES>/Vehicle/Runtime/Build
python -m acres_bench.skills.run validity dock --n 64 # Results/Benchmarks/skill_k10_validity.json
python -m acres_bench.skills.run validity wait --n 64 # Results/Benchmarks/skill_k13_validity.json
python -m acres_bench.skills.run validity sync --n 64 # Results/Benchmarks/skill_k11_validity.json
python -m acres_bench.skills.run validity transfer --n 64 # Results/Benchmarks/skill_k12_validity.json
python -m acres_bench.skills.run validity change_implement --n 64 # Results/Benchmarks/skill_k16_validity.json
python -m acres_bench.t5.run --n 64 # Results/Benchmarks/t5_validity.json
python -m acres_bench.skills.run validity gate --n 64 # Results/Benchmarks/skill_k3_validity.json
python -m acres_bench.skills.run validity cover_field --n 64 # Results/Benchmarks/skill_k5_validity.json
python -m acres_bench.verify LOG.json # the logs of any task
python -m pytest Tests/Fast/test_skill_framework.py -q -m "unit or integration"