Straiker Coding Agent Streaming

Third Party
Related Documentation
Made by
Compatible Protocols
grpc grpcs http https
Minimum Version
Kong Gateway - 3.14
Tags

Third Party: This plugin is developed, tested, and maintained by Straiker.

Use the Straiker Coding Agent Streaming plugin (straiker-coding-agent-streaming) to scan Anthropic Messages traffic from Claude Code and other coding agents against Straiker Defend policy, without buffering or delaying the streamed response.

Coding agents call tools on the developer’s machine, outside the request/response cycle a gateway can inspect. Kong Gateway sees the wire, not the endpoint: interactive permission decisions, cwd, and permission_mode aren’t visible to this plugin. What Straiker Coding Agent Streaming does see is tool calls that fail and @-mention file reads that never become a tool call, both of which endpoint-based tooling often misses.

Straiker Coding Agent Streaming ships in the same LuaRock as the Straiker and Straiker coding agent buffered plugins, but only one Straiker plugin should be attached to a given Route. Never attach both coding-agent plugins to the same Route.

Note: This plugin is built for AI Gateway running on Kong Gateway. It has not been validated against AI Gateway 2.0.

Which Straiker plugin do I need?

The right plugin depends on the client sending the traffic:

 
flowchart TD
  start["LLM traffic through Kong Gateway"]
  start --> q1{"What is the client?"}
  q1 -->|"Chat app, assistant, RAG"| A["Straiker
webhook plugin"] q1 -->|"Claude Code or other Anthropic
Messages coding agent"| q2{"Must a tool call be
stopped before it runs?"} q2 -->|"No, interactive developers"| B["Straiker Coding Agent Streaming"] q2 -->|"Yes, CI or unattended agents"| C["Straiker Coding Agent Buffered"] click A "/plugins/straiker/" click B "/plugins/straiker-coding-agent-streaming/" click C "/plugins/straiker-coding-agent-buffered/"

Benefits of using the Straiker Coding Agent Streaming plugin:

  • No added latency to the first token: The client’s stream is forwarded untouched while scoring happens.
  • Detects indirect prompt injection: Denies a poisoned tool_result on the next request, before the model consumes it.
  • Centralizes AI security enforcement: Applies Straiker Defend policy at the gateway instead of relying on endpoint agents alone.
  • Fits interactive development: Suited to developers who need immediate tool execution, unlike the buffered plugin.

How it works

A tool runs locally, so the model’s decision to call a tool first appears in the response, and the tool’s result appears in the developer’s next request:

 
sequenceDiagram
    participant Agent as Coding agent
    participant Kong as Kong Gateway
    participant LLM

    Note over Agent,LLM: Turn N, the model decides to run a tool
    LLM-->>Kong: Response with tool_use
    Kong-->>Agent: Streaming, client already has tool_use
    Note over Agent: Tool runs on the developer's machine
    Agent->>Kong: Turn N+1, messages include tool_result
    Note over Kong: Straiker Defend can deny here,
stopping the model from consuming a poisoned result

Straiker Coding Agent Streaming runs in the access phase, and relays the response asynchronously when config.relay_response is enabled:

 
sequenceDiagram
    autonumber
    participant Agent as Claude Code
    participant Plugin as Straiker Coding Agent
Streaming plugin participant Defend as Straiker Defend participant LLM as Anthropic Agent->>Plugin: POST /v1/messages Plugin->>Defend: request phase Defend-->>Plugin: verdict alt If prompt or poisoned tool_result denied Plugin-->>Agent: HTTP 200 end_turn (policy text) else If allowed Plugin->>LLM: Forward LLM-->>Agent: Stream (untouched) Plugin-->>Defend: async response relay end

Because Straiker Coding Agent Streaming can’t hold the response, it can’t stop a tool_use before the client runs it. Use the buffered plugin when a tool call must be stopped before it runs, for example in CI or unattended agents.

Plugin priority

Straiker Coding Agent Streaming runs at priority 1000, so it reads the client body before AI Proxy or AI Proxy Advanced (both priority 770) would translate it. For more information, see plugin priority.

AI Proxy can front Straiker Coding Agent Streaming. It still inspects prompts and tool results normally.

Body buffer

Set this before attaching Straiker Coding Agent Streaming. At Kong Gateway’s 8 KB default client_body_buffer_size, a Claude Code request body (often 138 KB, over 1 MB with a large tool set) spills to an nginx temp file, the plugin can’t read the raw body, and traffic is proxied without inspection, returning HTTP 200 with x-straiker-verdict: fail-open-no-body.

nginx_http_client_body_buffer_size = 32m

Or set KONG_NGINX_HTTP_CLIENT_BODY_BUFFER_SIZE=32m. Also raise nginx_http_client_max_body_size to 64m. This setting is node-level and needs a restart to take effect. If you can’t set it, for example on a fully Konnect-managed data plane, request-body inspection isn’t possible.

Path matching

Straiker Coding Agent Streaming only inspects paths that end in /v1/messages, not /v1/messages/count_tokens. If your Route rewrites that suffix away, there’s no x-straiker-verdict header at all.

Install the Straiker Coding Agent Streaming plugin

LuaRock name: kong-plugin-straiker (current version 0.11.0-1). This single rock provides all three Straiker plugins: straiker, straiker-coding-agent-streaming, and straiker-coding-agent-buffered.

Prerequisites

Before installing the plugin, you need:

  • Kong Gateway 3.14 or later.
  • A Straiker account and Straiker Defend API key. Contact your Straiker team for enterprise API keys and sandbox access.
  • Network egress from Kong Gateway data planes to Straiker Defend.
  • nginx_http_client_body_buffer_size raised, as described in Body buffer.
  • Optional: Kong authentication plugins configured to map callers to Consumers.

Konnect Serverless and Dedicated Cloud Gateways aren’t supported. Custom plugins are rejected on those topologies. Use self-managed Kong Gateway or Konnect hybrid mode instead.

Installation steps

Enable the plugin

Straiker Coding Agent Streaming usually proxies Anthropic Messages traffic directly, for example to https://api.anthropic.com, rather than sitting behind AI Proxy. See the Enable Straiker coding agent streaming example.

Point Claude Code at your Kong Gateway Route:

export ANTHROPIC_BASE_URL=https://kong.example.com/claude-code
export ANTHROPIC_API_KEY=placeholder

Then start Claude Code:

claude

Claude Code appends /v1/messages to ANTHROPIC_BASE_URL itself, so don’t include it in the URL. If Kong Gateway injects the upstream credential, for example with Request Transformer, ANTHROPIC_API_KEY can be a placeholder value.

Note: A policy block is an HTTP 200 response with the Anthropic stop_reason set to end_turn, not an HTTP error. Claude Code treats a 403 as an auth failure and retries a 5xx, so alert on the x-straiker-verdict header and the straiker object in your log serializer output, not on HTTP status.

Test the plugin

Send a minimal request with a tool defined:

curl -i -X POST https://kong.example.com/claude-code/v1/messages \
  -H 'content-type: application/json' \
  -H 'x-api-key: placeholder' \
  -H 'anthropic-version: 2023-06-01' \
  -H 'x-claude-code-session-id: install-check-1' \
  -d '{"model":"claude-sonnet-4-5-20250929","max_tokens":32,"stream":true,
       "tools":[{"name":"Bash","description":"run","input_schema":{"type":"object"}}],
       "messages":[{"role":"user","content":[{"type":"text","text":"say OK"}]}]}'

You want an HTTP 200 response, an SSE stream, and x-straiker-verdict: allow. A fail-open-* value means traffic is flowing but inspection is degraded.

Troubleshooting

No x-straiker-verdict header on coding-agent traffic

Symptoms: Requests reach the upstream model, but there’s no x-straiker-verdict header in the response.

Possible solutions:

  • Confirm the request path ends in /v1/messages, not /v1/messages/count_tokens.
  • Confirm Straiker Coding Agent Streaming is attached to that Route.
  • A fail-open-no-body verdict means the request body spilled past the buffer. See Body buffer.
  • A fail-open-no-key verdict means a vault reference didn’t resolve. If you’re using the environment vault, also set KONG_NGINX_MAIN_ENV.

Plugin not found

Symptoms: Kong Gateway returns plugin 'straiker-coding-agent-streaming' not enabled.

Possible solutions:

  • Confirm the plugin files are installed on every data plane node.
  • Confirm KONG_PLUGINS includes straiker-coding-agent-streaming and still includes bundled.
  • Restart or reload Kong Gateway after installation.
  • In Konnect hybrid mode, confirm the plugin schema was uploaded to the control plane.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!