Lesson 15 / 25
API, Database and Computer-Use Tools
Choose between structured API tools and screen-driving tools and prefer the first when possible.
Structured beats screen-scraping
Where a system has an API or database, wrap it in a typed tool: it is fast, testable and easy to permission. For software with no API, computer-use tools let a model look at screenshots and click or type like a person. That is powerful but slower, costlier and more error-prone, so treat it as a fallback and add confirmations for anything irreversible.
Choosing the interface
Prefer the first line that applies.
1. A documented API exists -> typed API tool
2. A database you may query -> read-only SQL tool (parameterised)
3. Files in a workspace -> file read/write tools with path limits
4. Only a graphical interface -> computer-use tool + human confirmationWrap, do not expose raw SQL
Prefer narrow tools such as get_orders_for_customer(id) to a free-form SQL tool. If you must allow SQL, use a read-only user, a statement timeout and a row limit.
Quick check: When is a computer-use tool the best choice?
- When the software has no API and only a graphical interface
- Whenever an API exists
- Never
- Only for reading text files
Answer
When the software has no API and only a graphical interface — Structured APIs are better; screen control is the fallback when nothing else exists.