{"schemaVersion":1,"resourceType":"connector","slug":"ortools","name":"OR-Tools","catalog":"ortools","description":"Optimisation with Google OR-Tools — routing, scheduling, assignment, flows and bin-packing","language":"Python","categories":["analytics"],"repository":"https://github.com/Query-farm/vgi-ortools","license":"MIT","generatedAt":"2026-12-01T18:22:16+00:00","runtime":{"engineVersion":"2.0.1","protocolVersion":"3.4"},"release":{"tag":"v0.5.0","publishedAt":"2026-11-25T18:31:36Z","url":"https://github.com/Query-farm/vgi-ortools/releases/tag/v0.5.0"},"links":{"html":"https://query.farm/products/orchard/connectors/ortools/","llms":"https://query.farm/products/orchard/connectors/ortools/llms.txt","markdown":"https://query.farm/products/orchard/connectors/ortools/index.md","json":"https://query.farm/products/orchard/api/v1/connectors/ortools.json","objects":"https://query.farm/products/orchard/api/v1/connectors/ortools/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=ortools&q={query}"},"authentication":{"mode":"none_declared","guidance":"No service credentials are declared by this connector. Individual datasets, input files or deployments may have their own prerequisites.","interpretation":"Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute(\"CREATE SECRET stripe (TYPE stripe, api_key ?)\", [os.environ[\"STRIPE_API_KEY\"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.","secrets":[]},"deployment":{"local":{"methods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'ortools' AS ortools (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-ortools@v0.5.0 vgi-ortools'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'ortools' AS ortools (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-ortools:0.5.0'\n);"}]}],"pinnedMethods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'ortools' AS ortools (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-ortools@v0.5.0 vgi-ortools'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'ortools' AS ortools (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-ortools:0.5.0'\n);"}]}]},"selfHost":{"instructions":"https://github.com/Query-farm/vgi-ortools","connectionGuide":"https://query.farm/vgi/connect-to-a-worker/","guidance":"Deploy using the connector repository instructions and use its supported HTTP or SSH transport. Replace example URLs with your actual deployment; configure its authentication."},"queryFarm":{"available":true,"console":"https://auth.queryfarm.cloud/console/new?worker=ortools","organizationMonthlyMinimumUsd":10,"pricing":"https://query.farm/products/orchard/hosted/"},"publicDemo":null},"setup":{"extensions":{"duckdb":"SET allow_extension_repositories = 'allowed';\n\nCREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm\n    WITH PREFIX 'https://duckdb-extensions.query.farm';\n\nINSTALL vgi FROM query_farm;\nLOAD vgi FROM query_farm;","haybarn":"INSTALL vgi FROM community;\nLOAD vgi;"},"attachSql":"ATTACH 'ortools' AS ortools (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-ortools@v0.5.0 vgi-ortools'\n);","attachOptions":[],"note":"Install and load VGI, attach the connector using the catalog alias shown here, then create required secrets. Replace placeholders and omit unused optional secret parameters. Satisfy file, network and credential prerequisites before executing a query."},"example":{"title":"Assign tasks at the lowest cost","sql":"SELECT worker, task, cost FROM ortools.main.solve_assignment(cost := [[0,0,90],[0,1,76],[0,2,75],[1,0,35],[1,1,85],[1,2,55],[2,0,125],[2,1,95],[2,2,90]]::BIGINT[][], maximize := false) ORDER BY worker","requiresCredentials":null,"note":null,"objects":[{"name":"ortools.main.solve_assignment","kind":"table_function","links":{"html":"https://query.farm/products/orchard/connectors/ortools/#obj-main-solve_assignment","markdown":"https://query.farm/products/orchard/connectors/ortools/objects/table_function.bWFpbg.c29sdmVfYXNzaWdubWVudA.md","json":"https://query.farm/products/orchard/api/v1/connectors/ortools/objects/table_function.bWFpbg.c29sdmVfYXNzaWdubWVudA.json"}}],"evidence":{"status":"captured_result","capturedAt":"2026-12-01T06:21:29+00:00","engineVersion":"2.0.1","protocolVersion":"3.4.0","releaseTag":"v0.5.0","sample":{"columns":["worker","task","cost"],"types":["BIGINT","BIGINT","BIGINT"],"rows":[[0,1,76],[1,0,35],[2,2,90]],"more":false}},"artifact":null},"objects":{"total":14,"index":"https://query.farm/products/orchard/api/v1/connectors/ortools/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=ortools&q={query}"},"agentTasks":["Three workers must each be assigned to a distinct task. The cost of a (worker, task) pair is given by these [worker, task, cost] arcs: [[0,0,90],[0,1,76],[0,2,75],[1,0,35],[1,1,85],[1,2,55],[2,0,125],[2,1,95],[2,2,90]]. Assign every worker to exactly one task so the total cost is as small as possible, and return that minimum total cost as a single number.","A directed network has [from, to, capacity] arcs [[0,1,20],[0,2,30],[1,2,10],[1,3,10],[2,3,20]]. What is the maximum flow that can be routed from node 0 to node 3? Return a single number.","Route 20 units from node 0 to node 4 over a network whose [from, to, capacity, unit_cost] arcs are [[0,1,15,4],[0,2,8,4],[1,2,20,2],[1,3,4,2],[2,3,15,1],[2,4,4,3],[3,4,20,2],[4,2,5,3]], with node supplies [[0,20],[4,-20]], minimizing total cost. Return the minimum total cost as a single number.","Schedule a job shop whose [job, task, machine, duration] operations are [[0,0,0,3],[0,1,1,2],[1,0,1,2],[1,1,0,4]], minimizing the makespan (the finish time of the last operation). Return the optimal makespan as a single number.","Pack items of sizes [3,5,2,7,1,4] into bins that each hold at most 10. What is the fewest number of bins needed? Return a single number.","A salesperson must visit every location exactly once and return to location 0, over the distance matrix [[0,2,9,10,1],[1,0,6,4,8],[15,7,0,8,3],[6,3,12,0,5],[9,8,4,7,0]]. How many distinct locations does the computed optimal tour visit? Return a single number.","Solve this CP-SAT model (booleans a, b, c) that maximizes 10*a + 20*b + 30*c subject to 5*a + 10*b + 15*c <= 20: '{\"version\":1,\"variables\":[{\"kind\":\"bool\",\"name\":\"a\"},{\"kind\":\"bool\",\"name\":\"b\"},{\"kind\":\"bool\",\"name\":\"c\"}],\"constraints\":[{\"type\":\"linear\",\"expr\":{\"sum\":[{\"coef\":5,\"var\":\"a\"},{\"coef\":10,\"var\":\"b\"},{\"coef\":15,\"var\":\"c\"}]},\"op\":\"<=\",\"rhs\":20}],\"objective\":{\"sense\":\"maximize\",\"terms\":[{\"coef\":10,\"var\":\"a\"},{\"coef\":20,\"var\":\"b\"},{\"coef\":30,\"var\":\"c\"}]}}'. In the optimal solution, how many of the three booleans are set to 1? Return a single number.","A depot (node 0) must serve three stops (nodes 1, 2, 3), each with demand 1, using up to 2 vehicles of capacity 2. The [from, to, distance] arcs are [[0,1,1],[0,2,1],[0,3,2],[1,0,1],[1,2,1],[1,3,2],[2,0,1],[2,1,1],[2,3,1],[3,0,2],[3,1,2],[3,2,1]] and the [node, demand] pairs are [[1,1],[2,1],[3,1]]. In the optimal routing, how many vehicles are actually used? Return a single number."],"provenance":{"generatedAt":"2026-12-01T18:22:16+00:00","repository":"https://github.com/Query-farm/vgi-ortools","harvest":{"status":"ok","method":"subprocess","error":null,"vgi_version":"9773130dde"},"catalogVerification":{"verified":true,"status":"passed","total":21,"passed":21,"failed":0,"needs_credentials":0,"location":"uvx --from git+https://github.com/Query-farm/vgi-ortools@v0.5.0 vgi-ortools","transport":"subprocess","environment":{"vgi_extension_version":"9773130dde","haybarn_version":"2.0.1rc3","engine_version":"v2.0.1","python":"3.12.4","platform":"darwin_arm64","protocol_version":"3.4.0"},"checked_at":"2026-12-01T06:19:55+00:00"},"interpretation":"Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."},"interpretation":["Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.","Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.","A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.","Service credentials, external data availability and deployment authentication are separate requirements."]}