Manual instrumentation is the code a team writes to create spans for custom logic that automatic tracing cannot see. It is used for retrieval, business rules, or other application-specific steps, and it fills gaps where framework hooks do not expose enough context for debugging or governance.
Expanded Definition
Manual instrumentation is the deliberate code a team adds to create spans around application steps that automatic tracing cannot observe. In NHI and agentic systems, that often includes retrieval calls, policy checks, orchestration branches, or business rules that determine what an agent or service account is allowed to do next. It differs from auto-instrumentation because the developer chooses the boundaries, naming, and context fields, which makes the trace more precise but also more dependent on disciplined implementation. In practice, manual instrumentation is used when the framework hook is too coarse, the runtime hides a step, or governance needs a clear record of a sensitive action.
Definitions vary across vendors on how much manual instrumentation should be added, but the operational goal is consistent: capture the minimum useful context without leaking secrets or creating noisy traces. The most common misapplication is treating manual spans as a substitute for controls, which occurs when teams add logging around sensitive logic but fail to enforce access policy or secret handling.
For background on the broader identity and observability context, see the NIST Cybersecurity Framework 2.0.
Examples and Use Cases
Implementing manual instrumentation rigorously often introduces development overhead, requiring organisations to weigh better visibility against added code maintenance and the risk of inconsistent span design.
- Wrapping an agent retrieval step so the trace shows which knowledge source was queried before the model answered.
- Adding spans around a policy decision so reviewers can see when a privileged action was approved, denied, or escalated.
- Instrumenting a secrets lookup path to show when an application fetched a token without exposing the token value itself.
- Marking a business-rule branch that changes execution based on customer tier, region, or risk score.
- Tracing a service-account action during deployment so later investigations can separate automation from human-initiated change.
For NHI governance context, the Ultimate Guide to NHIs is useful because it ties visibility to lifecycle and control gaps. Manual instrumentation is most valuable when the team needs a traceable record of a step that automatic tooling skips, but it should not duplicate every ordinary code path.
Why It Matters in NHI Security
Manual instrumentation matters because NHI incidents are often investigated through incomplete traces, especially when service accounts, API keys, and agent actions cross multiple systems. NHI Mgmt Group reports that only 5.7% of organisations have full visibility into their service accounts, which helps explain why teams struggle to reconstruct what happened after a compromise or misfire. The same visibility gap makes it harder to verify whether an agent used the correct retrieval source, whether a privileged step was approved, or whether a secret was handled safely.
Used well, manual spans improve auditability, accelerate root-cause analysis, and support governance over autonomous workflows. Used poorly, they can expose sensitive context, create false confidence, or flood telemetry with low-value events. The strongest practice is to instrument only the decision points that matter for security, accountability, or incident reconstruction, then pair those spans with access controls and retention rules. Organizations typically encounter the need for manual instrumentation only after an incident review shows that the critical step was invisible, at which point the term becomes operationally unavoidable to address.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST Zero Trust (SP 800-207) and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | NHI-02 | Manual spans help expose agent decision points and tool-use context for auditability. |
| OWASP Non-Human Identity Top 10 | NHI-01 | Visibility into service-account actions supports NHI governance and investigation. |
| NIST CSF 2.0 | DE.CM | Telemetry and monitoring are central to detecting and analyzing anomalous identity activity. |
| NIST Zero Trust (SP 800-207) | PR.AC | Traceable decision points support least-privilege enforcement in dynamic access paths. |
| NIST AI RMF | GOV-2 | Governance requires transparency into AI system operations and decision boundaries. |
Add targeted spans where NHI behavior is otherwise opaque, then protect trace data from secret leakage.
Related resources from NHI Mgmt Group
- When does automation help NHI security more than manual review?
- When does Kubernetes RBAC become too manual to govern safely?
- How can organisations reduce manual effort in access certification and evidence collection?
- What is the difference between manual access administration and automated lifecycle governance?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org