unit_action
Command Civilization VI units to move, attack, fortify, improve tiles, or merge into corps/armies by supplying a unit ID and target details.
Instructions
Issue a command to a unit.
Args:
unit_id: The unit's composite ID (from get_units output)
force: Override a safety block. Only set this after reading the
block's explanation and deciding the risk is worth it — the
safety checks exist because these mistakes cost whole games
(civilians walking into barbarians, ranged units moving before
they shoot). Leave it False by default.
force_reason: One sentence on WHY you are overriding. Recorded to
data/force_log.jsonl. Without it a post-game review cannot tell
a wrong gate from a wrong call — write it even when in a hurry.
action: One of: move, attack, fortify, skip, found_city, improve, repair, remove_improvement, remove_feature, build_route, automate, heal, alert, sleep, delete, trade_route, activate, sacrifice_charges, hurry_production, hurry_wonder, hurry_district, teleport, spread_religion, excavate, form_corps, form_army, rebase
target_x: Target X coordinate (required for move/attack/trade_route/teleport/rebase)
target_y: Target Y coordinate (required for move/attack/trade_route/teleport/rebase)
improvement: Improvement type for builders (required for improve), e.g.
IMPROVEMENT_FARM, IMPROVEMENT_MINE, IMPROVEMENT_QUARRY,
IMPROVEMENT_PLANTATION, IMPROVEMENT_CAMP, IMPROVEMENT_PASTURE,
IMPROVEMENT_FISHING_BOATS, IMPROVEMENT_LUMBER_MILL
For move/attack: provide target_x and target_y.
For trade_route: provide target_x and target_y of destination city.
For teleport: provide target_x and target_y of destination city. Traders only, must be idle (not on active route).
For rebase: provide target_x/target_y of a friendly aerodrome or carrier. Air units only —
they never use move (they don't walk the map), and anything past their 15-tile strike
range can only be reached by rebasing. Long hops may be refused; go via an intermediate
aerodrome (measured: 44 tiles rejected, 20 accepted).
For improve: provide improvement name. Builder must be on the tile.
For repair: repairs a pillaged improvement on the builder's current tile. No improvement name needed.
For remove_improvement: demolishes an intact improvement on the builder's current tile (e.g. to replace a farm with a mine). Costs one charge.
For activate: activates a Great Person on their matching district.
For sacrifice_charges: Royal Society builder sacrifice — spends ALL builder charges to boost a district project (2% of cost per charge). Builder must be on the district tile. Expansion-only; absent in RULESET_STANDARD.
For hurry_production: spends builder charges to hurry construction on the builder's current tile, auto-detecting which variant this civ has. hurry_wonder forces the wonder variant (Qin Shi Huang / FIRST_EMPEROR_TRAIT, early eras only), hurry_district forces the district variant (Aztec). Move the builder onto the in-progress wonder/district tile first. If your leader lacks the ability the error says so explicitly — it is a ruleset limit, not a tool failure.
For form_corps / form_army: merges the SAME-TYPE unit at target_x/target_y into this
one. Corps (+10 combat strength) needs Nationalism; Army (+17) needs Mobilization —
these are the two free power spikes on the civics tree, and the same standing army
gains roughly an era's worth of strength by merging. Both units must be the same
unit type; move them together first.
For spread_religion: spreads religion at current tile. Missionaries/Apostles only.
For build_route: builds road/railroad on current tile. Military Engineers only. No charges used; costs 1 Iron + 1 Coal per railroad tile.
For fortify/skip/found_city/automate/heal/alert/sleep/delete: no target needed.
heal = fortify until healed (auto-wake at full HP).
alert = sleep but auto-wake when enemy enters sight range.
delete = permanently disband the unit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| action | Yes | ||
| unit_id | Yes | ||
| target_x | No | ||
| target_y | No | ||
| improvement | No | ||
| force_reason | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |