Writing
From Expect Scripts to AI Agents: How DevOps Changed
A history of operational automation from carrier networks to declarative infrastructure, plus a proposed role for AI agents.
By Ka Lun Chan · Carrier networks · Learning / AI / Architecture
Network operations before modern DevOps
The carrier network operated through a Network Operations Center (NOC), where operators monitored equipment and coordinated changes with technicians.
Deployments looked very different from what engineers see today. There was no Terraform, no Kubernetes, no GitHub Actions and none of the cloud abstractions most teams now take for granted. The team automated deployments and routine operational work with Expect scripts and KornShell (ksh) scripts.
Some changes needed someone in front of the equipment, so the plan had to cover both remote and on-site steps.
Verification, rollback and coordination still matter when the interfaces change.
Router access control lists were part of securing the network.
Expect scripts automated a person at a terminal
Much of the equipment exposed a command-line interface and had no API.
That’s what Expect is for. A script played the part of an operator, one prompt at a time:
- Connect to the device.
- Wait for a prompt.
- Send a command.
- Check the response.
- Handle the next prompt, or the error you didn’t want.
- Repeat.
A simplified version looked something like this:
spawn telnet $host
expect "Username:"
send "$user\r"
expect "Password:"
send "$pass\r"
expect {
"#" { send "show interfaces status\r" }
timeout { puts "no prompt from $host"; exit 1 }
}
expect "#"
send "exit\r"The happy path was the easy part. The work was in everything else: a prompt that never came, a device that answered with a slightly different banner after a firmware upgrade, a session that dropped halfway through a change. Every one of those had to be handled, or the script would carry on typing into a terminal that was no longer in the state it assumed.
Operating habits from the NOC
Several of those practices carry over to modern DevOps:
- Repeatability
- If a change was worth doing twice, it was worth scripting, so the hundredth site got the same change as the first.
- Failure handling
- A script that only handles success will eventually make an outage worse.
- Deployment safety
- Change one site, check it, then widen the rollout. A bad change pushed everywhere at once is very hard to undo.
- Rollback
- Before making a change, know how to put things back, and save the configuration you’re about to replace.
- Logging
- Capture every session. At three in the morning, the log is how you find out what the script really did.
- Knowing the state
- Automation acts on what it believes about a system. When that belief is wrong, it does the wrong thing confidently.
- Dependencies
- A device rarely fails alone. You have to know what sits upstream and downstream before you touch it.
- People and equipment
- Some steps were software and some were a technician in a cabinet. Coordinating the two was part of the deployment.
During a circuit outage, tracing what changed and narrowing the failure mattered more than remembering every command.
Then DevOps arrived
Shell scripts never went away. What changed is that, piece by piece, the industry agreed on standard tools for the jobs those scripts used to do:
- Jenkins gave teams standardized CI/CD pipelines.
- Docker made it possible to package an application and its dependencies consistently.
- Terraform turned infrastructure configuration into version-controlled code.
- Kubernetes standardized a huge amount of application orchestration.
- GitHub Actions moved CI/CD into the same repository as the code.
- Cloud platforms put APIs in front of infrastructure that once took a truck roll and a console cable.
Infrastructure that used to be configured by hand, device by device, could now be described in a file and applied with one command:
terraform applyDeployment scripts that used to live on somebody’s server became a pipeline that starts when code is pushed:
git push
→ CI
→ test
→ build
→ container image
→ deployAnd a process that crashed at night no longer needed someone to log in and restart it. Kubernetes notices the failed container and starts a new one.
The approach in modernizing public-sector applications combines infrastructure defined as code and a pipeline with accessibility and security checks. It shows how much of the deployment work can be defined and checked in code, compared with the manual steps of a NOC change window.
Sometimes it still feels like writing deployment scripts
Modern configuration still has sharp edges, especially where quoting and escaping interact across layers.
- YAML replaced some of the shell scripts.
- Terraform replaced some of the infrastructure scripts.
- Dockerfiles standardized how applications are packaged.
- Kubernetes manifests describe how applications should run.
- CI/CD pipelines describe how code moves from a commit to production.
Declarative infrastructure made changes easier to version and review.
Describe what you want the system to do, automate it, watch what happens, and handle the failures.
What standardization fixed
That doesn’t make modern DevOps “just scripts.” Standardization was a major engineering improvement because it changed where operational knowledge lives.
In the NOC, knowing how to deploy something could live in a shell script on one server, in a runbook that was mostly right, or in the head of the engineer who had done it last. When that engineer was on vacation, the knowledge was too.
Putting knowledge in version-controlled files makes it easier to share and audit.
- Environments you can rebuild from scratch, the same way every time
- Code review and version history for infrastructure changes
- Automated tests before anything reaches production
- Standard environments from a laptop to production
- Easier rollback, because the previous version is a commit away
- Better observability
- Much less dependence on tribal knowledge
DevOps changed from hand-written scripts that automated people at terminals to standardized, version-controlled tools: CI/CD pipelines, containers, infrastructure as code, Kubernetes and cloud APIs. Over that time, the industry turned operational knowledge into structured, repeatable instructions that machines can read and people can review.
Sharing how the system works is part of engineering leadership.
Can AI automate DevOps?
Increasingly, yes. AI can already write Terraform, Kubernetes manifests and CI/CD pipelines, read logs and stack traces, investigate failed deployments and propose fixes. It works best taking on investigation and repetitive work, with an engineer still accountable for what reaches production.
The list of things AI can help with is already long:
- Generating Terraform, Kubernetes manifests and pipeline definitions
- Reading logs, interpreting stack traces and correlating errors across systems
- Investigating failed deployments and alerts
- Explaining unfamiliar infrastructure
- Spotting suspicious configuration
- Writing monitoring queries and runbooks
- Summarizing incidents and proposing remediation
An engineer can now say something like this to an agent:
“Our Django service started returning 500s after the last deployment. Find out what changed.”
In this hypothetical workflow, an agent could assemble a trail from Git history, deployment history and incident evidence.
From a 3 a.m. page to a pull request
Today, an incident usually goes like this: an alert fires, a person wakes up, opens a dashboard, reads logs, connects with SSH or kubectl, works out what’s wrong, changes the configuration and deploys the fix.
A candidate incident workflow looks like this:
- Alert to AI agent
- AI agent to Root-cause hypothesis
- Root-cause hypothesis to Pull request
- Pull request to Tests & policy checks
- Tests & policy checks to Human approval
- Human approval to Deploy
- Deploy to Verify
The agent does the first hour of investigation before anyone is awake. It brings back a hypothesis, the evidence for it, and a proposed change as a pull request. The change runs through the same tests and policy checks as any other. A person reads it, approves it, and watches the deploy verify.
Every step that touches production state needs an explicit owner and a clear record.
Don’t hand AI the production keys
AI-assisted DevOps and AI changing production on its own are very different things.
An AI system that misunderstands an application is inconvenient. One that misunderstands IAM, networking, a production database, Terraform state, a Kubernetes cluster or a destructive command can cause a serious outage or a security incident. In the NOC, a bad script could take down a site. An agent with broad credentials can do the same thing at cloud speed.
A proposed design can borrow controls already used for human operators:
- Least privilege
- Give the agent only the access the task needs, scoped to one environment.
- Read-only by default
- Investigation needs to read logs and metrics. It doesn’t need write access.
- Pull requests, not direct changes
- Infrastructure changes go through the repository, where they get reviewed, tested and recorded.
- Human approval for production
- A named person approves every production change and owns the result.
- Tests and policy checks
- The same automated gates apply whether a person or an agent wrote the change.
- Audit trails
- Every action an agent takes is logged, so you can reconstruct what it did and why.
- Rollback
- Every change has a tested way back.
- Blast-radius limits
- Separate environments, staged rollouts and limits on how much one change can touch.
- Secrets stay out
- Production secrets never go into a prompt or a context window unless there’s no other way.
The same controls are discussed in Making AI Agents Reliable in Production.
For now, let AI take the investigation and the repetitive work, and keep the accountability with engineers.
The full circle: from Expect to AI agents
Expect scripts automated equipment designed for people typing commands into a terminal.
Then infrastructure got APIs. Then it became code. Then it became declarative, so you described the state you wanted and the tooling worked out how to get there. Each step made the machine’s interface more structured, and each one moved automation further from imitating a person at a keyboard.
An AI agent can sit above structured interfaces and assemble evidence from several tools within its permissions.
The progression looks like this:
- Console
- Shell scripts
- Expect and ksh
- Configuration management
- CI/CD
- Containers
- Infrastructure as code
- Kubernetes
- Cloud APIs
- AI-assisted operations
- Agentic operations, maybe
What lasts is the system underneath the tools
Tooling changes. The practices that help teams review changes and recover from failures carry across those changes.
What lasts is understanding the system underneath the tool:
- Networking, DNS and certificates
- Linux, processes and databases
- Security and access control
- Deployment strategies and rollback
- Distributed systems and their failure modes
- Observability
- Risk
AI is unlikely to replace DevOps engineers outright. It will write more of the Terraform, investigate more of the logs and propose more of the routine changes. Someone still has to judge whether a proposal makes sense, and know what happens when it doesn’t.
For more on learning durable concepts, see You Don’t Need to Remember Everything.
See Software Architecture Lessons From Different Systems for the related design shift.
Short answers
Can AI automate DevOps?
Increasingly, yes. AI can write Terraform, Kubernetes manifests and CI/CD pipelines, read logs and stack traces, investigate failed deployments and propose fixes as pull requests. It works best taking on investigation and repetitive work, with read-only access by default and a person approving every production change.
Will AI replace DevOps engineers?
Unlikely, at least not outright. AI will write more of the infrastructure code and do more of the first investigation during incidents. Someone still has to understand networking, security, databases and failure modes well enough to judge whether a proposed change is safe, and to own the result.
How has DevOps changed?
DevOps moved from hand-written scripts that automated people at terminals to standardized, version-controlled tools: CI/CD pipelines, containers, infrastructure as code, Kubernetes and cloud APIs. Operational knowledge that once lived in scripts, runbooks and people’s heads is now mostly in files that can be reviewed, tested and rolled back.
What did engineers use before modern DevOps?
Shell scripts such as ksh, Expect scripts that automated interactive command lines, runbooks, and people. Expect was common because a lot of network equipment had no API, so scripts waited for a prompt, sent a command and checked the response, the way an operator would. Some changes still needed a technician on site with a console cable.
What is the future of DevOps?
More AI-assisted operations: agents that investigate alerts across logs, metrics, traces and recent commits, then propose a fix as a pull request that goes through tests, policy checks and human approval. The guardrails, such as least privilege, audit trails, rollback and blast-radius limits, matter as much as the agents.
Still automating the same thing
The operating goal is familiar: understand the change, verify that it worked and retain a way to recover.
AI agents are a research direction for assembling evidence and suggesting actions within those existing controls.