85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Guides

· 5 min read

DevSecOps for AI: shifting security into the agent loop

DevSecOps for AI moves security checks into the loop where coding agents write code and AI apps call tools. See which checks to run, where, and in what order.

A dashed loop around a sparkle core passes a window, a pill, a check and a tangerine shield

DevSecOps for AI is the practice of building security checks into the loop where AI writes code and AI-native apps take actions, instead of reviewing them after release. It means checking agent permissions, prompts, tool definitions, secrets and AI-generated code on every pull request, so the team ships faster without letting coding agents or production agents open new holes.

Why classic DevSecOps falls short for AI

Classic DevSecOps assumes humans write the code and the code behaves the same way every time it runs. Both assumptions break with AI.

Coding agents now write large parts of many diffs. A developer who prompts an agent for a feature can get back new dependencies, a new API route and a widened IAM policy in one change. Reviewers skim long AI-generated diffs, so the review step that DevSecOps relied on gets thinner.

The apps themselves also changed. An AI-native app decides at run time which tool to call, based on text that may come from an attacker. Static rules written for fixed code paths cannot list every path an agent might take. Security has to cover the agent's configuration: which tools exist, what permissions they carry, what the agent can reach.

The two loops DevSecOps for AI has to cover

DevSecOps for AI covers two loops that share one pipeline.

The development loop is where coding agents write and change code. Risks here include leaked keys, poisoned or hallucinated packages, insecure code patterns, and agents that edit CI config or permissions as a side effect of a feature request.

The runtime loop is where your product's own agents act for users. Risks here include prompt injection, excessive permissions, unsandboxed code execution and open network egress. These risks are set in code and config too: tool definitions, scopes, sandbox settings and approval rules all live in the repository.

Both loops pass through the same place: the pull request. That makes the pull request the natural checkpoint for DevSecOps for AI.

What to check on every pull request

A pull request check for AI should cover what changed in the agent, not only what changed in the code. The checklist below works for most teams shipping agents:

  1. Secrets. Keys and tokens in code, config, prompts and agent environment files.
  2. Dependencies. New packages, typosquats and packages that do not exist on the registry, plus known CVEs in the agent stack.
  3. Tool definitions. New or changed tools, the permissions they request and whether write tools sit apart from read tools.
  4. Identity and scope. Changes to service accounts, OAuth scopes and IAM policies used by agents.
  5. Execution. Any path where agent-generated code runs, and whether it runs in an agent sandbox without secrets.
  6. Network. Changes to egress rules or fetch tools that accept arbitrary URLs.
  7. Output handling. Model output reaching SQL, shell, HTML or another agent without validation.
  8. Approvals. Removed or weakened human-in-the-loop gates on sends, payments, deletes and deploys.
  9. Prompts and instructions. Changes to system prompts and files like AGENTS.md that alter what agents are told to do.

Run checks 1 and 2 with existing secret scanners and dependency tools. Checks 3 to 9 need a reviewer that understands agents, because no regex can tell whether a new tool widens an agent's blast radius.

Where SAST and SCA still fit

Static analysis (SAST) and software composition analysis (SCA) still belong in the pipeline. SAST catches injection patterns and unsafe functions in code. SCA catches vulnerable dependencies.

Neither one reads agent behaviour. SAST does not know that a new delete_records tool was exposed to an agent that reads customer emails. SCA does not know that the MCP server you added passes your provider key to every command. Keep both, and add a layer that evaluates agent configuration against agent-specific requirements.

A rollout plan for small teams

A startup can add DevSecOps for AI in stages without stopping delivery:

  1. Week one: turn on secret scanning and dependency scanning for every repository that coding agents touch.
  2. Week two: inventory every production agent, its tools, credentials, sandbox and network access, and commit that inventory to the repository.
  3. Week three: add a pull request check for changes to that inventory, so new tools and wider scopes need explicit review.
  4. Week four: block merges on high-severity findings, and post the rest as comments with fixes.
  5. Ongoing: keep evidence from every run, because enterprise buyers will ask for it.

Start with comments, not blocks. A check that blocks every merge on day one gets switched off by day five.

Using the agent loop to secure itself

The same coding agents that create risk can collect the evidence to check it. A coding agent already reads the diff and the surrounding code. Asked the right questions, it can quote the exact lines that show how a tool is scoped or where agent code runs.

The Motiontic Security Layer (MSL) uses this pattern. On every pull request, the team's coding agent collects quoted evidence through the Motiontic MCP, a checker verifies each quote matches the commit, and MSL judges it against the ARI-42 risk index, 85 rated tools and a weekly CVE feed. The team gets a PR comment with each risk and its fix, a dashboard and a buyer-ready PDF report, and its code stays in its own CI.

Verification matters because an agent can misquote. Checking every quote against the commit keeps the evidence honest.

Mapping DevSecOps for AI to frameworks

Auditors and enterprise reviewers ask how your process maps to known references. Three are worth citing:

  1. The OWASP Top 10 for LLM Applications for risk categories such as prompt injection and excessive agency.
  2. The NIST AI Risk Management Framework for governance and lifecycle controls.
  3. MITRE ATLAS for attacker tactics against AI systems.

Pull request evidence maps cleanly to all three, and teams working toward SOC 2 or ISO 27001 can reuse it there.

FAQ

What is the difference between DevSecOps and DevSecOps for AI?

DevSecOps for AI keeps the same principle of checking security in the pipeline, and adds checks for AI-generated code, agent tools, permissions, prompts and sandboxing. It covers both the coding agents that write code and the agents your product runs.

Do coding agents make code less secure?

Coding agents can add insecure patterns, hallucinated packages or wider permissions, and long AI-generated diffs get lighter human review. Checking every pull request automatically offsets that.

Which tools do teams need for DevSecOps for AI?

Teams keep secret scanning, SAST and dependency scanning, then add a check that understands agent configuration: tools, scopes, sandboxes, egress and approvals. AI guardrails at runtime complement those pipeline checks.

How long does it take to set up?

A basic pipeline with secret and dependency scanning takes days. MSL setup happens on a 15-minute call, with the first report within 48 hours.

Want security checks inside your agent loop? Book a 20-minute call with Motiontic.

Motiontic · Published

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.