深夜提醒

现在是深夜,建议您注意休息,不要熬夜哦~

🏮 🏮 🏮

新年快乐

祝君万事如意心想事成!

share-image
中
ESC

CLI First: Enterprise Systems in the Agent Era

English 阅读中文版

The Default Shape of Enterprise Systems: Designed for a Mouse

Enterprise systems tend to look the same: an ERP, a handful of purchased SaaS products, and a backend built by each department. They share one interaction model — login, menu, form, button, pagination, export. The interface is designed for people, and people absorb the cost: training, memorizing paths, waiting for pages, dismissing dialogs.

Worse is the organizational layer: purchased systems cannot be changed, in-house systems are built in silos, and sales, finance, and payroll each run their own backend. Data is scattered across systems; to connect it, you first have to operate every system.

When the user changes from a person to an Agent, the premise breaks.

RPA: Automating Machines on Human Interfaces

RPA took off (UiPath, UiBot, Yingdao) for a simple reason: most enterprise systems are purchased software with only a GUI and no programmable entry point. If you cannot change the system, you wrap it in a bot that imitates a person — find elements, click, type, wait, screenshot.

That was a real business, because it was the only option at the time. It was a workaround, not an architecture.

At my last company I worked on internal automation — roughly what people now call an FDE — making sales, finance, and payroll teams more efficient. The work was mostly data silos. The problems showed up quickly:

  1. No unified login or authorization. Every system had its own account and password, no SSO, no shared password management; some used SMS, some image captchas, some domain accounts. Every integration meant rewriting authentication.
  2. Hard captchas. The finance workflow had to log into China Merchants Bank’s corporate portal: solve a captcha, OCR it, fill the form, submit; then click menus, expand dropdowns, wait for loads, click query, fill conditions, and finally scrape the data out of the browser’s network requests.
  3. The cost sat with people. Someone had to map the process, then translate it into click scripts. When the UI changed, the scripts broke; when they failed, the only diagnostic was a screenshot.

The essence: RPA downgraded the machine interface to a human one. Every step depends on pixels, timing, and window state, so it is inherently unstable.

The Last Mile the Requirement Pool Never Reaches

There is also a supply-side reason RPA took off.

Most enterprise software is standardized SaaS. If you want a new capability, you file a request with the SaaS or IaaS vendor. They do not build it immediately; they collect requests into a pool, then decide which are common enough to schedule and which are one customer’s custom need. The custom ones usually wait forever, or are never built.

I have done the same job at three companies: helping customers export their data out of a SaaS vendor. The standard product did not support the field combinations they needed, and the need was not common enough to be scheduled, so it was handled manually — connect to the offline database, write joins, adjust fields per customer. Every customer wanted a different table, so nothing could be standardized, and a lot of people did low-skill, tedious work.

This is not a technical problem; it is commercial structure. Standardized products have low marginal cost, customization has high marginal cost, so the vendor rationally declines.

AI changes the cost on this side. If the standard product will not do it, the customer can build it: let an Agent read the schema, write the queries, assemble the export, and verify the result — one investment, reused many times. What used to take an engineer weeks of integration can now be finished by the business team itself.

The precondition is still access: the data must be reachable (read-only database, API, export file) and permissions must be clear. Without access, even the strongest Agent can only look.

What Agents Change: Who Orchestrates

Older automation had to hard-code the logic: log in, click this menu, call that endpoint, assemble these fields. A person spent days mapping it, then wrote a script that broke on the next release.

An Agent does not need that. Give it a capability list, parameter formats, and a few examples, and it can decide which endpoint to call first, what to query next based on the result, and how to recover when something fails. You do not even have to tell it in advance which endpoint holds the data.

There is one precondition: those capabilities must exist as commands or APIs. If a capability only lives in a UI, the Agent falls back to RPA.

The Translation Layer That Disappears

When I built reconciliation for finance, the biggest cost was not code. It was translation.

I did not know finance: how accounts reconcile, how discrepancies are defined, which data window to use, how to treat cross-period items. The business team had to explain it, and I translated it into queries and code, with rounds of confirmation — is this field the same thing? How is month-end handled? What counts as an exception?

The flow was serial:

business expert → explain → engineer understands → design queries → write code → verify → deliver

Every hop loses something: the expert omits a detail, the engineer misreads a definition, and the code is wrong in a way nobody notices until reconciliation. A single reconciliation script often took several rounds to get right.

Agents compress this:

business expert → describe the goal → Agent calls capabilities → gets data → checks the result

The Agent plays the role I used to play — understand intent, find data, assemble logic, verify. The difference is that it does not need to “learn the business,” and it does not translate business into code and back again.

The engineer’s role moves upstream: not writing workflows for the business, but packaging capabilities, defining boundaries and errors, and leaving an audit trail.

That does not mean the business expert can say anything. Ambiguity remains: data windows, exception rules, scope. The Agent must state its assumptions and show how it got the numbers, or a wrong answer goes unnoticed.

Wrapping Systems as CLIs

I now wrap the systems that used to require browser clicks into CLIs, one capability at a time. The precondition is that the source code or API is visible to technical support — if you can read the implementation, you know the real inputs, outputs, and side effects instead of guessing from the page.

erp orders list --customer acme --since 2026-11-01 --json
crm contact search --email a@b.com --json
bank statement --account X --month 2026-11 --json

Login and captcha — the human parts — are hidden from the Agent: either inside the command (Playwright and OCR are implementation details), or behind a token a human authorizes. The Agent calls commands; it never touches pixels.

Documentation shifts from a user manual to an Agent-readable capability spec. For each command, four things:

  • what it does;
  • parameter types, formats, and limits;
  • the response shape, for both success and failure;
  • one real example and common errors.

With those four, the Agent can figure out the rest: read the spec, pick an endpoint, compose calls, inspect results, recover.

A Directory Tree and a Skill Index

Once there are many commands, the Agent needs a map. Organize them by business line as a tree:

billing/
invoices/ list, get, export
payments/ list, refund
orders/ list, detail, cancel
inventory/ stock, adjust

Each intermediate node carries a short spec — what this branch is for, which questions belong here, which commands to start with. The top level only routes; it does not dump details.

Three constraints:

  1. Progressive disclosure. The top level holds routing only; details live at the leaves. The Agent loads what it needs instead of blowing up its context.
  2. Stable naming. Consistent verbs (list / get / create / update / delete / export) and parameter conventions, so the Agent can generalize.
  3. Machine-readable manifests. Each directory has one — name, description, commands, parameters, responses, examples, errors. --help --json emits the same structure.

Authorization and audit follow the same layering: read-only and write branches get different scopes; every call records caller, parameters, and result.

Generic Wrapping vs. Hard-Coded Workflows

There is a real trade-off:

Generic CLI + Agent orchestration Hard-coded workflow
Upfront cost Wrap capabilities only Map the process, fix the path
Runtime cost Explore each time: more steps, more tokens, more latency One shot, fewer steps
Stability Depends on model judgment; paths can drift Fixed paths, testable
Maintenance Change a command when the system changes Change the workflow when the process changes
Fit Long-tail, cross-system, exploratory High-frequency, standard, repeatable

The practical answer is: generic first, hard-code later.

A generic CLI lets you connect a system quickly and skips the upfront process mapping; the price is exploration on every run. Once a path is walked repeatedly, compress it into a dedicated skill or a composite command.

It is close to a query plan cache: the first query goes through the optimizer, repeated queries reuse the plan. The difference is that here the plan is distilled from the Agent’s own traces.

Letting Skills Grow Themselves

Hard-coding should not depend on someone’s memory. Build a loop:

  1. Record traces. Question, command sequence, parameters, response summaries, latency, success, whether a human took over.
  2. Analyze on a schedule. Daily or weekly, offline: which questions repeat, which paths are most stable, which step fails most.
  3. Generate candidates. Turn stable paths into skills or composite commands, with examples, boundaries, and failure handling.
  4. Validate before shipping. Replay historical questions as a regression set; publish only if the success rate is at least the baseline.
  5. Version and measure. Roll back when needed; track success rate, average steps, token spend, and human takeover rate.

The key word is candidate. Auto-generated skills must not take effect directly, or a wrong path gets codified and the system gets worse over time.

“Better with use” requires an eval set, a rollback path, and someone accountable for exceptions. Otherwise you are just turning one lucky success into the standard answer.

Update, Don’t Pile Up

Similar questions should not produce the Nth skill. Give each skill a stable intent signature — problem type, systems involved, key parameters — and match new traces against it:

  • match and same path → update the last-verified time and examples;
  • match and a better path (fewer steps, lower failure rate) → merge, keep the old version for rollback;
  • no match → create a new one.

Without this, half a year later you have hundreds of contradictory skills and the Agent gets slower.

The Prerequisites of Zero Hand-Writing

“No code, no docs” applies to runtime. You still build four things once:

  • a scheduler (cron or a systemd timer);
  • a trace schema: question, commands, parameters, response summary, latency, takeover;
  • a fixed skill template: description, inputs, steps, examples, failure handling, version;
  • a regression set and a release/rollback process.

