AI agents are not static applications. Their behavior can depend on model versions, instructions, retrieval sources, tools, identities, permissions, and the data they encounter while running.
That makes security a lifecycle problem. Some risks can be identified before deployment; others only become clear when an agent interacts with real systems and users.
Build-time and runtime security address different parts of that problem.
What build-time security can tell you
Build-time security reviews the agent and its surrounding application before or during release. Depending on the implementation, this may include:
- Reviewing source code, dependencies, and infrastructure configuration.
- Inspecting prompts, tool definitions, and declared model settings.
- Checking for hard-coded secrets and unsafe permission patterns.
- Testing expected behavior against a defined set of scenarios.
- Reviewing data flows, trust boundaries, and approval requirements.
- Confirming that deployment configuration meets organizational policy.
These checks are useful because weaknesses can often be corrected before the system reaches production. They also create a baseline against which later changes can be evaluated.
However, a build-time review only sees the artifacts and evidence available to it. It may not reveal every resource an agent can reach after deployment, every permission inherited from its runtime identity, or every behavior triggered by live input.
What runtime security can tell you
Runtime security focuses on the system as it operates. Depending on the available telemetry and controls, teams may observe:
- Which identities and tools the agent uses.
- Requests, responses, and tool-call sequences.
- Attempts to access data or perform actions.
- Changes in configuration, permissions, or connected services.
- Policy violations, errors, and unusual activity.
- Whether high-impact actions follow the required approval process.
Runtime visibility can expose differences between intended configuration and actual behavior. It can also support detection and investigation when something unexpected happens.
But runtime monitoring has limits too. It cannot reliably detect activity that produces no available telemetry, and a log is not the same as a preventive control. A system that records an unauthorized action after it happens may still have caused harm.
The gaps between the two
Consider an agent designed to summarize internal documents. At build time, a review may confirm that the application uses an approved model and that the declared tool configuration looks reasonable. At runtime, the agent may inherit a broader identity than expected or receive a document containing adversarial instructions.
The first weakness concerns effective access. The second concerns behavior under untrusted input. Neither is fully addressed by checking the model name alone.
Other examples include:
- A dependency is safe at release but later receives a security advisory.
- A tool is configured correctly but its permissions are changed after deployment.
- A test passes for a prompt but misses a multi-step interaction.
- A runtime alert detects a risky action, but the application has no approval gate to stop it.
A combined lifecycle approach
Before deployment: Establish the intended purpose, data boundaries, identities, tool permissions, and approval requirements. Review code and configuration, test behavior, and document the approved baseline.
At deployment: Verify the effective configuration, secrets handling, network access, and identity permissions. Make sure required logging and control mechanisms are enabled.
During operation: Monitor relevant tool use, access, policy decisions, configuration changes, and errors. Enforce authorization and approval in trusted application layers. Route meaningful alerts to accountable owners.
After changes: Reassess when models, prompts, tools, data sources, identities, or permissions change. Retest the controls affected by the change and preserve evidence.
Prioritize controls by consequence
Not every agent needs the same level of oversight. A read-only internal helper has a different risk profile from an agent that can modify customer records, deploy software, or access sensitive data.
Use the agent's purpose, access, exposure, and potential impact to determine the appropriate combination of pre-release testing, runtime monitoring, approval gates, and periodic review.
Treat evidence as part of security
A useful program connects build-time findings with runtime observations. If an agent is approved under a specific configuration, teams should be able to detect material drift from that baseline. If runtime monitoring reveals a new tool or unexpected access path, the information should feed back into the next review.
Build-time security asks, “Is this agent ready to run under the intended conditions?” Runtime security asks, “Is it operating within those conditions now?”
The strongest approach does not choose one over the other. It uses both to reduce the gap between what an agent was designed to do and what it can actually do.
