Building an AGV System
This tutorial assembles a complete intralogistics simulation from scratch — layout, warehouses, fleet, coordinator, and metrics — step by step. By the end you will have a running script that dispatches five transfer orders across two AGVs and reports per-order timings and fleet utilisation.
Prefer to run it live? The intralogistics examples gallery runs end-to-end systems in your browser with inline plots.
For quick setups consider build_simple_system() from the Intralogistics examples; this tutorial builds everything manually so you can see how the pieces fit together.
See also: Intralogistics guide · Intralogistics API · Examples gallery
1. Define the layout graph
The layout is a T-shaped corridor with a parking spur:
STORE_OUT(0,0) -- C1(10,0) -- C2(20,0) -- LINE_IN(30,0)
|
PARK(10,10)
from simulatte.environment import Environment
from simulatte.intralogistics import Arc, LayoutGraph, Node
from simulatte.layout import Explicit
env = Environment()
store_out = Node(id="STORE_OUT", x=0.0, y=0.0)
c1 = Node(id="C1", x=10.0, y=0.0)
c2 = Node(id="C2", x=20.0, y=0.0)
line_in = Node(id="LINE_IN", x=30.0, y=0.0)
park_node = Node(id="PARK", x=10.0, y=10.0)
arcs = [
Arc(source=store_out, target=c1, bidirectional=True),
Arc(source=c1, target=c2, bidirectional=True),
Arc(source=c2, target=line_in, bidirectional=True),
Arc(source=c1, target=park_node, bidirectional=True),
]
graph = LayoutGraph([store_out, c1, c2, line_in, park_node], arcs)
# The graph is the network of the environment's layout. Every component below refers to its nodes and to the
# graph through handles; the layout resolves them when the run starts.
layout = env.layout
layout.set_network(Explicit(graph))
LayoutGraph builds an adjacency structure that the fleet's router uses to route AGVs. An arc's travelled length is the distance between its nodes unless you pass length=. Explicit(graph) declares it as the network of the environment's layout (env.layout); the components that follow take layout.node(id) and layout.graph() handles, never the Node and LayoutGraph objects themselves.
2. SKUs and warehouses
Define your SKUs first, then create warehouses with initial inventory. pick_time and put_time control how long a warehouse slot is occupied during pick/put operations. Each accepts a number, a distribution description such as Uniform(4.0, 6.0) (both managed: they draw from the environment's seeded RNG streams <warehouse>/pick and <warehouse>/put) or a callable (sku, qty) -> float (opaque: it is used as is and makes the run manifest incomplete).
from simulatte.intralogistics import SKU, Warehouse
sku_a = SKU(id="ComponentA", weight=5.0, volume=0.2)
sku_b = SKU(id="ComponentB", weight=10.0, volume=0.4)
products = [sku_a, sku_b]
storage = Warehouse(
env=env,
name="Storage",
input_bays=[layout.node("STORE_OUT")],
output_bays=[layout.node("STORE_OUT")],
n_slots=3,
products=products,
initial_inventory={sku_a: 50, sku_b: 30},
pick_time=lambda sku, qty: 5.0 + qty * 2.0,
put_time=lambda sku, qty: 3.0 + qty * 1.0,
)
production_line = Warehouse(
env=env,
name="ProductionLine",
input_bays=[layout.node("LINE_IN")],
output_bays=[layout.node("LINE_IN")],
n_slots=3,
products=products,
initial_inventory={},
pick_time=2.0,
put_time=2.0,
)
3. AGV fleet
An AGVType bundles the speed profile, battery, capacity, and load/unload times (load_time and unload_time, each a number, a distribution description or a zero-argument callable). All AGVs of the same type share these settings.
from simulatte.intralogistics import AGV, AGVType, TrapezoidalProfile
speed_profile = TrapezoidalProfile(
max_speed=1.5,
acceleration=0.8,
deceleration=0.8,
)
agv_type = AGVType(
name="standard",
speed_profile=speed_profile,
battery_capacity=1000.0,
weight_capacity=50.0,
volume_capacity=2.0,
load_time=5.0,
unload_time=5.0,
)
# Two AGVs starting at the corridor junction C1 (ids are generated: agv-0, agv-1)
agvs = [AGV(env=env, agv_type=agv_type, initial_node=layout.node("C1")) for _ in range(2)]
Ids such as agv-0 are reserved for generated ids; pass agv_id= only for a custom name like "forklift-A".
TrapezoidalProfile models acceleration and deceleration. It reports its kinematic limits, so an AGV accelerates from rest, passes intermediate nodes at speed and brakes only where it stops; travel times follow from the arc lengths and the profile.
4. Wire FleetCoordinator and policies
FleetCoordinator is the central dispatcher. Pass it the layout's graph handle, fleet, warehouses, and optional infrastructure (charging stations, parking areas). The dispatch_strategy and repositioning_policy are pluggable.
from simulatte.intralogistics import (
FleetCoordinator,
FreeFlowController,
NearestIdleStrategy,
NearestParkingPolicy,
ParkingArea,
ShortestDistanceRouter,
)
parking = ParkingArea(env=env, name="Parking", node=layout.node("PARK"), capacity=2)
coordinator = FleetCoordinator(
env=env,
graph=layout.graph(),
fleet=agvs,
warehouses=[storage, production_line],
charging_stations=[],
parking_areas=[parking],
traffic_controller=FreeFlowController(),
router=ShortestDistanceRouter(),
dispatch_strategy=NearestIdleStrategy(),
repositioning_policy=NearestParkingPolicy(),
)
NearestIdleStrategyselects the idle AGV with the least route cost to the order's origin warehouse.NearestParkingPolicysends idle AGVs to the parking area with the least route cost, to keep the main corridor clear.FreeFlowController(the default) lets AGVs share nodes and lanes without waiting for one another. Swap in aReservationControllerto model congestion: it requires alengthon the AGV type (see traffic control).ShortestDistanceRouter(the default) routes by distance, withalgorithm="astar"for A*;FastestRouterroutes by travel time (see routing).
5. Dispatch transfer orders
Create orders with coordinator.create_order() and submit them with coordinator.submit(). The coordinator dispatches them to AGVs as capacity allows.
orders = []
for sku, qty in [(sku_a, 4), (sku_b, 2), (sku_a, 6), (sku_b, 3), (sku_a, 2)]:
order = coordinator.create_order(
sku=sku,
quantity=qty,
origin=storage,
destination=production_line,
)
coordinator.submit(order)
orders.append(order)
env.run(until=300.0)
6. Read metrics
After the simulation, inspect per-order timing attributes and use coordinator.agv_report() for fleet-level data.
from simulatte.intralogistics import OrderStatus
completed = [o for o in orders if o.status is OrderStatus.COMPLETED]
avg_fulfillment = sum(o.delivered_at - o.created_at for o in completed if o.delivered_at is not None) / len(completed)
print(f"Completed: {len(completed)}/{len(orders)}")
print(f"Avg fulfillment time: {avg_fulfillment:.1f}s")
print(f"Fleet utilization: {coordinator.fleet_utilization:.1%}")
for info in coordinator.agv_report():
print(f" {info['agv_id']}: state={info['state']}, battery={info['battery_pct']:.0%}")
Full script
The complete runnable script is at examples/building_an_agv_system.py.
Run it:
uv run python examples/building_an_agv_system.py
Output
Building an AGV System — step-by-step example
Layout: 5 nodes, 4 arcs
Fleet: 2 AGVs
Orders: 5 submitted
Simulation time: 300.0s
Completed orders: 5/5
Avg fulfillment time: 124.3s
order sku qty status dispatch pick deliver agv
1 ComponentA 4 COMPLETED 0.0 21.5 55.6 agv-0
2 ComponentB 2 COMPLETED 0.0 17.5 51.6 agv-1
3 ComponentA 6 COMPLETED 74.3 107.4 143.2 agv-1
4 ComponentB 3 COMPLETED 78.3 105.4 141.2 agv-0
5 ComponentA 2 COMPLETED 165.7 192.1 229.9 agv-0
Inventory (start -> end):
Storage:
ComponentA 50 -> 38
ComponentB 30 -> 25
ProductionLine:
ComponentA 0 -> 12
ComponentB 0 -> 5
Fleet report:
Overall utilization: 70.7%
agv-0: state=IDLE, battery=77%, node=PARK
agv-1: state=IDLE, battery=85%, node=PARK
What the output shows
All five orders complete within the 300-second window. The two AGVs handle the first two orders in parallel (both dispatched at t=0), then pick up the next pair once they return (~t=74–78 s), and agv-0 takes the fifth order alone. Average fulfillment time of 124.3 s reflects pick time (which scales with quantity), travel across 30 m of corridor, and unload time at the production line. Both AGVs park at the PARK node when idle, keeping the main corridor free. Under the default FreeFlowController they share the corridor and the PARK node without waiting for each other. Fleet utilisation is 70.7 %, leaving headroom to absorb additional orders without queuing.
Next steps
This example deliberately uses a generous battery_capacity (1000.0) and omits a charging station so the fleet never needs to recharge — keeping the focus on the core wiring. To model a realistic battery lifecycle:
- Add a
ChargingStationand lowerbattery_capacityto see automatic recharging in action (see the advanced intralogistics example) - Call
FleetTimeSeries(coordinator).attach(env)before the run to record time series, thenplot_fleet_utilization()after it for a visual breakdown - Swap
NearestIdleStrategyforRoundRobinStrategyto compare fleet balance