Experimental

Prompt injection detection

Prompt injection detection screens each tool result, and blocks it if it contains a prompt injection.

Prompt injection detection is available on paid plans, with usage-based pricing.

To turn it on, add a hook with the prompt_injection_check handler:

session = composio.create(
    user_id="user_123",
    hooks=[
        {
            "id": "block_injection",
            "type": "after_execute",
            "applies_to": "all",
            "handler": {"type": "prompt_injection_check", "action": "block"},
        },
    ],
)

When a result is blocked, your agent gets an error instead of the content. See Blocked tool calls for what's returned.

prompt_injection_check only works in after_execute hooks, since tool results are where outside content reaches your agent.