Moving an AI agent from a development environment into production requires more than confirming that it can answer questions or call tools successfully.
Production agents operate with real users, real data, real permissions, and real business consequences. A system that works during a controlled demonstration can still fail when it encounters unexpected inputs, unavailable tools, model errors, authorization problems, or high request volume.
A production-ready AI agent therefore needs measurable controls around four areas:
Observability
Governance
Evaluation
Recovery
These areas should be designed together rather than added after deployment.
What Does Production Readiness Mean?
A useful definition is:
An AI agent is production-ready when its behavior can be observed, evaluated, governed, and safely recovered when something goes wrong.
The architecture can be represented as:
AI Agent
|
+---------------+---------------+
| | |
v v v
Observability Governance Evaluation
| | |
+---------------+---------------+
|
v
Recovery
|
v
Production SystemEach layer addresses a different risk.
| Area | Primary question |
|---|---|
| Observability | What happened? |
| Governance | Was the behavior allowed? |
| Evaluation | Was the result correct? |
| Recovery | What happens when it fails? |
Start With Explicit Production Criteria
Before deployment, define measurable acceptance criteria.
For example:
Agent
├── Observability
│ ├── Execution tracing
│ ├── Error logging
│ └── Latency metrics
│
├── Governance
│ ├── Authentication
│ ├── Authorization
│ └── Tool restrictions
│
├── Evaluation
│ ├── Regression tests
│ ├── Quality evaluation
│ └── Safety checks
│
└── Recovery
├── Retry
├── Timeout
├── Fallback
└── Human escalationThis converts the vague concept of "production-ready" into specific engineering requirements.
Observability
AI agents require visibility into more than HTTP requests.
A single execution may contain:
User Request
↓
Model Call
↓
Tool Call
↓
Database Query
↓
Model Call
↓
Final ResponseThe telemetry should make this execution understandable.
Useful information includes:
Execution ID
Agent name
Model
Channel
Tool name
Duration
Token usage when available
Retry count
Error category
Final status
Use Structured Logging
A structured log entry is easier to search than a plain message.
logger.LogInformation(
"Agent execution completed. " +
"ExecutionId={ExecutionId}, " +
"DurationMs={DurationMs}, " +
"Succeeded={Succeeded}",
executionId,
stopwatch.Elapsed.TotalMilliseconds,
true);Avoid logging sensitive prompts, credentials, authorization headers, or confidential customer information.
Add Distributed Tracing
For multi-step workflows, tracing provides the relationship between operations.
agent.execute
│
├── model.call
│
├── tool.search
│
├── tool.database
│
└── model.callA .NET application can use ActivitySource:
using System.Diagnostics;
public static class AgentTelemetry
{
public static readonly ActivitySource Source =
new("ProductionAgent");
}Then create an activity around execution:
using var activity =
AgentTelemetry.Source.StartActivity(
"agent.execute");
activity?.SetTag(
"agent.name",
"support-agent");
activity?.SetTag(
"agent.execution_id",
executionId.ToString());OpenTelemetry can then export traces and metrics to the observability infrastructure used by the organization.
Measure the Right Metrics
At minimum, track:
| Metric | Purpose |
|---|---|
| Request count | Understand traffic |
| Success rate | Measure reliability |
| Failure rate | Identify problems |
| P50 latency | Typical performance |
| P95 latency | Slow-request behavior |
| P99 latency | Tail performance |
| Tool failure rate | Identify dependency problems |
| Retry count | Detect transient failures |
| Token usage | Understand model consumption |
Averages alone can hide slow requests.
For example:
Average: 1.2 seconds
P95: 5.8 seconds
P99: 12.4 secondsThe average looks healthy, but a significant tail may still create a poor user experience.
Governance
Governance defines what an agent is allowed to do.
This should include:
Identity
Authentication
Authorization
Tool permissions
Data access
Auditability
Human approval requirements
A simple architecture is:
Request
↓
Authentication
↓
Authorization
↓
Agent
↓
ToolThe model should not be the final authority for permission decisions.
Keep Authorization Deterministic
Consider a refund operation.
The agent might determine that a user wants a refund, but the application should determine whether that refund is allowed.
public interface IAuthorizationService
{
Task<bool> CanRefundAsync(
string userId,
string orderId,
CancellationToken cancellationToken);
}Then:
var allowed =
await authorizationService.CanRefundAsync(
userId,
orderId,
cancellationToken);
if (!allowed)
{
return new AgentResponse(
"The requested operation is not permitted.",
false);
}This creates a deterministic security boundary around agent behavior.
Tool Governance
Every tool should have an explicit risk profile.
Read Data
↓
Lower Risk
Modify Data
↓
Higher Risk
Delete / Financial Operation
↓
High RiskA tool registry can capture this metadata:
public enum ToolRisk
{
Low,
Medium,
High,
Critical
}
public sealed record ToolDefinition(
string Name,
ToolRisk Risk,
bool RequiresApproval);For example:
var refundTool = new ToolDefinition(
"IssueRefund",
ToolRisk.Critical,
true);The agent can request the tool, but the application can require an additional approval step before execution.
Human Approval for High-Risk Actions
Not every action should execute automatically.
A useful pattern is:
Agent
↓
Requests Action
↓
Risk Check
|
+---- Low Risk → Execute
|
+---- High Risk → Human ApprovalFor example:
Search Order
→ Automatic
Update Address
→ Policy Check
Issue Refund
→ Human ApprovalThe exact policy depends on the application's business requirements.
Evaluation
Production readiness requires continuous evaluation.
A test suite should include representative scenarios:
Correct Request
Incorrect Request
Ambiguous Request
Unauthorized Request
Tool Failure
Missing Data
Prompt Injection Attempt
Model Failure
TimeoutEach test should define expected behavior rather than necessarily requiring an exact response string.
For example:
public sealed record EvaluationCase(
string Id,
string Input,
string ExpectedBehavior,
ToolRisk Risk);This allows the same test set to be executed against different agent versions.
Deterministic Evaluation
Use deterministic checks whenever possible.
For example:
Assert.False(
result.ExecutedUnauthorizedTool);Or:
Assert.Equal(
"ORDER_NOT_FOUND",
result.ErrorCode);Deterministic checks are particularly important for:
Authorization
Business rules
Tool permissions
Data validation
Required fields
Security controls
AI-Based Evaluation
Some characteristics are inherently open-ended.
For example:
Was the response relevant?
Was the explanation complete?
Was the response grounded in the retrieved information?An AI evaluator can help assess these dimensions.
Use a defined rubric:
1 = Incorrect
2 = Major issues
3 = Acceptable
4 = Good
5 = ExcellentStore the evaluation result:
public sealed record EvaluationResult(
double Score,
bool Passed,
string Reason);
Join the conversation! Your thoughts help the community grow.