Commit 1d81a94
committed
feat: add Lambda interceptors for AgentCore gateways
Adds end-to-end support for Lambda interceptors at gateway REQUEST and
RESPONSE points: a new InterceptorPrimitive, three vended templates
(pass-through, jwt-scope-authorizer, tools-list-filter) for both Python
and Node.js, deploy-side preflight, and `logs interceptor` /
`invoke interceptor` verbs.
Primitive surface
-----------------
- `agentcore add interceptor --name --gateway --interception-points
--template --runtime [--timeout] [--no-pass-request-headers]
[--additional-policies]` for managed mode
- External mode via direct `agentcore.json` edit referencing a
customer-provided unqualified Lambda ARN
- `agentcore remove interceptor --name` reconciles deploy state on next
`agentcore deploy`
- `agentcore logs interceptor --name [--follow|--since|--until]` tails
CloudWatch for managed interceptors; external interceptors short-
circuit to a remediation message pointing at `aws logs tail`
- `agentcore invoke interceptor --name [--payload]` invokes the
underlying Lambda for managed interceptors with the same external-
mode remediation message
Schema
------
- `interceptors` array on `AgentCoreProjectSpec` with cross-field
superRefine for cardinality (max 1 per point per gateway, max 2 per
gateway) and gateway-name reference checks
- Lambda ARN regex tightened to reject version/alias qualifiers
- `passRequestHeaders`, `entrypoint`, `timeoutSeconds`, `runtime` are
optional with consumption-time defaults so user-edited
`agentcore.json` stays sparse across CLI round-trips
Deploy
------
- `validateInterceptors()` checks managed-mode codeLocation existence
and emits a masked cross-account WARN for external mode (with full
`aws lambda add-permission` remediation snippet); also wired into
`agentcore validate` so the pre-check works without invoking deploy
- `validateGatewayTargetLambdas()` does a best-effort
`lambda:GetFunction` per `lambda-function-arn` target and WARNs on
any failure (NotFound, AccessDenied, throttle) so a typo'd ARN
surfaces before CFN ROLLBACK
- Account IDs go through `maskAccountId()` for all user-visible warning
output (PII masking)
Templates
---------
- `pass-through`, `jwt-scope-authorizer`, `tools-list-filter` for
Python (`pyproject.toml` + hatchling) and Node.js (`index.mjs` +
`package.json`)
- `PackageName` Handlebars var for NPM-safe lowercase package naming
Telemetry
---------
- `has_cross_account_warning` boolean on the InterceptorPrimitive
command-run telemetry schema1 parent ae1b932 commit 1d81a94
84 files changed
Lines changed: 4481 additions & 258 deletions
File tree
- docs
- schemas
- src
- assets
- __tests__/__snapshots__
- cdk
- bin
- lib
- test
- interceptors
- node-lambda
- jwt-scope-authorizer
- pass-through
- tools-list-filter
- python-lambda
- jwt-scope-authorizer
- pass-through
- tools-list-filter
- cli
- aws
- __tests__
- cloudformation
- __tests__
- commands
- deploy
- import/__tests__
- invoke
- logs
- __tests__
- remove
- validate
- external-requirements/__tests__
- logging
- operations
- ab-test/__tests__
- agent/generate
- deploy
- __tests__
- dev
- __tests__
- web-ui/__tests__
- primitives
- __tests__
- telemetry/schemas
- templates
- tui/screens
- add
- deploy
- remove
- lib/packaging
- schema/schemas
- primitives
- __tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
0 commit comments