Workbench developer docs中文

Recipes

Three everyday tasks, step by step, with wb. Every command on this page is run exactly as written on every change to Workbench, as a company admin of a test company, so the page always matches what the server does.

Before you start, sign in once with wb login (see Getting started). Each recipe needs the connection's Company key: wb connections shows which ones your company has.

Find a part on DigiKey

Search DigiKey by keyword, then read the details of the exact part you want. First the search; the body is DigiKey's own keyword search request:

wb call digikey products/v4/search/keyword --data '{"Keywords": "MMBT3904", "Limit": 5, "Offset": 0}'

In the answer, Products lists the matches. Each has its ManufacturerProductNumber, QuantityAvailable and UnitPrice, and its ProductVariations (reel, cut tape and so on), each with a DigiKeyProductNumber. Then read one part's details by its DigiKey product number:

wb call digikey products/v4/search/MMBT3904LT1GOSCT-ND/productdetails

The answer's Product has the full record: pricing by quantity, stock, the datasheet link and the parameters.

To keep an answer for a script, add > part.json to the command and read the file with jq or your own code.

Read your purchase orders from MRPeasy

Read your company's purchase orders and suppliers straight from MRPeasy. First the purchase orders:

wb call mrpeasy rest/v1/purchase-orders

Each purchase order has its code, vendor_title, status, currency and products: one entry per line, with its item_code and quantity. Then the suppliers, to match vendor_title with the supplier's record:

wb call mrpeasy rest/v1/vendors

MRPeasy answers long lists a page at a time; these commands read the first page.

Ask a model through the relay

Send a prompt to Anthropic's Messages API. The call goes through Workbench's AI relay: your company's key, the models your company allows, and your company's and your own monthly AI budget.

wb call anthropic v1/messages --data '{"model": "claude-sonnet-5-5", "max_tokens": 512, "messages": [{"role": "user", "content": "In one sentence, what is an MMBT3904?"}]}'

The answer is Anthropic's message: the reply is in content, and usage has the tokens counted against your budget. Ask for the whole answer: a request with "stream": true is refused during the trial. To ask about a part you found on DigiKey, put its details in the message's content.

When a step fails

wb exits non-zero and prints Workbench's reason. Limits and errors lists every reason, such as a missing Company key or a spent budget.