Instrument agents, orchestrators, gateway hops, tools, and skills with the current Sec0 decorator workflow.
sec0-sdk/instrumentation turns your application methods into audited Sec0 hops. It loads hop metadata from sec0.config.yaml, injects an AgentManager into decorated methods, propagates canonical agent state, and can apply hop-level policy enforcement on top of the underlying business logic.
Decorators can now enforce policy directly from hop config. This is useful when the hop itself returns or throws a policy outcome and you want consistent deny and escalation handling in the audit layer.Example:
With this enabled, decorated hops can trigger policy outcomes by:
returning policy_breaches: string[]
returning policy_violation: string
throwing an error that carries denial_reason
The decorator converts the outcome into a POLICY_DENIED error, appends the signed audit envelope, and includes escalation_id and escalation_status when escalation is configured.
import { generateRunRef, generateTraceId, generateSpanId, seedSec0Run, getConfig, getSec0AppConfig, getSec0Directories,} from "sec0-sdk/instrumentation";const runId = generateRunRef();const traceId = generateTraceId();const spanId = generateSpanId();seedSec0Run(runId, () => { // Any decorated hop called in here inherits the seeded run id});