For the complete documentation index, see llms.txt. This page is also available as Markdown.

Kiro CLI Hooks

Akto Guardrails for Kiro CLI brings real-time security validation to AI interactions by hooking into Kiro CLI's native lifecycle hooks — validating prompts and tool calls before they execute, and reporting every event to your Akto dashboard.

Key Features

  • Zero Installation - No standalone apps to install

  • Transparent Integration - Uses Kiro CLI's native hook mechanism

  • Real-time Protection - Validates every prompt and tool call

  • Centralized Monitoring - All events reported to Akto dashboard

  • Flexible Deployment - Supports Argus and Atlas modes

  • Configurable Behavior - Blocking or observation modes

How It Works

Kiro CLI's hook system executes custom scripts at three points:

3 Hook Points:

  1. userPromptSubmit - Ingests prompts before they're sent to the model. Cannot block — a non-zero exit only shows the user a warning, the prompt still proceeds.

  2. preToolUse - Validates tool requests before execution. The only event that can block: exit code 2 rejects the tool call.

  3. postToolUse - Ingests tool input/output after execution (observational only).

File Structure

Key Files:

  • Wrapper scripts (.sh): Set environment variables, invoke akto-hooks.py

    • ⚠️ Contains AKTO_DATA_INGESTION_URL placeholder - Must be replaced with your Akto instance URL

  • akto-hooks.py: Single dispatch script — routes preToolUse to a blocking runner, userPromptSubmit to a warn-only runner, and everything else to an observability-only runner

  • akto_ingestion_utility.py: Core validation/ingestion logic and Akto API communication

  • akto_machine_id.py: Generates unique device identifiers for Atlas mode

  • Agent config (hooks block): Links hooks to wrapper scripts

Setup Guide

Prerequisites

  • Kiro CLI installed (Installation Guide)

  • Akto instance URL

  • Python 3.7+

  • macOS, Linux, or Windows with bash/zsh

Installation Steps

1

Create Directories

2

Download Hook Scripts

3

Configure Akto Ingestion URL, API Token and Device ID ⚠️ CRITICAL STEP

Automated replacement:

Manual replacement (alternative):

Edit each wrapper script and replace:

With:

Files to update:

  • akto-validate-prompt-wrapper.sh

  • akto-validate-pre-tool-wrapper.sh

  • akto-validate-post-tool-wrapper.sh

4

Configure Hooks

Merge the hooks block below into your kiro-cli agent config (~/.kiro/agents/<agent-name>.json, or edit via kiro-cli agent edit):

5

Configure Hook Behavior (Optional)

Edit wrapper scripts to customize:

Mode Options:

  • Argus: Standard validation and reporting

  • Atlas: Includes device-specific metadata

Sync Mode:

  • true: Blocks threats on preToolUse (exit code 2)

  • false: Reports but allows execution

6

Install Python Dependencies

7

Verify Installation

Check logs to confirm hooks are working:

Test by running a Kiro command:

You should see log entries indicating validation occurred.

Configuration Reference

Wrapper Script Variables

How DEVICE_ID is reported: the hooks send <DEVICE_ID>.ai-agent.kirocli as the request host, and the dashboard uses the first label of that host as the device name. If DEVICE_ID is empty the hooks fall back to the lowercased computer name (or, where that cannot be resolved, the raw machine UUID — which is why a device sometimes shows up as a bare hex string).

Environment Variables (Optional)

Override defaults via environment variables or config file:

Option 1: Environment variables

Option 2: Config file

Troubleshooting

Hooks Not Executing

Ingestion URL Not Configured

Check Logs for Errors

Events Not in Dashboard

Python Dependencies Missing

Uninstallation

To completely remove Akto hooks from Kiro CLI:

Complete Removal

Selective Removal (Keep Logs)

If you want to preserve logs for audit purposes:

Backup Before Removal

Verify Removal

Restore Kiro CLI to Default

After uninstallation, Kiro CLI will operate without Akto security monitoring. No additional configuration is needed beyond removing the files and the hooks block. Test with:

Enterprise Deployment

Automated Deployment Script

Deploy to developers:

Quick Setup Summary

Resources

Last updated