
cuOpt Routing API
OfficialFreeEfficient vehicle routing solutions using Python.
Free · Opens the source repo
What cuOpt Routing API does
The cuOpt Routing API is a Python-based skill designed for solving complex vehicle routing problems (VRP), traveling salesman problems (TSP), and pickup and delivery problems (PDP). It leverages NVIDIA's cuOpt technology to provide efficient solutions tailored for scenarios involving multiple locations, fleets, and various constraints. This skill is particularly beneficial for developers and data scientists who need to implement routing solutions in their applications without delving into lower-level programming languages.
With the cuOpt Routing API, users can define their routing problems by specifying parameters such as the number of locations, cost or distance matrices, fleet capacities, and various constraints like time windows and service times. The API provides a straightforward interface for setting up these parameters, allowing users to focus on the logic of their applications rather than the intricacies of routing algorithms. It also includes examples and reference models to help users get started quickly and effectively.
The skill supports a range of functionalities, including adding constraints for time windows, capacities, and precedence, which makes it versatile for different routing scenarios. Users can easily check the status of their solutions and debug common issues by utilizing built-in functions to retrieve error messages and infeasible orders. This approach not only simplifies the debugging process but also enhances the overall user experience by providing clear feedback on the routing solutions.
This skill is ideal for developers working on logistics, delivery services, or any application that requires efficient routing solutions. By using the cuOpt Routing API, users can significantly reduce the complexity of implementing routing algorithms, allowing them to create responsive and efficient applications that meet their specific needs.
When to use it
Use this skill when you need to implement routing algorithms for logistics, delivery, or transportation applications in Python.
When not to use it
This skill is not suitable for users looking for a C API or those who require a non-Python solution.
What you can build with it
Logistics Optimization
Implement efficient routing solutions for delivery services, optimizing routes based on various constraints.
Fleet Management
Manage vehicle fleets effectively by calculating optimal routes that consider vehicle capacities and service times.
Transportation Applications
Develop transportation applications that require real-time routing solutions for pickups and deliveries.
How to install cuOpt Routing API
View source1. Install with the skills CLI
npx skills add nvidia/skills/cuopt-routing-api-python --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by nvidiacuOpt Routing — Python API
This skill is Python only. Routing has no C API in cuOpt.
Required questions
Ask these if not already clear:
- Problem type — TSP, VRP, or PDP?
- Locations — How many? Depot(s)? Cost or distance between pairs (matrix or derived)?
- Orders / tasks — Which locations must be visited? Demand or service per stop?
- Fleet — Number of vehicles, capacity per vehicle (and per dimension if multiple), start/end locations?
- Constraints — Time windows (earliest/latest arrival), service times, precedence (order A before B)?
Minimal VRP Example
import cudf
from cuopt import routing
cost_matrix = cudf.DataFrame([...], dtype="float32")
dm = routing.DataModel(n_locations=4, n_fleet=2, n_orders=3)
dm.add_cost_matrix(cost_matrix)
dm.set_order_locations(cudf.Series([1, 2, 3], dtype="int32"))
solution = routing.Solve(dm, routing.SolverSettings())
if solution.get_status() == 0:
solution.display_routes()
Adding Constraints
# Time windows
dm.add_transit_time_matrix(transit_time_matrix)
dm.set_order_time_windows(earliest_series, latest_series)
# Capacities
dm.add_capacity_dimension("weight", demand_series, capacity_series)
dm.set_order_service_times(service_times)
dm.set_vehicle_locations(start_locations, end_locations)
dm.set_vehicle_time_windows(earliest_start, latest_return)
# Pickup-delivery pairs
dm.set_pickup_delivery_pairs(pickup_indices, delivery_indices)
# Precedence
dm.add_order_precedence(node_id=2, preceding_nodes=np.array([0, 1]))
Solution Checking
status = solution.get_status() # 0=SUCCESS, 1=FAIL, 2=TIMEOUT, 3=EMPTY
if status == 0:
route_df = solution.get_route()
total_cost = solution.get_total_objective()
else:
print(solution.get_error_message())
print(solution.get_infeasible_orders().to_list())
Data Types (use explicit dtypes)
cost_matrix = cost_matrix.astype("float32")
order_locations = cudf.Series([...], dtype="int32")
demand = cudf.Series([...], dtype="int32")
Solver Settings
ss = routing.SolverSettings()
ss.set_time_limit(30)
ss.set_verbose_mode(True)
ss.set_error_logging_mode(True)
Common Issues
| Problem | Fix |
|---|---|
| Empty solution | Widen time windows or check travel times |
| Infeasible orders | Increase fleet or capacity |
| Status != 0 with time windows | Add add_transit_time_matrix() |
| Wrong cost | Check cost_matrix is symmetric |
compute_waypoint_sequence alters route_df | It replaces the location column with waypoint ids in place — pass route_df.copy() if you still need cost-matrix indices (e.g. when iterating per truck) |
Debugging
When status != 0: print(solution.get_error_message()) and print(solution.get_infeasible_orders().to_list()) to see which orders are infeasible.
Data types: Use explicit dtypes (float32, int32) for matrices and series to avoid silent errors.
Examples
- examples.md — VRP, PDP, multi-depot
- server_examples.md — REST client (curl, Python)
- Reference models: This skill's
assets/— vrp_basic, pdp_basic. See assets/README.md.
Escalate
For contribution or build-from-source, see the developer skill.
Frequently asked questions about cuOpt Routing API
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
