# Function actorFromContext

Audit exports - Structured audit logging (Issue #193) Split from index.ts for file size compliance (Issue #285)

- actorFromContext(
  ctx: RequestContext,
  fallback?: {
  type: "system" | "user" | "external" | "agent";
  id: string;
  name?: string;
  ip?: string;
  userAgent?: string;
  },
  ): {
  type: "system"
  | "user"
  | "external"
  | "agent";
  id: string;
  name?: string;
  ip?: string;
  userAgent?: string;
  }

  Creates an AuditActor from RequestContext.

  #### Parameters

  - ctx: RequestContext
  - `Optional` fallback: {
    type: "system" | "user" | "external" | "agent";
    id: string;
    name?: string;
    ip?: string;
    userAgent?: string;
    }

  #### Returns {
  type: "system" | "user" | "external" | "agent";
  id: string;
  name?: string;
  ip?: string;
  userAgent?: string;
  }

  - Defined in packages/nexus-agents/src/audit/secure-handler-audit.ts:27