Those are one-time costs; after that, iteration is automatic. What you save is the daily documentation work, not the setup.

Keeping It from Getting Worse

  • Run new skills in shadow mode against the old path before promoting them;
  • give every skill an owner, a version, and a last-verified timestamp;
  • auto-demote or archive skills that go unused or whose failure rate rises;
  • redact traces before storage; user data does not belong in a skill.

What remains for people is two things: correcting errors and approving high-risk changes.

JSON Is Hostile to Humans, Not to Machines

API responses run to hundreds of lines of JSON or XML, nested several levels deep. Scanning them by eye is painful; even programmers reach for tools. Models handle this kind of structured text without difficulty — as long as it is not garbled or encrypted.

HTML and the DOM are the noise: tags, styles, tracking attributes, generated class names. The useful information is buried in the rendering layer. A machine reading JSON is reading data; a machine reading the DOM is guessing at an interface.

That is why “wrap the page into an API” beats “teach the Agent to click”: the former confines uncertainty to the wrapper, the latter spreads it across every step.

What the GUI Is Still For

For execution, a GUI is unnecessary: it re-wraps programmable operations in mouse movement, adding cost.

People still need to read reports, approve requests, and configure policies — that is a presentation layer, and it can stay. But the execution entry point should have the CLI/API as its single source of truth; the UI is one view of it.

If an internal system still offers pages and no API, it has decided by design that its users can only be people — and therefore that automation can only mean clicking.

Impact on Organizations

Technical support is the clearest example.

A department of fifteen to twenty people, split by business line, with primary/backup rotation and handovers. Much of the work is “look up data, assemble conditions, reconcile definitions, answer the user.”

Once the capability catalog exists, that becomes: the Agent reads the top-level skill, picks a branch, calls commands, gets data, analyzes, replies. 24/7, no rotation.

What disappears is not only the lookup role. Engineers used to spend a large share of their time learning the business and translating it — finance’s reconciliation rules, sales’ definitions, payroll’s policies — into queries and code. Now the domain expert can get data through the Agent, and the engineer provides capabilities, defines boundaries, and reviews results.

People move up:

  • define capability boundaries and acceptance criteria;
  • handle what the Agent cannot judge (permissions, dirty data, cross-team definitions);
  • audit call records, investigate overreach and mistakes;
  • maintain the tree and documentation, update wrappers when systems change;
  • review the assumptions that get dropped when a domain expert talks to an Agent.

Will headcount fall from fifteen to single digits? That depends on business complexity, compliance, and the number of systems; it is not linear. But “one person per business line, plus primary/backup rotation” no longer makes sense.

Tokens are a cost ceiling, not a quality guarantee. Running 24/7 requires stable wrappers, accurate docs, retryable failures, and someone to take over exceptions; otherwise you have simply made the errors run 24/7 too.

The Transition

Legacy systems will not be rewritten at once. Go in this order:

  1. Inventory high-frequency, cross-system operations; start where the data silos hurt most.
  2. Define a command or API for each, and get one end-to-end path working.
  3. Unify authentication; replace one-password-per-system with tokens.
  4. Make output structured; add examples and error codes.
  5. Let the Agent call through the docs and record failure modes.
  6. Only then consider a UI — and have it call the same APIs.

For systems that truly cannot be changed, wrap a headless browser inside a command as a transitional implementation. The point is that the Agent faces a command, not a page. The page can stay inside; it must not leak to the caller.

Acceptance Criteria

Judge a system’s “Agent operability” by these:

  • every business action has a command or API; no clicking required;
  • inputs are typed and validated; outputs are structured;
  • failures have explicit exit codes and messages, distinguishing usage, permission, and business errors;
  • operations are idempotent and safe to retry;
  • authentication uses scoped, expiring tokens;
  • commands run outside a desktop session (SSH, systemd, containers);
  • a business-line tree or catalog lets the Agent route from the top level to a specific command;
  • reads and writes are separated, and calls are audited;
  • traces are available, and high-frequency paths are distilled into skills with regression tests;
  • docs contain real examples the Agent can try.

Conclusion

The users of enterprise systems are shifting from “people” to “people and Agents.” The interface used to be the UI for humans; the API is the UI for Agents.

CLI first, API first is not fashion. It trades click cost for call cost: the former grows with UI churn and time, the latter falls as wrappers get reused.

文章作者:阿文
文章链接: https://www.awen.me/post/6f9bbbf9.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客!

评论

0 条评论
😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️
加载中...

留言反馈

😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️