Action result variables
After theai-gateway action runs, detailed results are available in ${actions.ngrok.ai_gateway}. This includes:
- Model selection process and filtering steps
- Every model and request attempted
- API key selection details
- Token counts
- Latency measurements
- Error details for failed attempts
Schema
Accessing action results
To access action results, configureon_error: "continue" so subsequent actions can inspect the data:
Cloud Endpoints require a terminal action such as
deny, custom-response, redirect, or forward-internal to complete the request. See Cloud Endpoints for more details.Debugging patterns
Return results as response (development)
During development, return the full action result to the client for inspection:Send to log exports (production)
In production, send action results to your logging infrastructure:Combined approach
Log the results and return a user-friendly error:Interpreting results
Identifying rate limits
Look forstatus_code: 429 in request responses:
Identifying model filtering issues
When you getERR_NGROK_3804 or want to understand what the gateway did, check model_selection to understand how models were filtered:
client.model and adjust your configuration or the client request. Model names/spelling may be wrong. Try adding the provider prefix for new models or models not in the gateway config or model catalog.
Identifying timeout issues
Look for attempts without astatus_code or with timeout errors:
per_request_timeout or investigate provider latency using upstream_latency metrics.
Understanding latency
Use the latency measurements to identify bottlenecks:time_to_first_byte_ms/total_ms indicates slow provider response. High gateway_latency_ms indicates gateway processing overhead. Increase per_request_timeout/total_timeout or investigate provider latency.
Next steps
Troubleshooting
Error codes and solutions
Log Exporting
Export logs to your observability platform