Skip to main content
Coding Agent Governance is admin-driven. Before a developer machine can send a single event, an admin must turn on the feature and issue an API key with the right role. The admin then rolls hooks out to the supported coding agents in each developer environment. In-built policies ship enabled, so basic enforcement starts as soon as hooks run. You review the catalog and add custom rules after deployment. Complete the following tasks to set up Coding Agent Governance.
  1. Confirm Coding Agent Governance is available in your tenant.
  2. Create an API key with the AI Audit User role to ship with hooks.
  3. Deploy hooks on developer machines. See Deploy hooks for Cursor, Claude Code, Codex, and GitHub Copilot.
  4. Review in-built policies and write any custom rules your organization needs. See Write a policy.
Skipping any step delays results. Inventory and policy enforcement both need hooks to run. The in-built policy catalog enforces as soon as hooks ship. Custom policies layer on top for organization-specific rules.

Confirm Coding Agent Governance is available

Select Agent Governance from the left sidebar. If the entry is missing, contact your account team to enable Coding Agent Governance for your tenant.

Create an API key with the AI Audit User role

The AI Audit User role is a least-privilege system role for Coding Agent Governance hooks. An API key with this role can submit hook events, read your policy snapshot for local evaluation, read the Coding Agent Governance inventory, and write operational client logs. It cannot read policy violations or any Endor Labs data outside Coding Agent Governance.
Treat the API key and secret as production credentials. Any host with these values can submit hook events as your tenant.

Create the API key through the user interface

  1. Select Settings > Access Control from the left sidebar.
  2. Select API Keys, then click Generate API Key.
  3. Enter a name that identifies the key, such as agent-governance-hooks.
  4. Under Role, choose AI Audit User.
  5. Choose an expiration that matches your rotation policy.
  6. Click Generate, then copy the key and secret. Store both in your secret manager. Endor Labs shows the secret only once.
See Manage API keys to manage this key over time.

Create the API key with endorctl

For MDM-driven rollouts or automated provisioning, create the key with endorctl. Replace <namespace> with the namespace that owns your Coding Agent Governance policies, <key-name> with a descriptive name for the key, and <YYYY-MM-DDTHH:MM:SSZ> with the expiration in ISO 8601 UTC format.
The response contains the API key and secret under spec.key and spec.secret. Capture both before the response scrolls out of your terminal. Endor Labs returns the secret only once. See Create an API key through Endor Labs API for the full API reference, including longer expirations and namespace propagation.

Data collection

Each hook event carries the metadata Endor Labs needs for inventory and policy evaluation:
  • Agent name, version, and (where available) model
  • Session and sub-session IDs
  • Device (endpoint) identifier
  • Session configuration, such as permission mode and sandbox state
  • User identifier when the agent provides one
  • Repository name (not populated for Claude Code sessions) and working directory
  • MCP server name, tool name, and call counts
  • Shell command line (regex-matched against your policies)
  • File path and operation type (read, write, delete, edit)
  • Secrets check match (rule, line, column, and fingerprint, never the secret value)
  • Policy match outcome and the action applied

Secret redaction

Endor Labs runs every command line, file path, URL, environment value, and MCP tool input or output through a regex-based redactor before it leaves the developer’s machine. Environment variables and keys named like a secret (such as TOKEN, SECRET, API_KEY, PASSWORD, or AUTHORIZATION) become [REDACTED]. The redactor also matches common secret formats in place: URL and database-connection credentials, AWS access keys, JWTs, PEM private keys, and provider tokens such as GitHub (ghp_*), OpenAI, and Anthropic keys. Redaction of event payloads is best-effort regex pattern matching. A secret that does not match a known pattern or key name can still reach the backend. The secrets check is separate from redaction: it detects secrets in file content on the developer’s machine, and its violations carry the rule and location, never the value.
On Cursor, the sessionStart hook returns the Endor Labs credential values to Cursor in plaintext under an AGENT_HOOK_ENDOR_* prefix, so subsequent hooks in the session inherit them. The values never leave the developer’s machine, but anything that captures Cursor hook stdout (such as debug logging or screen recording) can see them.

Distribute credentials to developer machines

Hooks read credentials from environment variables wherever they run:
  • ENDOR_API: The Endor Labs API endpoint, for example https://api.endorlabs.com.
  • ENDOR_NAMESPACE: The Endor Labs namespace that owns the policies and receives the events.
  • ENDOR_API_CREDENTIALS_KEY: The API key value.
  • ENDOR_API_CREDENTIALS_SECRET: The API secret.
For Cursor, Codex, and GitHub Copilot, set the variables in the environment that launches the agent. For Claude Code, set them in the env block of settings.json, as shown on Deploy hooks for Claude Code. Use your MDM (Jamf, Intune, Kandji, JumpCloud) to deliver the values, and to ensure endorctl is on PATH, on every machine that runs an Endor Labs hook. Do not distribute ENDOR_TOKEN alongside these variables. Hooks authenticate with the API key and secret only, and on older versions of endorctl the extra token triggered a mixed-authentication error that blocked endorctl ai-audit. See endorctl CLI to install endorctl.

Confirm supported agents and platforms

Coding Agent Governance hooks support Cursor, Claude Code, Codex, and GitHub Copilot on macOS, Linux, and Windows developer machines. See Supported agents and platforms for the full matrix, including hosted and CLI form factors.

Next steps

After you complete the prerequisites, proceed to the next steps: