1
0
mirror of synced 2026-08-05 11:07:15 +00:00

641 Commits

Author SHA1 Message Date
mchaitra fa72a1ed57 Add 04-migrate-to-new-namespace directory for registry namespace migration sample (#1886) 2026-08-03 17:03:48 -07:00
Guruprasad 9018c5e3c7 fix: self-managed strategy sample - remove invalid namespaces, fix IA… (#1858)
* fix: self-managed strategy sample - remove invalid namespaces, fix IAM and CLI docs (#1856)

* fix: rename namespaces to namespaceTemplates per reviewer feedback
2026-08-03 16:37:47 -04:00
Rui Cardoso ee31c1790e feat(harness/14-s3-filesystem): optional script to provision the S3 Files prerequisites (#1881)
Both scripts in this sample mount an existing S3 Files access point, and nothing
in the folder creates one — so on a fresh account --access-point-arn,
--subnet-ids and --security-group-ids have nothing to point at and the sample
cannot be run at all.

Adds an optional provision_s3_filesystem.py that creates the prerequisites
(versioned bucket, service role, file system, access point, a mount target per
subnet, and an NFS security group) and prints the exact command line to paste
into either script. The sample scripts themselves are unchanged.

Networking is bring-your-own by default: the script discovers private subnets
that already have NAT-gateway egress rather than creating a VPC, because a NAT
gateway bills hourly. --create-vpc is opt-in.

Every resource is recorded in provision_state.json as it is created, and
--teardown deletes only what is recorded there.
2026-08-03 09:18:21 -03:00
Rui Cardoso f67f2c041f fix(harness/14-s3-filesystem): missing IAM permission, leaked execution role, and false-pass command guards (#1880)
The sample could not create a harness at all: the execution-role policy was
missing s3files:ListMountTargets, which the runtime validates at create time,
so CreateHarness was accepted and then landed in CREATE_FAILED.

Also fixes an execution-role leak (the shared HarnessExecutionRole and its
inline policies survived every run, including successful ones, breaking the
next sample in the folder), several guards that reported success on a failed
or never-executed VM command, and a mid-stream read timeout that discarded an
answer already in hand.

README: document the bucket-versioning requirement, the real IAM scope, the
2-3 minute VPC-mode create time, and the flags that were undocumented.
2026-08-03 09:17:50 -03:00
Rui Cardoso 2ac3ce2b35 fix(harness/13-aws-skills): handle transport and throttling stream errors (#1879)
`stream_response` caught only `EventStreamError`, so a mid-stream transport
failure (`ReadTimeoutError`, `ConnectionClosedError` — both `BotoCoreError`)
or a `ThrottlingException` (a plain `ClientError`) escaped as an unhandled
traceback that named nothing about the cause, aborting the demo even when the
agent's complete answer had already been printed. Catch both base classes,
report the cause, and re-raise only when no content arrived.

Also fix `--raw-events` discarding good responses: raw mode skipped text
accumulation, so `full_text` stayed empty and the "did we receive anything?"
guard re-raised even a cosmetic close error.

Remove the dead `REGION` assignment (never read; the region actually resolves
in `utils/client.py`, which honours `AWS_DEFAULT_REGION` or `AWS_REGION`) along
with the now-unused `import os`, and the entirely unused `import boto3`.
Correct a comment that described a `tools`/`allowedTools` argument the call
does not pass.

README: add a Prerequisites section including the boto3 >= 1.43.32 floor that
`awsSkills` requires, document `--role-arn`/`--raw-events`/`--skip-cleanup`
and the ~2-3 minute wait for READY, and state the tagged-union and
wildcard semantics of `skills` entries.
2026-08-03 09:17:04 -03:00
Rui Cardoso 34e039f36a fix(06-async-step-function): report failures instead of SUCCEEDED, and fix the sample test path (#1878)
The Step Functions workflow routed a caught harness error to a Pass/End state,
so an execution whose InvokeHarness failed with AccessDeniedException finished
SUCCEEDED with nothing written to DynamoDB. The missing memory/event permissions
that caused that failure are also fixed, along with the JSON extraction (which
crashed on bare JSON and silently truncated nested objects), the retry policy
(which billed caller-fault errors four times), the --use-samples loop (which
aborted on the first sample because of word-splitting), both poll loops (which
treated ABORTED/TIMED_OUT as success), and three unreachable error handlers.

All fixes reproduced against upstream main and re-verified live in a real AWS
account over 3 deploy/teardown cycles.
2026-08-03 09:16:40 -03:00
Rui Cardoso a9b2c0c920 fix(01-harness): stop 07-oauth reporting success for a failed invoke, and leaking on failure (#1877)
InvokeHarness over HTTPS returns HTTP 200 and reports agent-side failures as
{"message": ...} frames inside the event stream. The parser read only
obj["delta"], discarded those frames, printed "(No text deltas found in
stream)", and then printed the full success narrative claiming all three auth
hops had worked. Separately, the script had no try/finally, so a failure
anywhere between Step 1a and Step 4 left two Cognito pools, a credential
provider, a Lambda, a gateway + target, a harness and three IAM roles alive.

Correctness:
- Raise on non-200, collect and raise on stream error frames, and raise when
  there are neither deltas nor an error frame.
- Grant the 8 memory/event actions the harness needs at runtime; CreateMemory
  and ListMemories take no memory ID, so they must be scoped to "*".
- Replace three fall-through polls with deadline loops that raise on terminal
  status and on timeout.
- Wrap provisioning in try/finally so cleanup always runs.
- _wait_gone no longer reports success on timeout.
- Do not print "Cleanup complete!" when resources were skipped.
- _ensure_policy publishes a new default version instead of swallowing
  EntityAlreadyExists, pruning the oldest non-default at the 5-version limit.
- Paginate the Cognito pool lookup and every AgentCore list call
  (ListHarnesses, ListGateways, ListGatewayTargets) through one helper.
- Match the gateway and target conflict fallbacks on name; the target fallback
  took the first target it saw, which returns the wrong id on a gateway that
  carries any other target.
- Drop the N+1 get_gateway in the gateway fallback; ListGateways returns name.
- _del_role can now delete a policy that has non-default versions.
- Convert six `except Exception: pass` handlers into reported skips.

Docs and lint:
- README: document the IAM permissions the walkthrough needs, and drop the
  `pip install requests` step -- requests is already in ../../requirements.txt.
- utils/lambda_function_code.py: fix a latent import-order violation and a
  docstring that named the wrong tools.
2026-08-03 09:16:06 -03:00
Rui Cardoso 9b6ec3f736 fix(05-agent-skills): stop reporting success the sample never checked (#1876)
The demo prints four green ticks after commands whose exit codes are never
read, and states a sheet count for a file nothing ever opened.

- Replace two hand-rolled `for i in range(12)` polls with the shared
  `poll_harness_status`. Both had no `else` and no `raise`, so on timeout they
  fell through silently and `update_harness` ran against a CREATING harness
  (`ConflictException`). Real create time is ~95-133s; the ceiling was 60s.
- Wrap the lifecycle in `try/finally`. The file had zero `Try` nodes, so the
  crash above leaked a billable harness and the shared execution role.
- Raise on a failed skill install instead of printing the tick regardless, and
  gate on the verification command's answer instead of discarding it.
- Add `run_command`, returning stdout, stderr and `contentStop.exitCode`, so a
  missing file is distinguishable from an unreadable one.
- Validate downloads: `.xlsx` is a zip, so `zipfile.is_zipfile` rejects
  non-workbooks and the sheet count is read from the file rather than hardcoded.
- README: document the three command outputs, the LibreOffice install the agent
  performs on `node:slim`, and the new diagnostics.
2026-08-03 09:15:35 -03:00
Rui Cardoso d35540c0c5 fix(01-harness): stop 04-mcp-integration reporting success for a report it never retrieved (#1874)
Part 5 read the research report with `cat ... 2>/dev/null || echo '{}'`. When the
agent answered in prose without writing the file, cat's error was discarded and
the fallback emitted `{}` — valid JSON — so json.loads succeeded, the
JSONDecodeError branch never ran, and the sample printed "Research Report
Generated:" followed by an empty object. Ask for the file plainly and keep both
halves of the answer: stderr says why it is missing, the exit code says whether
to trust stdout. A truncated file now reads differently from an absent one.

stream_invoke iterated the event stream bare. internalServerException,
validationException and runtimeClientError are modelled `exception: true`, so
botocore sets a 400 and raises EventStreamError out of the iterator rather than
yielding a dict — the `elif "internalServerException" in event` branch could
never run, and any stream failure escaped into `finally`, ending the demo at
Part 1. Catch (ClientError, BotoCoreError): both are needed and neither covers
the other, since EventStreamError subclasses ClientError while ReadTimeoutError
subclasses BotoCoreError.

That makes Part 4's `Errors encountered:` reachable for the first time. It used
to sit above the except clause every real run took, and could only have printed
0 anyway, because the sole thing appending to that list was the unreachable
branch above. It now prints the service's own message, with an explicit else so
a bad URL that starts succeeding shows up instead of passing silently.

Part 3 is titled "MCP with Authentication" and printed "configured with the API
key", but the only line that would use the key was commented out — so it
demonstrated a config with no credential in it. `headers` is a real member of
remoteMcp (map<string,string>). Enabling it means the config dump below carries
a secret, so print a deep copy with every header value masked, honouring the
comment already there forbidding echoing the key. Masking by iteration, not by
header name, so switching to x-api-key needs no change here.

README: the `curl` used to test an MCP server failed against a healthy one —
missing the `Accept` header (406) and not a complete JSON-RPC request (-32700).
It appeared twice, once as the first troubleshooting step. The
`internalServerException in the stream` entry described an event that never
arrives; replaced with one keyed on the EventStreamError that does. Documented
`headers` properly, and added an entry for Part 5's new missing-report message
so it is not mistaken for a bug.
2026-08-03 09:14:53 -03:00
Rui Cardoso ceacf51e09 fix(01-harness): correct the gateway docs, harden the pollers, stop leaking the role (#1870)
The gateway-integration sample runs correctly end to end, but its docs describe a
different sample than the one that ships, its gateway pollers cannot report the
failures the service actually returns, and cleanup leaves the IAM role behind.

Documentation
- The README walked the reader through a "Create routing rule" step. A gateway
  routes to its targets as soon as they report READY -- no rule is needed to run
  this sample. Replaced with a note explaining that rules are a separate,
  optional feature for shaping traffic across multiple targets.
- The Key Concepts heading read "IAM auth (`NONE` type)", which contradicts
  itself: NONE means no inbound authorizer, and AWS_IAM is a distinct value the
  sample does not use. Replaced with a "Two independent authorization sides"
  section and a table separating inbound (authorizerType on create_gateway) from
  outbound (credentialProviderConfigurations on create_gateway_target), so it no
  longer conflicts with 07-oauth, which configures both.
- The README flow and the module docstring were numbered 1-7 while the script
  prints Step 0-4 plus cleanup. Renumbered both to match the real output.
- Both described Step 3 as creating a harness "wired to the Gateway". No such
  binding exists: create_harness takes no gateway parameter, and the gateway ARN
  travels per-invoke in the `tools` argument to invoke_harness. Corrected, and
  stated explicitly, because the false coupling is what made the Clean Up
  section's ordering advice look justified.
- The Clean Up snippet listed the deletes in an order that contradicted its own
  "targets before gateway" note, omitted the role deletion entirely, and implied
  the harness must go first because it references the gateway. Only the
  target-before-gateway constraint is real.
- Added troubleshooting entries for HTTP 429 (the default Exa endpoint is keyless
  on a shared, rate-limited free tier, so a busy account can exhaust it; shows
  how to attach your own key as an outbound API_KEY credential provider), for the
  UPDATE_UNSUCCESSFUL / SYNCHRONIZE_UNSUCCESSFUL statuses, and for a target stuck
  in CREATE_PENDING_AUTH.

Code
- GATEWAY_POLL_TIMEOUT was 120s while the README told the reader to expect "2-3
  minutes" -- the same contradiction between a local constant and the documented
  wait that #1863 fixed for the harness poller. Raised to 300s, matching
  07-oauth's budget for these two operations. Measured: both the gateway and the
  target reach READY in about 5s, so the old ceiling only ever mattered on the
  slow runs it was least able to survive.
- The pollers checked for the wrong terminal statuses. A gateway reports
  UPDATE_UNSUCCESSFUL, not FAILED, when an update fails, and a target adds
  SYNCHRONIZE_UNSUCCESSFUL; neither was treated as terminal, so a failed resource
  was polled until the timeout and the service's statusReasons was never shown.
  The target poller also tested for DELETE_FAILED, which is not in the target
  status enum at all -- a dead branch. Both now use the real enums, and the three
  *_PENDING_AUTH states fail fast with an explanation instead of spinning on a
  state that cannot clear by itself.
- The stream handler surfaced only internalServerException. validationException
  and runtimeClientError are modelled stream events too, and falling through them
  printed nothing, so a rejected invoke looked like an agent with no answer.
- REGION was read from AWS_DEFAULT_REGION alone, while utils/client.py
  deliberately honours AWS_REGION as well and treats an empty string as unset.
  A shell exporting AWS_DEFAULT_REGION="" therefore built a working
  harness_control and a gw_control that died on "Invalid endpoint:
  https://bedrock-agentcore-control..amazonaws.com". Now imports the shared
  REGION so both clients resolve identically.
- _cleanup now deletes the execution role, guarded by created_role so that a role
  supplied via --role-arn is never touched. The role name is shared by every
  sample in this folder, so deleting a caller's role would destroy something the
  script does not own. Without this the role outlived every run.
- Annotated the create_gateway and create_gateway_target call sites with which
  authorization side each parameter controls, dropped the now-unused os import,
  and moved the utils.iam import back into alphabetical order.

Every API-shape claim added here was read off the botocore service model rather
than inferred: the authorizerType and credentialProviderType enums, the
apiKeyCredentialProvider members, the credentialLocation enum, the gateway and
target status enums, the InvokeHarness stream event members, and the absence of
any gateway parameter on CreateHarness.

Verified live in us-west-2, five end-to-end runs, the last on the exact bytes
committed here: gateway and target reach READY with no routing rule, the agent
calls exa-search___web_search_exa through the gateway and returns real results,
and teardown removes the harness, target, gateway, inline policy and role,
leaving the account clean. Unit-checked against stubbed clients: both pollers for
the happy, every terminal, every pending-auth, transient-passthrough and timeout
paths; the stream handler for all three error events, tool-use, raw mode and the
tools payload shape; and _cleanup for created_role=True, created_role=False, the
default argument, and failure before any resource exists. The empty-region
regression was reproduced before the fix and confirmed resolved after. Ruff
check and format both pass; findings on the file go from 3 to 0.
2026-08-03 09:14:25 -03:00
Rui Cardoso cce2ac62a6 fix(01-harness): stop 01-custom-containers prompting for tools its images lack (#1868)
* fix(01-harness): stop 01-custom-containers prompting for tools its images lack

The custom-container sample asks the agent to run three tools that are not
present in the images it attaches, and documents the resulting output as the
expected behaviour. Live runs of all three presets:

- python preset told the agent to `curl localhost:3000`, but
  python:3.12-slim ships neither curl nor wget. Now asks for urllib.
- go Part 5 asked for the architecture "using 'file' command", but
  golang:1.24 has no `file`. The agent burned a turn on the failure and
  recovered with readelf ("Let me try with readelf as an alternative"),
  so the demo passed while doing something other than what it documents.
  Now asks for `ls -lh` + `readelf -h` directly: 3 shell calls -> 2.
- README's Architecture block advertised "use curl" for every image and
  described the microVM as Node-only. It also documented no python prompt
  at all, though --language python is a supported preset.

Also retries the first invoke_harness on RuntimeClientError (3 attempts,
15s apart). A harness reporting READY does not guarantee the container's
microVM answers health checks yet: one python run died with "Runtime
health check failed or timed out" while that runtime's own CloudWatch log
group recorded a clean startup and zero errors. Only the call is retried,
never a stream that already emitted output, so no text can print twice.

Verified live in us-west-2, all three presets deployed, invoked and torn
down (exit 0):
- go       readelf on the first try, no fallback turn; ELF64 x86-64
- python   agent used urllib, HTTP 200, no curl attempt
- node     unchanged default path, node v26.5.1 / npm 11.17.0, chalk ok

Harness naming follows --language so Go/Python runs no longer create
resources labelled NodeContainer_*, which made leaked resources and their
auto-named managed memory indistinguishable in the console.

* style(01-harness): satisfy ruff format on the retry message

The `ruff format --check` step of the python-lint workflow rejected the
multi-line print() added for the RuntimeClientError retry: it used hanging
indent continuation where the formatter wants the parenthesized form.

Formatting only — the AST is identical before and after, so behaviour is
unchanged and the rendered message is byte-for-byte the same.
2026-08-03 09:13:50 -03:00
Bharathi Srinivasan ec078649fa fix(os-actions): remove trailing slash from base_url to prevent doubl… (#1867)
* fix(os-actions): remove trailing slash from base_url to prevent double-slash 404s

* fix(os-actions): suppress ruff BLE001/S110 on best-effort cleanup handlers
2026-07-31 16:14:29 -07:00
Bryan Conklin 1226ec55aa fix(01-harness): inherit the shared harness poller in gateway-integration (#1863)
* fix(01-harness): inherit the shared harness poller in gateway-integration

The gateway-integration sample fails on a first run and leaves the harness
behind when it does.

Two defects, both consequences of this file carrying its own copy of
poll_harness_status instead of using the shared helper introduced in #1857:

- The local HARNESS_POLL_TIMEOUT was 120s against provisioning measured at
  ~150s on the public network and ~255s in VPC mode, so the sample raises
  TimeoutError before the harness has had time to come up.
- The local poller treated "FAILED" and "DELETE_FAILED" as its failure
  states. The status enum is CREATING, CREATE_FAILED, UPDATING,
  UPDATE_FAILED, READY, DELETING, DELETE_FAILED — there is no plain FAILED,
  so a harness that failed to create was polled until the timeout and the
  service's failureReason was never surfaced.

Deleting the local copy and importing utils.harness.poll_harness_status
fixes both, and stops the constant drifting from the shared value again.

Cleanup had a third, independent defect. A harness cannot be deleted while
it is still CREATING, and the finally block runs at exactly the moment that
is most likely to be true — after a step failed mid-provisioning. The single
delete_harness call was rejected with ConflictException, swallowed by a
broad except, and the harness was left behind counting against the account's
harness quota with nothing pointing at why. _delete_harness now waits out
ConflictException on the same 600s budget, returns immediately on any other
error code, and no longer catches BaseException-wide.

README: the troubleshooting entry told readers to raise a constant this file
no longer defines. Replaced with the real timeout and the CREATE_FAILED /
failureReason check, plus a note that the retry-delete log line is expected.

Verified: module imports and resolves poll_harness_status from utils.harness
at 600s; _delete_harness checked against stubbed clients for the success,
retry-then-succeed, non-conflict, timeout, and already-deleted paths. Ruff
findings on the file go from 4 to 3 — the remaining three are pre-existing
and untouched, per the guidance not to reformat unrelated code.

Related to #1857, which fixed the same class of defect in 00-getting-started
and noted that the other samples in this folder share it.

* chore: add Bryan Conklin to CONTRIBUTORS.md
2026-07-31 11:45:10 -03:00
Rui Cardoso 065c742811 fix(01-harness): fix memory lifecycle, share the poller, and stop leaking the role in 3 use-case samples (#1866)
The three use-case samples under 02-use-cases had the same family of
provisioning-lifecycle bugs the advanced examples had (#1864), plus a
memory-specific cluster in the travel agent.

aws-builder-agent:
  - Never deleted the shared execution role at all — it imported only
    create_harness_role. Because every sample in this folder shares one role
    name (HarnessExecutionRole), the leftover role poisons the next sample's
    run. Now imports delete_harness_role and deletes it in finally, guarded by
    a created_role flag so a caller-supplied --role-arn is never destroyed.
  - Dropped its private poller for the shared utils.harness.poll_harness_status.
    The local copy checked for a "FAILED" status that is not in the enum
    (CREATE_FAILED / UPDATE_FAILED / DELETE_FAILED), so it could never detect a
    real failure, and its 180s ceiling left little margin over the ~145s a
    harness actually takes to reach READY.

webapp-visual-testing:
  - Replaced both fixed 24×5s (120s) poll loops with the shared poller. The old
    ceiling expired while the harness was still CREATING — the live run needed
    ~29 polls (~145s) to reach READY — after which the update_harness call that
    attaches the Node container fails with ConflictException.

travel-agent (memory cluster):
  - create_memory / get_memory return the resource under a top-level "memory"
    key only, so the old `resp.get("id")` first branch was dead code — proven
    live (it returns None). Now reads resp["memory"]["id"] / ["arn"].
  - The memory status enum is CREATING → ACTIVE with a plain FAILED and no
    READY (unlike the harness). The old loop waited for ("ACTIVE","READY") and
    never checked FAILED, so a failed memory was polled to the ceiling and its
    failureReason never surfaced. New poll_memory_status honors the real enum
    and raises on FAILED.
  - Removed the adopt-then-delete fallback that matched any memory whose id
    contained "TravelGuide" and deleted it in cleanup — that destroyed a memory
    the sample did not own. memory_id is now only set when this run created the
    memory; a pre-existing one raises ConflictException, which is caught and
    the memory demo is skipped with a clear message.
  - Replaced the harness create-wait (a 12×5s = 60s ceiling, versus the ~145s
    observed) and the post-update wait with the shared poller.
  - Cleanup now deletes the harness before the memory it references, each guard
    independent so one failure cannot skip the role deletion.
  - README updated to match the new ConflictException behavior.

Also cleared pre-existing lint debt on the touched files (import order,
dict()→literal, blind-except noqa) and removed a stray shebang (EXE001).

Tested live in a fresh account (us-west-2): baseline runs reproduced the role
leak and the dead memory-id branch; all three fixed samples ran end to end
(builder scaffolds a project, travel completes all 6 parts incl. multi-turn
memory recall, webapp captures 3 Puppeteer screenshots) and left zero leaked
resources — role, harness, and sample-created memory all deleted.
2026-07-31 11:41:19 -03:00
Rui Cardoso d74b972283 fix(01-harness): correct execution limits, share the poller, and stop leaking the role in 4 advanced samples (#1864)
* fix(01-harness): correct execution limits, share the poller, and stop leaking the role in 4 advanced samples

Follow-up to #1857, applying the shared poll_harness_status helper and the
role-lifecycle fixes to four advanced samples that need no extra infrastructure,
and fixing a factual error in the execution-limits demo.

- 03-execution-limits: the demo claimed maxTokens truncates the response
  (maxTokens=10 -> "~10 tokens"). On InvokeHarness maxTokens is a *per-iteration*
  ceiling, not a budget for the whole invocation, so the agent keeps going across
  iterations and the answer is not truncated. Verified live: maxTokens=256 still
  produced 1413 output tokens and stopped with end_turn. Corrected the code, the
  docstring and the README, and switched the demo to compare per-run output
  tokens. maxIterations and timeoutSeconds do stop the agent
  (max_iterations_exceeded / timeout_exceeded), which the demo still shows.

- All four (01-custom-containers, 03-execution-limits, 04-mcp-integration,
  13-aws-skills): replace the local wait-for-READY loop with the shared
  poll_harness_status from #1857. The local loops had a fixed ~60s ceiling on an
  operation that takes ~150s (and longer for a container pull or AWS-skills
  harness), and several checked for a "FAILED" status that is not in the enum
  (it is CREATE_FAILED / UPDATE_FAILED / DELETE_FAILED), so they could never
  detect a failure.

- 03-execution-limits, 04-mcp-integration: role and harness creation were above
  the try block, so a CreateHarness failure exited leaving the shared IAM role
  behind. Moved creation inside try/finally and made cleanup delete each resource
  independently, matching #1857's getting-started fix. (01-custom-containers and
  13-aws-skills already create inside try and gain a created_role guard so a
  caller-supplied --role-arn is never deleted.)

Tested live in us-west-2 on an account with no pre-existing Harness resources:
each sample provisioned, ran its demo end to end (custom container attach +
npm install; MCP tool load and the invalid-URL error path; AWS Skills glob
load), and cleaned up with no leaked role or harness.

* fix(01-harness): stop logging the MCP API key in mcp-integration

Part 3 printed the first 8 characters of MCP_API_KEY. Eight characters of a
bearer credential is a meaningful leak, and sample output routinely lands in
terminal scrollback, CI logs and screenshots.

The line carried a `# codeql[py/clear-text-logging-sensitive-data]` comment,
which is legacy LGTM syntax that GitHub code scanning does not honour, so the
alert was live rather than suppressed. Print the key length instead of any part
of the value, and drop the comment that was not doing anything.

CodeQL flagged this as new on #1864 because wrapping the module in try/finally
re-indented the line; the expression itself is unchanged since e746bf77.
2026-07-30 16:31:10 -03:00
Visakh Madathil 4804e39267 fix(observe-evaluate): unblock span redaction and batch evaluation (#1861)
* fix(observe-evaluate): unblock span redaction and batch evaluation

Two independent runtime failures in the observe/evaluate samples:

1. 01-observe/attribute_redaction.py — SensitiveDataRedactor.on_end
   assigned span._attributes[attr] directly, but span.attributes is a
   BoundedAttributes instance that is immutable once the span has ended,
   so redaction raised TypeError and the agent never completed. Rebuild a
   plain dict with sensitive values masked and reassign span._attributes.
   Reassigning avoids depending on the private inner storage name, which
   differs across OTel SDK versions (_dict vs _attributes).

2. 02-evaluate/utils/deploy.py — deploy never wrote otel_service_name to
   agent_config.json, so simulate.py omitted serviceNames from
   start_batch_evaluation, causing ParamValidationError. Write
   "<agentRuntimeName>.DEFAULT", matching the service name AgentCore emits
   on spans and the value sibling evaluate.py scripts derive from the ARN.

Validated on live AgentCore: deploy writes the service name, spans land in
aws/spans under that name, and start_batch_evaluation completes 5/5 sessions.

* fix(observe-evaluate): resolve ruff lint errors in changed files

- Sort import blocks (I001)
- Annotate SENSITIVE_ATTRS as ClassVar (RUF012)
- Drop unused E402 noqa directives; E402 is ignored repo-wide (RUF100)
- Mark intentional broad-except catches with noqa: BLE001 (BLE001)

---------

Co-authored-by: Visakh Madathil <visakhm@amazon.com>
2026-07-30 12:30:26 -07:00
Rui Cardoso e0ee66c644 fix(01-harness): make getting-started work on a fresh AWS account (#1857)
The getting-started sample fails on an account with no pre-existing Harness
resources, and leaves the account in a state the other samples cannot recover
from.

The wait-for-READY loop was `for i in range(12)` with a 5s sleep -- a hard 60s
ceiling on an operation measured at ~150s -- and it fell through instead of
raising, so the failure surfaced one step later as `ValidationException: Harness
is not READY`. The script then exited without deleting the IAM role it had
created. Every sample in this folder shares the role name HarnessExecutionRole
and create_harness_role() returned early when the role already existed, so that
stale role went on to break the next sample too.

Changes:

- utils/harness.py (new): one correct poll_harness_status(). The same loop
  appears 16 times across this folder in 4 incompatible variants, most checking
  for a FAILED status that is not in the enum (CREATE_FAILED / UPDATE_FAILED /
  DELETE_FAILED), so they cannot detect failure at all.
- 00-getting-started/getting_started.py: use the shared poller; move harness
  creation inside the try block so a CreateHarness failure cannot leak the
  execution role created just above it; clean up each resource independently.
- utils/iam.py: least privilege (scoped Bedrock and CloudWatch Logs resources,
  18 enumerated AgentCore actions in place of *Memory*-style wildcards that
  silently included Delete*, aws:SourceAccount on the trust policy) and full
  idempotency, so re-running repairs an existing role. Deletion now removes
  every attached policy, which a leftover would otherwise block with
  DeleteConflictException.
- utils/client.py: honour AWS_REGION as well as AWS_DEFAULT_REGION, and default
  data-plane read_timeout to 900s -- botocore's 60s default is shorter than one
  agent turn and cut the response stream off mid-flight.
- 00-getting-started/README.md: "Wait up to 60 seconds" contradicted the ~150s
  reality; also documents iam:UpdateAssumeRolePolicy.
- requirements.txt: boto3>=1.43.32, the first release whose bedrock-agentcore
  model knows awsSkills.

Tested live in us-west-2 on an account with no pre-existing Harness resources:
full getting_started.py run passes all six steps and cleans up; a deliberately
failed CreateHarness now deletes the role instead of leaking it; the scoped IAM
policy brings a harness to READY, invokes it and writes logs under the scoped
prefix; a degraded role is repaired by re-running. Plus 24 offline unit checks
and a no-regression pass over the other 18 samples.

Co-authored-by: shraone477 <308823281+shraone477@users.noreply.github.com>
2026-07-30 13:31:39 -03:00
Diego Brasil 392e84238c fix(memory): unblock three first-run failures in AgentCore Memory samples (#1847)
* fix(memory): wait for IAM propagation before CreateMemory in boto3 quickstart

`00-getting-started/04-quickstart-boto3.py` creates the
`AgentCoreMemoryExecutionRole` and then calls `create_memory` a few lines later.
On a fresh account IAM has not propagated yet, so the service cannot read the new
role back and rejects the call:

    botocore.errorfactory.ValidationException: An error occurred
    (ValidationException) when calling the CreateMemory operation: Validation
    failed during CreateMemory: Please provide a role with a valid trust policy

The message points at the trust policy, but the trust policy is correct. Verified
by reading the role straight out of IAM after the failure (principal
`bedrock-agentcore.amazonaws.com`, action `sts:AssumeRole`, unchanged) and then
retrying `create_memory` with the same ARN ~30s later, which succeeded.

This only affects the first run. Once the role exists, the
`get_role`/`NoSuchEntityException` guard skips creation and every later run
passes, so the bug self-heals and then stays hidden — which is why it reads as a
flake. New users on a clean account hit it every time, and the error sends them
off auditing a policy that was never wrong.

Sleep for 10s inside the `except NoSuchEntityException` branch so the delay is
paid only on the run that actually creates the role. Warm runs take the `get_role`
path and are unaffected.

Tested against us-east-1 by deleting the role first to reproduce cold-start
conditions:

  - before: ValidationException on `create_memory`
  - after:  `Created: QuickstartMemory-SXxovF2FfB` / `Status: ACTIVE`

`ruff check` and `ruff format --check` both pass on the changed file.

* fix(memory): pin boto3/bedrock-agentcore floors for long-term memory samples

Three long-term memory samples call parameters and helpers that do not exist
in older boto3/bedrock-agentcore releases. Nothing in the tree declared a
floor, so an environment built a few weeks before a workshop fails on three
separate sub-features with errors that look like sample bugs:

  02-long-term-memory/06-record-metadata/structured-metadata.py boto3
    ParamValidationError: Unknown parameter in input: "indexedKeys"
  02-long-term-memory/08-manage-extraction/skip-extraction.py boto3
    ParamValidationError: Unknown parameter in input: "extractionMode"
  02-long-term-memory/01-built-in-strategies/semantic.py sdk
    TypeError: search_long_term_memories() got an unexpected keyword
    argument 'namespace'

structured-metadata.py fails at 0 seconds on indexedKeys, which is item 3 of
its own "What you learn" list. skip-extraction.py fails after CreateMemory
succeeds, so it also leaks a billable memory resource.

Floors were established by bisecting the published wheels rather than
assuming, since the two botocore parameters land 34 patch releases apart:

  botocore 1.43.0  -> CreateMemory has no indexedKeys
  botocore 1.43.1  -> indexedKeys appears
  botocore 1.43.34 -> CreateEvent has no extractionMode
  botocore 1.43.35 -> extractionMode appears
  bedrock-agentcore 1.9.0  -> search_long_term_memories() namespace_prefix only
  bedrock-agentcore 1.10.0 -> namespace= appears (memory/session.py)
  bedrock-agentcore 1.11.0 -> MemoryMetadataFilter has no build_expression
  bedrock-agentcore 1.12.0 -> build_expression appears

boto3>=1.43.35 is the binding constraint because it requires
botocore>=1.43.35, which covers indexedKeys (1.43.1) as well. This agrees
with the existing 06-production-patterns/00-multi-region-replication pin of
boto3>=1.43.36, which also uses extractionMode.

bedrock-agentcore>=1.14 keeps the floor already documented in
01-built-in-strategies/semantic.py and 04-namespaces/README.md rather than
lowering it to the measured 1.12 minimum.

Verified against a live account (us-east-1) in a venv pinned to the exact
floors, boto3==1.43.35 / botocore==1.43.35 / bedrock-agentcore==1.14.0. All
three previously failing runs now exit 0:

  structured-metadata.py boto3 -> EU metadata filter returned the expected
                                  record with region/tier metadata
  skip-extraction.py boto3     -> 12 events stored, 7 extracted, 4 skipped
  semantic.py sdk              -> all three semantic queries returned scored
                                  records

Adds requirements.txt at the 02-long-term-memory level (the three affected
sub-features all live under it) and points the three affected README run
blocks at it. Scope is limited to what was executed and verified.

* fix(memory): replace retired Claude 3.5 Sonnet v2 model id in strategy overrides

02-strategy-overrides defaulted its override model to
anthropic.claude-3-5-sonnet-20241022-v2:0, which is retired. The sample is
the only place in the memory tree that lets you choose the extraction and
consolidation model, so the retired id makes the lesson unreachable: memory
creation succeeds, then extraction fails server-side and no records appear.

Confirmed retired against a live account (us-east-1):

  anthropic.claude-3-5-sonnet-20241022-v2:0
    -> ResourceNotFoundException: This model version is not supported
  global.anthropic.claude-opus-4-6-v1
    -> OK

MODEL_ID is a module-level constant read by _override_strategy(), which both
the boto3 and sdk surfaces call, so the single default covers both. The
OVERRIDE_MODEL_ID environment override is unchanged.

Verified end to end on the boto3 surface at the pinned dependency floors. The
override behaved exactly as the sample teaches, extracting only health facts
and suppressing the deliberate non-medical line:

  [boto3] Medical facts (4):
    - The user's mother had breast cancer at age 52.
    - The user has type 2 diabetes.
    - The user takes metformin twice daily for type 2 diabetes.
    - The user is allergic to penicillin.
  The Godfather mention correctly did not appear.

Also updates the two documentation occurrences that a participant would copy
and hit the same failure with: the AWS CLI walkthrough in this folder's
README (extraction and consolidation modelId) and the "Using Different
Models" snippet in the episodic healthcare example README.

Scope is limited to 01-features/04-manage-context-of-your-agent, the area
that was executed and verified. The same retired id still appears elsewhere
in the repo (05-authenticate-and-authorize, 06-workshops, an IaC doc table,
and two bedrock-models.yml files); those are intentionally left alone here
since they were not run.
2026-07-29 16:39:13 -04:00
Deepaxs cd78928ae1 Add payment skill orchestration docs for coding agents (#1815) 2026-07-29 09:51:42 -04:00
satveerkhurpa 568ee829fe Add certificate-based auth (PRIVATE_KEY_JWT) sample for Okta and Entra ID (#1839)
* Add certificate-based auth (PRIVATE_KEY_JWT) sample for Okta and Entra ID

Adds 01-features/05-authenticate-and-authorize/05-certificate-based-auth/ with:
- Okta: DCR service app, JWK registration, M2M + OBO flows, browser 3LO helper
- Entra ID: KMS-signed X.509 cert, service app + web app registration, M2M + OBO flows
- Shared: KMS RSA_2048 signing key, offline unit tests (48 total, all passing)

Feature reference:
https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/private-key-jwt.html

Updates parent README.md with entries in the Top-level layout table,
Auth Pattern Quick Reference, Finding Things, and Running the Python
Scripts sections.

* Address PR review: eliminate SHA-1 usage, fix all ruff findings, correct stale folder paths

CodeQL HIGH findings (SHA-1 on cert DER, 4 alerts):
- Removed hashlib.sha1() usage from production code entirely
- thumbprints() -> x5t_s256_thumbprint(): returns SHA-256 only
- x5t (SHA-1 base64url) was never used by AgentCore's Entra provider,
  which always uses x5t#S256; only the display line printed it
- Portal SHA-1 fingerprint (shown by Entra admin UI) is now looked up
  by users via `openssl x509 -in entra_cert.pem -noout -fingerprint -sha1`
- Test in entra/tests/test_provider_config.py updated to test only x5t#S256

Ruff check + format:
- 425 auto-fixable (F541 f-string-missing-placeholders, I001 unsorted
  imports, RUF100 unused noqa)
- 19 manual fixes:
  - BLE001 (15): narrowed blind Exception catches to specific types
    - JWT payload decoders: (ValueError, IndexError, TypeError)
    - Graph HTTP calls: (requests.RequestException, ValueError, KeyError)
    - base64 decode: (ValueError, TypeError)
    - JSON parse: ValueError
    - cert compare: (ValueError, KeyError, TypeError)
  - TRY004 (3): raise TypeError (not ValueError) on non-RSA key check
  - S110 (1): resolved along with the co-located BLE001 narrowing
- 27 files reformatted to match line-length=120 (repo pyproject.toml)

Docs:
- Stale folder path fix in okta/README.md and entra/README.md: the
  copy-paste `cd 05-outbound-auth-private-key-jwt/{okta,entra}`
  example was renamed to `cd 05-certificate-based-auth/{okta,entra}`

Test verification: 48 unit tests pass (15 Okta + 33 Entra) offline.

Remaining CodeQL "clear-text logging of sensitive information" HIGH
findings on client_id printing and .env writes are false positives:
- client_id is a public OAuth 2.0 identifier per RFC 6749 section 2.2
- .env writes contain only public identifiers (KMS ARN, kid, thumbprint,
  client_id), no secrets
These should be dismissed in the Code Scanning UI with the above
rationale.
2026-07-28 16:26:57 -05:00
Neha Thakur ff11ccbb89 Add Gateway, Policy Engine, Guardrails, Evaluators, and Observability to Video Games Sales Assistant (#1696)
* feat(video-games-sales-assistant): Add all AgentCore features - Gateway, Policy Engine, Guardrails, Evaluators, Observability

  - Add AgentCore Gateway with MCP Lambda target for PostgreSQL tools
  - Add Cedar Policy Engine (allow default, block PII/cost columns)
  - Add Bedrock Guardrail for content filtering (PII + cost topics)
  - Add LLM-as-a-Judge evaluators (SqlAccuracy, ResponseQuality)
  - Add Gateway observability (CloudWatch Logs delivery)
  - Add deploy.py for script-based deployment alternative
  - Add evaluations/evaluate.py harness with 8 test scenarios
  - Add setup-frontend.sh for automated frontend configuration
  - Expand README to 484 lines covering all AgentCore features

* fix(amplify): Add monorepo amplify.yml at repo root for Amplify Hosting

* fix(amplify): Add esbuild as direct devDependency for Amplify Hosting builds

  pnpm exec cannot find esbuild binary when it is only a transitive
  dependency. Adding it directly ensures the binary is linked in .bin/.
  Also removed --frozen-lockfile to allow platform-specific resolution.

* fix(amplify): Fix Amplify Hosting build - update lockfile, skip backend deploy

* fix(amplify): Generate amplify_outputs.json at build time from env vars

* fix(amplify): Generate amplify_outputs.json at build time from env vars

* docs: Update READMEs for Amplify Hosting, remove amplify_outputs.json from tracking

* docs: Rewrote parent README as self-sufficient deploy guide, added architecture diagram

* Add nehatb to CONTRIBUTORS.md

* feat: Replace standalone Bedrock Guardrail with AgentCore guardrails-in-policy

  - Use Cedar guardrails-in-policy at Gateway Policy Engine layer
  - Move SQL content validation to Lambda handler
  - Remove standalone AWS::Bedrock::Guardrail and GUARDRAIL_ID env vars
  - Remove deploy-policies.sh (policies now in single CDK deploy)
  - Rename video-games-sales-assistant to data-analyst-conversational-assistant
  - Update architecture diagram

* fix: Address PR review feedback - batch evals, guardrail docs, agentcore CLI reference

- Replace manual scenario iteration with BatchEvaluationRunner using native Dataset management API for server-side batch evaluation
- Add guardrail testing section with curl examples for prompt injection, harmful content, and PII suppression
- Remove agentcore-cli tag from agentcore.json

* fix: ruff formatting and missing time import in data-analyst-conversational-assistant

---------

Signed-off-by: Bharathi Srinivasan <bhrsrini@amazon.com>
Co-authored-by: nehatb <nehatb@amazon.com>
Co-authored-by: Bharathi Srinivasan <bhrsrini@amazon.com>
2026-07-22 11:20:15 -07:00
Julia Furst Morgado 580e6b5e00 feat(observability): add Dash0 as partner observability integration (#1539)
feat(observability): add Dash0 as partner observability integration

Signed-off-by: Julia Furst Morgado <52685951+juliafmorgado@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 15:36:01 -04:00
Guruprasad 423e7d7f5d Claude SDK and Google ADK supported-frameworks (#1772)
* feat(evaluations): add supported-frameworks samples (Google ADK, Claude Agent SDK)

Add evaluation code samples for two newly-supported agent frameworks:

- google-adk/ — HR Assistant built with Google ADK + LiteLLM (routes to
  Bedrock, no external API key). Instrumented with
  openinference-instrumentation-google-adk >= 0.1.13.

- claude-agent-sdk/ — HR Assistant built with Claude Agent SDK. Instrumented
  with openinference-instrumentation-claude-agent-sdk >= 0.1.3.

Both samples:
- Implement the same HR Assistant (same 5 tools, shared mock data)
- Deploy to AgentCore Runtime as containers
- Run on-demand evaluation (Builtin.GoalSuccessRate, Correctness, Helpfulness
  + custom LLM-as-a-judge)
- Create online evaluation config for continuous monitoring
- Include idempotent cleanup scripts

Shared mock_data.py extracted for reuse across framework samples.

* test: add unit tests, fix Dockerfiles, add .env.example

- Add 29 unit tests (mock data, tool logic, deploy/cleanup, Dockerfile validation)
- Fix Dockerfiles: remove invalid COPY ../ (use in-context shared/ copy)
- Add .env.example for both samples (template, no secrets)
- Validates: no real PII, tool correctness, eval scenario consistency

* fix(claude-agent-sdk): correct SDK API usage after local verification

Claude Agent SDK (v0.2.115) uses ClaudeSDKClient + MCP tools, not a simple
Agent class. Rewritten to use:
- create_sdk_mcp_server() for tool registration
- @tool decorator with MCP-style input_schema
- ClaudeSDKClient with send_message() for invocation
- ResultMessage for response extraction

Verified locally: all imports resolve correctly for both google-adk and
claude-agent-sdk.

* docs: add Guruprasad Seeryada to CONTRIBUTORS.md

* fix: remove f-string without placeholders (ruff F541)

* style: apply ruff format to all Python files

* fix: address reviewer feedback (Bharathi)

- Remove tests/ folder (reviewer request)
- Add AgentCore eval support explanation + docs links to both READMEs
- Add example trace JSON for both frameworks (AGENT, TOOL, LLM spans)
- Replace ASCII architecture diagrams with draw.io source files
  (export as PNG before merge — reviewer requested hand-drawn diagrams)
- READMEs now reference architecture.png (to be exported from .drawio)

* docs: add architecture diagrams (AWS icons, draw.io export)

---------

Signed-off-by: Bharathi Srinivasan <bhrsrini@amazon.com>
Signed-off-by: Guruprasad <116177025+svguruprasad@users.noreply.github.com>
Co-authored-by: Bharathi Srinivasan <bhrsrini@amazon.com>
2026-07-17 18:38:57 -07:00
Massimiliano Angelino 879b67cbbf feat(gateway-ide): gateway session binding and DCR example (#1758)
* chore: example that shows how to add DRC and automatic session binding to AgentCore Gateway

also shows how to add targets that themselves only support DCR

* fix: ruff and bandit fixes

* fix(secure-ide-gateway-tool): resolve ASH findings - bandit B310: move nosec onto urlopen line after https scheme validation - detect-secrets: annotate demo credentials with pragma allowlist (utils.py, notebook) - grype: bump aws-cdk-lib to ^2.261.0 (CVE fix) and migrate off @aws-cdk/aws-bedrock-agentcore-alpha to stable aws-cdk-lib/aws-bedrockagentcore - remove unused jest tooling (no tests) to drop transitive js-yaml vuln - standardize on single pnpm-lock.yaml

* style: apply ruff format to secure-ide-gateway-tool python files

* chore: restore 03-ide-gateway-tool demo video and stop tracking SECURITY-REVIEW.md

* doc: fixed README and DEPLOYMENT

* fix: masked ids

* fix: removed secrets,  added diagrams
2026-07-17 12:40:11 -04:00
Anil Nadiminti 496c79e72b feat(agents-that-transact): use LangGraph payments middleware (AgentCorePaymentsMiddleware) (#1783) 2026-07-17 11:40:06 -04:00
Shreya Pawaskar 5c26a2e629 Add 04-fmkb-managed-kb sample (Managed KB via AgentCore Gateway) (#1770)
* Add 04-fmkb-managed-kb sample to connect-your-agent-to-anything

Exposes a Bedrock Managed Knowledge Base (FMKB) as an MCP tool via
AgentCore Gateway, queried by a Strands agent on AgentCore Runtime.
Includes a raw MCP/SigV4 path (01-raw-mcp) and the deployed-agent path
(02-strands-agent), plus KB + gateway helpers.

* Replace ASCII diagram with AWS-icon architecture image

Adds images/architecture.png (official AWS Bedrock/IAM icons) and embeds
it in the README in place of the ASCII box drawing.

* style: apply ruff format to satisfy Python Code Quality CI

Reformats the sample's Python files to the repo's ruff config
(line-length=120). Cosmetic only — no logic changes.

* Update architecture diagram

Refreshes images/architecture.png with cleaner node labels and
edge-centered labels (white background).

---------

Co-authored-by: shraiyya <shraiyya@users.noreply.github.com>
2026-07-16 16:35:16 -04:00
Renya Kujirada 2ac6a0986b feat(evaluations): add supported-frameworks samples for OpenAI Agents SDK and LlamaIndex (#1774)
* feat(evaluations): add supported-frameworks samples for OpenAI Agents SDK and LlamaIndex

Add one evaluation code sample per newly-supported framework under
02-evaluate/supported-frameworks/. Each sample re-implements the shared
HR Assistant, deploys it to AgentCore Runtime with OpenTelemetry
instrumentation (auto-discovered by ADOT), and evaluates it with
built-in and custom LLM-as-a-judge evaluators (on-demand and online).

- openai-agents: gpt-oss via the Bedrock mantle Responses API endpoint
  (OpenAIResponsesModel + short-term bearer token from the runtime role)
- llamaindex: FunctionAgent workflow with BedrockConverse (Nova Lite),
  streaming disabled for clean inference spans
- both: conversation history persisted in AgentCore Memory per session,
  telemetry force-flushed before the microVM freezes

Verified end-to-end on us-west-2: deploy, multi-turn invocation with
cross-turn references, on-demand evaluation (11/11 valid scores), and
online evaluation results in CloudWatch.

* docs(evaluations): expand supported-frameworks READMEs for education

- Add 'What you'll learn' concept tables and architecture diagrams to
  both framework sample READMEs, matching the sibling samples' style
- Add 'Expected output' sections with real run transcripts so learners
  can verify their results
- Add 'Evaluate from the CLI' sections using the AgentCore CLI's
  standalone mode (agentcore run eval --runtime-arn/--evaluator-arn),
  verified against the deployed runtimes
- Add a 'Making any framework agent evaluable' recipe and next-steps
  links to the folder README, generalizing the integration steps

* feat(evaluations): switch OpenAI Agents sample to GPT-5.5 with Bedrock API keys

Replace gpt-oss-120b with openai.gpt-5.5, served on the mantle
endpoint's openai/v1 path from us-east-1/us-east-2 (the runtime calls
it cross-region via BEDROCK_OPENAI_MODEL_REGION).

Authentication now follows the Bedrock API key model: a short-term key
is minted from the runtime's IAM role on every invocation (secure
default), and a long-term key can be supplied via the BEDROCK_API_KEY
environment variable. README documents both key types and how to
generate a long-term key.

Verified end-to-end on the deployed runtime: 3-turn session with
cross-turn references, AgentCore Memory persistence, and on-demand
evaluation returning 11/11 valid scores (GoalSuccessRate 1.0,
Correctness 1.0, HRSessionCompleteness 1.0).

* refactor(evaluations): simplify OpenAI auth to provide_token directly

provide_token() already returns a short-term Bedrock API key, so the
BEDROCK_API_KEY environment-variable branch was unnecessary. Call it
directly in _build_agent and drop the _get_api_key helper. README now
documents the long-term key as a pass-it-as-api_key alternative rather
than a separate env-var code path.

Behavior is identical to the deployed runtime's default path (verified
by smoke-testing the live GPT-5.5 runtime).

* docs(evaluations): rename abrupt 'Why the same HR Assistant?' section

Replace the question-style heading with 'The shared HR Assistant
scenario' and move it right after the Samples table, where the HR
Assistant is first mentioned, so the README flows from what the
samples are to why they share one scenario.

* fix(evaluations): suppress spurious pip warnings during package build

The deployment zip is built with pip install --target into an isolated
directory, but pip still checks the resolved set against packages in the
ambient environment and prints misleading 'ERROR: pip's dependency
resolver...' conflicts that do not affect the deployed artifact. Add
--no-warn-conflicts and --disable-pip-version-check so deploy.py output
only shows real errors.

* fix(evaluations): address supported framework review feedback

* fix(evaluations): correct image reference and ruff formatting
2026-07-15 19:17:38 -07:00
Anil Nadiminti eda4f2bb09 docs(08-agents-that-transact): convert payments getting-started to AgentCore CLI + SDK (#1767)
---------

Co-authored-by: Anil Nadiminti <anilnadi@amazon.com>
Co-authored-by: deepaxs <deepaxs@amazon.com>
2026-07-15 06:46:00 -04:00
Fabio Balancin 790838a830 Add egress-controlled code execution sample (#1769)
* Add egress-controlled code execution sample

A multi-container security sample under 03-advanced: a trusted supervisor
container (started by AgentCore Runtime) launches a broker and an untrusted
agent container inside the same microVM via containerd. All agent egress is
mediated by the broker, which enforces a runtime-configurable allowlist.

The Phase 1 operation is ping_domain, exercising the full
supervisor -> agent -> broker -> egress path. The allow-vs-deny contrast
(amazon.com permitted, aws.amazon.com denied) demonstrates the security
boundary end to end.

Includes deploy.py / invoke.py / cleanup.py (matching the folder convention),
three arm64 Dockerfiles, unit tests for the IPC framing and broker allowlist,
and an architecture diagram. Also adds the row to the 03-advanced index.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Add contributors to CONTRIBUTORS.md

Add Fabio Balancin (balancin) and Varun Gunda (vvargu) for the
egress-controlled code execution sample.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Remove redundant Roadmap and Cost Considerations sections from egress-coding-execution README

Consolidate into the existing Current status section and drop the broken
Roadmap anchor link.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Fabio Balancin <balafabi@amazon.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 17:55:18 -03:00
Bharathi Srinivasan dbe1c81bd6 Remove comments and default configuration from dependabot.yml (#1776)
Signed-off-by: Bharathi Srinivasan <bhrsrini@amazon.com>
2026-07-13 14:09:55 -07:00
Bharathi Srinivasan 473df951da Remove no-op Dependabot metadata workflow (#1775)
.github/workflows/dependabot.yml only fetched PR metadata from
dependabot[bot] PRs but had no downstream steps wired up, making
it a dead workflow. Removing to reduce CI noise.
2026-07-13 14:09:12 -07:00
Renya Kujirada 366816c0e3 Add Policy in Amazon Bedrock AgentCore samples: tool access control and guardrails in policies (with architecture diagrams) (#1768)
* Add AgentCore Policy samples: tool access control and guardrails as policies

* fix: apply ruff formatting to policy sample Python files

* docs: rename AgentCore Policy to "Policy in Amazon Bedrock AgentCore"; rename 03-guardrails-as-policies to 02-guardrails-as-policies

* update readme

* fix: remove invalid --target flag from agentcore add policy CLI commands; add --form-data-path; update install to @latest

* docs(policy): add image-based architecture diagrams to policy READMEs

Replace ASCII architecture diagrams with draw.io generated PNG diagrams
using official AWS icons (Bedrock AgentCore Gateway, AgentCore Policy,
Lambda, Cognito, Bedrock Guardrails) in:
- 02-policy/README.md
- 02-policy/01-tool-access-with-policy/README.md
- 02-policy/02-guardrails-in-policy/README.md

The PNGs embed the draw.io diagram XML, so they remain fully editable
by opening them in draw.io.

* docs(policy): remove 'Cedar' wording from architecture diagrams

Per reviewer feedback: the authorization language is no longer strictly
Cedar, so refer to the policies simply as 'policies' across all three
diagrams (main policy, tool-access, guardrails).

* docs(policy): rename guardrails diagram title to Amazon Bedrock Guardrails

Per reviewer feedback on PR #1768: refer to Guardrails in the title as
Amazon Bedrock Guardrails.

---------

Co-authored-by: Bharathi Srinivasan <bhrsrini@amazon.com>
2026-07-11 15:53:13 +09:00
satveerkhurpa 8605cff717 Fix broken example links in obo-training OBO Reference Guide (#1763)
The Runnable Examples section had relative links to examples/ which was
renamed to 3-examples/ before the initial merge. Also generalize the
walkthrough paragraph so it covers both Entra and Okta claim conventions
(the merged version was Entra-specific).

- Relative links now correctly point at 3-examples/*
- Marks UC2 Okta complete (was 'Okta planned')
- Generalizes the walkthrough: actor claim (azp/appid vs cid),
  identity claim (oid vs sub+uid), and audience behavior (rotates
  on Entra vs constant on Okta)

Co-authored-by: Satveer Khurpa <khurpas@amazon.com>
2026-07-09 17:15:51 -05:00
Will Matos 69fb6dd640 Enhance event-driven-claims-agent: cost routing, deterministic execution, docs (#1761)
* feat(usecases): it-incident-response

* add jira integration

* fix minor memory usage points

* docs: add IT incident response agent project docs and assets

* config: add AgentCore project configuration and schema context

* infra: add CDK project for AgentCore L3 construct deployment

* feat: add Strands agent application (runtime, memory, MCP client, model)

* feat: add Lambda functions for tools, infra providers, and ticket trigger

* feat: add tool schemas, seed data, and knowledge base runbooks

* chore: add deployment, evaluation, and ticket utility scripts

* docs: comply with use-case README template (add details table and disclaimer)

* chore: allow esbuild install script in CDK project

* fix: create S3 Vectors bucket+index for KB (CFN does not auto-create)

The Bedrock KnowledgeBase CloudFormation resource with type S3_VECTORS
requires a pre-existing vector bucket and index. Passing an empty
s3VectorsConfiguration fails schema validation. The console's 'quick
create' auto-provisions these, but CloudFormation does not.

Changes:
- Import aws-cdk-lib/aws-s3vectors
- Create CfnVectorBucket (named per account+region)
- Create CfnIndex (float32, 1024 dims, cosine, no metadata keys)
- Wire IndexArn, IndexName, VectorBucketArn into KB storageConfiguration
- Grant KB role s3vectors:* actions on the vector index
- Add removalPolicy to bucket+index
- Add troubleshooting row to README
- Deleted the ROLLBACK_COMPLETE stack to unblock next deploy

* fix: resolve deploy issues (template envsubst, target name, IndexName removal)

- aws-targets.json.template: fix envsubst-incompatible default syntax
  (${AWS_REGION:-us-west-2} → ${AWS_REGION}), change name 'dev' → 'default'
- scripts/deploy.sh: export AWS_REGION with default before envsubst runs
- infra-construct.ts: remove IndexName from s3VectorsConfiguration (caused
  CFN 'oneOf 2 subschemas matched' validation error — only IndexArn +
  VectorBucketArn are needed for BYO S3 Vectors)
- deployed-state.json: updated by successful deploy

* docs: update Quickstart to lead with deploy.sh as primary path

* chore: stop tracking deployed-state.json (deployment-specific, not shared)

* refactor(auth): rename OAUTH_PROVIDER_NAME to GATEWAY_OAUTH_PROVIDER_NAME

Scope auth env vars per boundary for clarity:
- OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

Code maintains backward-compat fallback to legacy names.
CDK injects new names into Runtime env vars at deploy.
.env.example and agentcore/.env.local.example updated
with boundary labels (Boundary 2, Boundary 3).

* docs(auth): add authentication boundary guide

New docs/authentication-guide.md explains the 3 auth boundaries:
1. Runtime Inbound (SigV4 vs CUSTOM_JWT)
2. Gateway Outbound (AWS_IAM vs CUSTOM_JWT M2M)
3. Jira Outbound (USER_FEDERATION 3LO)

Covers: conceptual overview, env var reference, local dev
implications, troubleshooting, and why all 3 patterns exist.

* docs: fix local dev ports, CLI commands, and env var references

README.md:
- Add Port Mapping section (8081=Web UI, 8082=Runtime container)
- Add troubleshooting entry for workload access token error
- Fix agentcore invoke --dev (invalid) -> agentcore dev prompt
- Update config table to use GATEWAY_OAUTH_* var names

docs/custom-jwt-auth-upgrade.md:
- Update all OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- Update all GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

docs/ARCHITECTURE.md:
- Wrap ASCII diagrams in <details> tags for readability

* Fix S3 Vectors Knowledge Base schema: remove indexName from s3VectorsConfiguration

CloudFormation's AWS::Bedrock::KnowledgeBase type with S3_VECTORS storage
has a schema constraint (oneOf) that rejects when both indexArn and indexName
are provided. Pass only vectorBucketArn + indexArn to satisfy the schema.

The indexName is implicit in the indexArn and Bedrock manages metadata
internally during ingestion, so it's not needed in the configuration.

Fixes: Properties validation failed - 'only 1 subschema matches out of 2'
Verified: Stack now deploys successfully with CREATE_COMPLETE status

* feat: migrate online eval to declarative agentcore.json

Remove the custom resource workaround for Online Evaluation. The
AgentCoreOnlineEvaluationConfig L3 construct (@aws/agentcore-cdk
v0.1.0-alpha.34+) now handles dependency ordering automatically.

Changes:
- Delete lambdas/infra/online_eval_provider.py (custom resource Lambda)
- Remove SKIP_ONLINE_EVAL logic from cdk-stack.ts and bin/cdk.ts
- Online eval is now purely declarative via agentcore.json onlineEvalConfigs[]
- To disable: set onlineEvalConfigs to [] in agentcore.json

Standards-Consulted: std.cdk.prefer-declarative
Standards-Gaps: none
Standards-Proposed: none

* fix: align model IDs with available Bedrock models

Update all model ID references to use the exact identifiers from
`aws bedrock list-foundation-models`:
- AGENT_MODEL_ID: us.anthropic.claude-sonnet-4-6 (not -20250929-v1:0)
- FAST_MODEL_ID: us.anthropic.claude-3-5-haiku-20241022-v1:0
- JUDGE_MODEL_ID: us.anthropic.claude-sonnet-4-6

The previous IDs (with -20250929-v1:0 suffix) were invalid and caused
runtime ValidationException on agent invocation.

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format
Standards-Gaps: none
Standards-Proposed: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy

* fix: add --target dev to all agentcore CLI commands

This project uses a named target 'dev' in aws-targets.json (not the
default target). All CLI invocations must explicitly pass --target dev.

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: std.deploy.target-dev

* docs: overhaul documentation to describe current state only

- Remove SKIP_ONLINE_EVAL references throughout
- Fix model IDs in all documentation
- Remove .kiro references from public docs
- Merge duplicate Online Eval sections in README
- Fix GUARDRAIL_ID default (auto-creates, not skips)
- Fix target name in troubleshooting (dev, not default)
- Add --target dev to all documented deploy commands
- Add Declarative vs Imperative section to ARCHITECTURE.md
- Remove stale development process docs (8 root-level .md files)
- Pad all README tables for aligned vertical bars

Standards-Consulted: std.docs.current-state-only, std.deploy.target-dev, std.config.model-id-consistency
Standards-Gaps: none
Standards-Proposed: std.docs.current-state-only

* chore: update agentcore config and CDK dependencies

- agentcore.json: add onlineEvalConfigs, policyEngines, gateway config
- aws-targets.json.template: minor format fix
- CDK packages: update @aws/agentcore-cdk dependency range

Standards-Consulted: std.cdk.prefer-declarative, std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: improve agent resilience and MCP client handling

- main.py: add graceful degradation when MCP tools unavailable,
  safe fallback to LLM-only mode on tool initialization failure
- mcp_client/client.py: add get_all_mcp_clients_safe() with error
  collection instead of hard failure
- trigger: minor fix
- show_ticket.sh: minor fix

Standards-Consulted: std.agentcore.mcp-sigv4-auth
Standards-Gaps: none
Standards-Proposed: none

* feat: add end-to-end test script

scripts/test-e2e.sh publishes a ticket to SNS, polls DynamoDB for
resolution (10s intervals, 120s timeout), and asserts status=Resolved
with a non-empty resolution_comment. Exits 0 on pass, 1 on fail.

Usage:
  ./scripts/test-e2e.sh                     # sample ticket
  ./scripts/test-e2e.sh /path/to/ticket.json  # custom ticket

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: upgrade FAST_MODEL_ID to Claude Haiku 4.5

Replace claude-3-5-haiku-20241022-v1:0 (legacy, access-gated) with
claude-haiku-4-5-20251001-v1:0 (current, available in account).

Verified: model invocable, E2E test passes all 3 tiers (LOW/HIGH/CRITICAL).

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy
Standards-Gaps: none
Standards-Proposed: none

* fix: add .gitignore with lib/ un-ignore for CDK source files

The root .gitignore excludes lib/ globally (for compiled JS output in
other samples). This project's CDK TypeScript source lives in
agentcore/cdk/lib/ and must be tracked. Add project-level .gitignore
with negation rules so 'git add' works without -f flag.

Standards-Consulted: std.git.no-deployed-state
Standards-Gaps: none
Standards-Proposed: none

* docs: remove sample-level LICENSE, inherit from monorepo root

Remove the local MIT-0 LICENSE file from it-incident-response-agent.
The sample should inherit the root repo's Apache 2.0 license, consistent
with all other samples in 02-use-cases/.

* feat: migrate observability to declarative agentcore.json, add Cedar policy steering

- Move OTEL/X-Ray env vars to agentcore.json runtimes[].envVars[]
- Add instrumentation.enableOtel: true
- Add onlineEvalConfigs[] (4 built-in evaluators, 100% sampling)
- Add policyEngines[] with Cedar policies (resource is AgentCore::Gateway)
- Add policyEngineConfiguration to gateway (LOG_ONLY mode)
- Remove ~150 lines of imperative CDK (custom resource, env var overrides)
- L3 construct now handles gateway lambda:InvokeFunction automatically
- Rename target from 'default' to 'dev'
- Fix trigger Lambda runtimeSessionId length (min 33 chars)
- Add Cedar policy syntax steering file
- Update README with CLI commands for online-eval + policy-engine

* chore: remove .kiro/ from git tracking, add to .gitignore

* fix: update evaluate.py

* refactor: simplify evaluate.py to retrieve online eval results

Replace complex on-demand evaluation with a script that queries the
online evaluation results log group. The continuous online evaluation
(agentcore.json onlineEvalConfigs[]) scores all invocations automatically.

Standards-Consulted: std.docs.current-state-only
Standards-Gaps: none
Standards-Proposed: none

* chore: clean up developer-only artifacts and reduce consumer confusion

- Remove AGENTS.md from tracking (Kiro AI context, not for consumers)
- Reorganize .gitignore with categories, add developer-only file exclusions
- Rename docs/online-eval-workaround.md → online-evaluation.md
- Trim ARCHITECTURE.md auth deep-dive (link to authentication-guide.md)
- Simplify README: collapse manual path, clarify CLI-first section,
  remove duplicate env-var table, consolidate Configure section

* feat: add OTEL span attributes, tool-call hooks, e2e test, and eval reporter

- Add ticket.id/priority/requester_id/mode as OTEL span attributes for
  end-to-end trace correlation via CloudWatch Transaction Search
- Add Strands BeforeToolCallEvent/AfterToolCallEvent hooks for per-tool
  call timing in runtime logs
- Add scripts/e2e_test.py with live status polling, log tailing, and
  post-resolution tool call timeline
- Rewrite scripts/evaluate.py to parse online eval results with summary
  (avg scores by evaluator) and detailed per-trace breakdown

* remove: deprecate 02-use-cases/it-incident-response-agent (v1)

The v1 sample at 02-use-cases/it-incident-response-agent/ is superseded by
02-use-cases/automation-agents/it-incident-response-agent/, which is an
evolved version of the same use case with significant improvements:

- CLI-first workflow (agentcore.json + agentcore deploy) vs raw CDK
- Zero external prerequisites to deploy (Auth0/Jira optional, not required)
- All 6 AgentCore services demonstrated (adds Policy Engine, Guardrails)
- Production patterns: DLQ, idempotency, cost routing, graceful degradation
- Local dev support (agentcore dev with hot-reload)
- L3 CDK constructs instead of L1 CfnResource boilerplate
- Comprehensive documentation and design-decisions ADRs

The v1 code used raw L1 CfnResource constructs with mandatory Auth0 +
Jira dependencies, making it inaccessible for quick-start consumers.
All v1 functionality (Jira integration, Auth0 CUSTOM_JWT, Atlassian 3LO,
online evaluation) is preserved in the automation-agents version as
optional toggles.

* style: fix lint and format issues for CI compliance

Python (ruff):
- Remove unused imports: get_all_mcp_clients, get_streamable_http_mcp_client
  (main.py), os (jira_oauth_provider.py), time (seeder.py)
- Auto-format 8 files to pass ruff format check

TypeScript (Prettier):
- Auto-format cdk-stack.ts, infra-construct.ts, bin/cdk.ts

All CI checks now pass:
- ruff check: 0 errors
- ruff format --check: 21 files formatted
- prettier --check: all files pass
- tsc --noEmit: compiles clean
- agentcore validate: Valid

* chore: gitignore eval doc build artifacts

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* fix: resolve ruff lint errors in e2e_test.py

- F541: Remove extraneous f-prefix on string without placeholders (line 157)
- F841: Remove unused variable base_ts (line 270)

Standards-Consulted: std.python.ruff-lint-clean
Standards-Gaps: none
Standards-Proposed: none

* fix: additional e2e_test.py improvements

* fix: e2e_test.py refinements

* fix: code review improvements - error handling, threading, cleanup

- Wrap _resolve_ticket DDB call in try/except (non-fatal failure)
- Add DEBUG log for silent OTEL ImportError
- Remove unused imports in mcp_client/jira.py
- Add docstrings to memory/session.py
- Move import threading to top-level in e2e_test.py
- Replace mutable list stop flag with threading.Event

Verified: all Python files parse cleanly, tsc --noEmit passes,
agentcore validate passes, CDK tests pass, 50-ticket E2E test 100% pass.

* feat: enable Transaction Search observability and tighten IAM scoping

- Add OTEL/GenAI observability env vars (AGENT_OBSERVABILITY_ENABLED,
  message-content capture, application signals) to agentcore.json
- Add Transaction Search custom resource Lambda to route X-Ray segments
  to CloudWatch Logs (aws/spans) for online eval ingestion
- Scope trigger Lambda to bedrock-agentcore:InvokeAgentRuntime on the
  specific runtime ARN (least privilege)
- Add resource-based lambda:InvokeFunction permissions for Gateway targets
- Make _fail_ticket DDB write non-fatal with exception logging
- Misc lint/cleanup in lambdas and e2e_test.py

* docs: reflect auto-enabled Transaction Search via custom resource

Transaction Search is now provisioned automatically by the CDK stack
(transaction_search.py custom resource) when onlineEvalConfigs is set,
so manual 'aws application-signals start-monitoring' is no longer required.
Update README, online-evaluation.md, and ARCHITECTURE.md accordingly.

* refactor: remove redundant L3-provided config, restore Memory resource

- Remove redundant XRayTracing IAM statement from RuntimeAdditionalPolicy (L3 RuntimeExecutionRole already grants xray put-trace perms); keep CloudWatch Logs Insights

- Remove instrumentation.enableOtel from agentcore.json (OTEL wrapping provided by Dockerfile CMD opentelemetry-instrument for Container build)

- Move AGENT_MODEL_ID/FAST_MODEL_ID into agentcore.json runtimes[].envVars[] (declarative, was imperative addPropertyOverride)

- Restore Memory resource (ITIncidentAgentMemory, SUMMARIZATION, namespace incidents/{actorId}) so memory code is backed by a provisioned resource instead of a no-op

- Enable ACTIVE X-Ray tracing on trigger Lambda for full service-map coverage

- Update README/ARCHITECTURE/online-evaluation docs; add 'agentcore add memory' CLI instructions

* docs: fix stale references in auth and schema docs

- authentication-guide: JIRA_MCP_URL is a hardcoded constant set by CDK, not auto-derived from JIRA_SITE_URL

- custom-jwt-auth-upgrade: correct stale function name _get_oauth_token() -> _create_custom_jwt_client()

- .llm-context/README: remove reference to non-existent mcp.ts schema file

* fix: deploy blockers for Memory namespace and gateway target IAM ordering

- Memory SUMMARIZATION namespace requires {sessionId}: incidents/{actorId} -> incidents/{actorId}/{sessionId} (CreateMemory validation failed without it). Retrieval still works via the incidents/{actorId} prefix (prefix matching).

- GatewayTargets now explicitly depend on the gateway role DefaultPolicy. The AgentCoreMcp L3 creates the lambda:InvokeFunction policy but does not order targets after it, causing deterministic 'Gateway execution role lacks permission' CREATE_FAILED. Replaces the ineffective resource-based fn.addPermission approach.

- README: Getting Started section (CI doc gate), Memory namespace + sessionId note

- ARCHITECTURE: corrected Memory namespace note

* style: lint fixes (ruff/pylint) with no behavior change

- main.py: remove unused imports GATEWAY_URL, MEMORY_ID (ruff F401); they are imported where actually used in mcp_client/memory modules

- mcp_client/client.py: remove unnecessary else-after-return (pylint R1705)

- mcp_client/client.py, jira.py: scoped 'pylint: disable=missing-kwoa' with justification on @requires_access_token-decorated calls (decorator injects access_token; pylint cannot see the transform)

* style: black formatting in lambda handlers (no behavior change)

- transaction_search.py: collapse wrapped log line

- ticket_event_handler.py: expand ALLOWED_FIELDS set to multi-line, collapse RuntimeError

* fix: auto-trigger KB ingestion on deploy by passing DataSourceId to seeder

The seeder gates ingestion on 'kb_id and data_source_id', but the CDK only passed KnowledgeBaseId — DataSourceId was never wired through, so start_ingestion_job never ran and the auto-created KB stayed empty until manual ingestion.

Capture the data source id on InfraConstruct (knowledgeBaseDataSourceId) and pass DataSourceId to the TriggerSeeder custom resource. README updated: ingestion is now automatic; manual command kept as optional re-index.

* fix: validate ticket_id/issue_key in agent entrypoint to avoid uncaught KeyError

payload['ticket_id'] was read outside the main try block, so a malformed/direct invoke missing ticket_id (and issue_key) raised an uncaught KeyError that crashed the invoke generator with no structured response. Use payload.get() with an explicit guard that yields a structured Failed result and returns; tighten is_jira_mode to bool(JIRA_MCP_URL).

* fix: agent entrypoint robustness

Guard model output extraction; empty output raises ValueError so the ticket is marked Failed (requires human processing) rather than resolved with a fallback. Sanitize both title and description through the guardrail. Remove dual logger alias. Avoid unbound agent reference when both initializations fail in prompt mode.

Findings #3, #6, #7, #8

* fix: memory cross-session retrieval

Use namespace_path (prefix match) instead of namespace (exact match) so prior-session memories are retrieved during enrichment.

Finding #4

* fix: atomic change-request write + reason field

Use transact_write_items for the dual DynamoDB write so the change request and audit records commit atomically. Add the reason parameter to the tool schema and wire it through, making the RequireReasonForChangeRequest Cedar policy functional.

Findings #5, #12

* fix: DynamoDB Decimal serialization in tools

Convert DynamoDB Decimal values to native int/float before json.dumps so tool responses serialize correctly.

Finding #15

* fix: trigger region + KB ingestion re-run + QueryKb env

Pass region_name to boto3 clients in the ticket event trigger. Add commonEnv to QueryKbFn. Bump the seeder Version to 3 so the KB data source ingestion re-runs.

Findings #9, #10, #14

* fix: e2e span duration unit

Correct the span duration unit conversion in the e2e test.

Finding #11

* style: pylint cleanups in e2e_test and evaluate scripts

- Drop unused loop variable, specify UTF-8 encoding on open()
- Simplify elif-after-return in _score_bar
- Add main() docstrings and wrap long lines

* style: wrap long lines in agent and lambda modules (C0301)

* style: apply ruff format (line-length 120)

* chore: rename folder

* feat(docs): update docs

* chore(usecases) - restructure under workflow

* feat(it-incident-agent): stream real-time pipeline stages + evaluations UI + demo

- Agent (main.py): emit real SSE stage events at each pipeline phase
  (guardrail, memory, tools, diagnose, per-tool-call, persist, emit)
  using agent.stream_async() instead of blocking agent() call
- Docs: add Real-Time Progress Streaming section to ARCHITECTURE.md
- README: add demo GIF showcasing the full workflow
- lambdas/tools: minor cleanup in create_change_request.py
- .pylintrc: project lint config

* style: add blank line before _stage_event function

* chore: update .gitignore for AgentCore CLI and CDK artifacts

* feat: add AgentCore CDK infrastructure (DynamoDB, Lambda, Cognito, EventBridge)

* feat: implement dual-agent claims processor with memory and MCP Gateway

* feat: update Lambda tool handlers with input validation and routing

* feat: add one-command deploy/destroy scripts and .env.example

* feat: add E2E test suite, Cedar tests, lint script, and unit tests

* docs: add architecture, deployment guide, ADRs, and update README

* refactor: remove legacy infra/ directory (replaced by agentcore/cdk/)

* chore: add gitignore negations for claims-agent CDK lib and Dockerfile

* fix: switch test_invoke.py to SigV4 auth (Runtime uses AWS_IAM, not JWT)

* docs: regenerate architecture diagrams and fix Runtime auth description

* style: fix import sorting and trailing whitespace (ruff auto-fix)

* chore: add wilmatos to CONTRIBUTORS.md

* style(event-driven-claims-agent): apply ruff format

* chore(event-driven-claims-agent): improve lint.sh with verbose output, format check, and tsc

* fix(claims-agent): use SigV4 for Runtime invocation, not JWT

The Runtime uses IAM (SigV4) auth; CUSTOM_JWT is only for the Gateway.
- Trigger Lambda: replace Cognito JWT flow with SigV4 signing
- test_e2e.py: switch from Bearer token to SigV4, relax assertions
  to match actual agent streaming output format
- Dockerfile: add non-root user and healthcheck (CKV_DOCKER_2/3)
- test_local.py: add URL scheme validation, suppress S310 lint

* feat(it-incident-response-agent): production-ready IT incident response agent with streaming and observability (#1724)

* feat(usecases): it-incident-response

* add jira integration

* fix minor memory usage points

* docs: add IT incident response agent project docs and assets

* config: add AgentCore project configuration and schema context

* infra: add CDK project for AgentCore L3 construct deployment

* feat: add Strands agent application (runtime, memory, MCP client, model)

* feat: add Lambda functions for tools, infra providers, and ticket trigger

* feat: add tool schemas, seed data, and knowledge base runbooks

* chore: add deployment, evaluation, and ticket utility scripts

* docs: comply with use-case README template (add details table and disclaimer)

* chore: allow esbuild install script in CDK project

* fix: create S3 Vectors bucket+index for KB (CFN does not auto-create)

The Bedrock KnowledgeBase CloudFormation resource with type S3_VECTORS
requires a pre-existing vector bucket and index. Passing an empty
s3VectorsConfiguration fails schema validation. The console's 'quick
create' auto-provisions these, but CloudFormation does not.

Changes:
- Import aws-cdk-lib/aws-s3vectors
- Create CfnVectorBucket (named per account+region)
- Create CfnIndex (float32, 1024 dims, cosine, no metadata keys)
- Wire IndexArn, IndexName, VectorBucketArn into KB storageConfiguration
- Grant KB role s3vectors:* actions on the vector index
- Add removalPolicy to bucket+index
- Add troubleshooting row to README
- Deleted the ROLLBACK_COMPLETE stack to unblock next deploy

* fix: resolve deploy issues (template envsubst, target name, IndexName removal)

- aws-targets.json.template: fix envsubst-incompatible default syntax
  (${AWS_REGION:-us-west-2} → ${AWS_REGION}), change name 'dev' → 'default'
- scripts/deploy.sh: export AWS_REGION with default before envsubst runs
- infra-construct.ts: remove IndexName from s3VectorsConfiguration (caused
  CFN 'oneOf 2 subschemas matched' validation error — only IndexArn +
  VectorBucketArn are needed for BYO S3 Vectors)
- deployed-state.json: updated by successful deploy

* docs: update Quickstart to lead with deploy.sh as primary path

* chore: stop tracking deployed-state.json (deployment-specific, not shared)

* refactor(auth): rename OAUTH_PROVIDER_NAME to GATEWAY_OAUTH_PROVIDER_NAME

Scope auth env vars per boundary for clarity:
- OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

Code maintains backward-compat fallback to legacy names.
CDK injects new names into Runtime env vars at deploy.
.env.example and agentcore/.env.local.example updated
with boundary labels (Boundary 2, Boundary 3).

* docs(auth): add authentication boundary guide

New docs/authentication-guide.md explains the 3 auth boundaries:
1. Runtime Inbound (SigV4 vs CUSTOM_JWT)
2. Gateway Outbound (AWS_IAM vs CUSTOM_JWT M2M)
3. Jira Outbound (USER_FEDERATION 3LO)

Covers: conceptual overview, env var reference, local dev
implications, troubleshooting, and why all 3 patterns exist.

* docs: fix local dev ports, CLI commands, and env var references

README.md:
- Add Port Mapping section (8081=Web UI, 8082=Runtime container)
- Add troubleshooting entry for workload access token error
- Fix agentcore invoke --dev (invalid) -> agentcore dev prompt
- Update config table to use GATEWAY_OAUTH_* var names

docs/custom-jwt-auth-upgrade.md:
- Update all OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- Update all GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

docs/ARCHITECTURE.md:
- Wrap ASCII diagrams in <details> tags for readability

* Fix S3 Vectors Knowledge Base schema: remove indexName from s3VectorsConfiguration

CloudFormation's AWS::Bedrock::KnowledgeBase type with S3_VECTORS storage
has a schema constraint (oneOf) that rejects when both indexArn and indexName
are provided. Pass only vectorBucketArn + indexArn to satisfy the schema.

The indexName is implicit in the indexArn and Bedrock manages metadata
internally during ingestion, so it's not needed in the configuration.

Fixes: Properties validation failed - 'only 1 subschema matches out of 2'
Verified: Stack now deploys successfully with CREATE_COMPLETE status

* feat: migrate online eval to declarative agentcore.json

Remove the custom resource workaround for Online Evaluation. The
AgentCoreOnlineEvaluationConfig L3 construct (@aws/agentcore-cdk
v0.1.0-alpha.34+) now handles dependency ordering automatically.

Changes:
- Delete lambdas/infra/online_eval_provider.py (custom resource Lambda)
- Remove SKIP_ONLINE_EVAL logic from cdk-stack.ts and bin/cdk.ts
- Online eval is now purely declarative via agentcore.json onlineEvalConfigs[]
- To disable: set onlineEvalConfigs to [] in agentcore.json

Standards-Consulted: std.cdk.prefer-declarative
Standards-Gaps: none
Standards-Proposed: none

* fix: align model IDs with available Bedrock models

Update all model ID references to use the exact identifiers from
`aws bedrock list-foundation-models`:
- AGENT_MODEL_ID: us.anthropic.claude-sonnet-4-6 (not -20250929-v1:0)
- FAST_MODEL_ID: us.anthropic.claude-3-5-haiku-20241022-v1:0
- JUDGE_MODEL_ID: us.anthropic.claude-sonnet-4-6

The previous IDs (with -20250929-v1:0 suffix) were invalid and caused
runtime ValidationException on agent invocation.

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format
Standards-Gaps: none
Standards-Proposed: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy

* fix: add --target dev to all agentcore CLI commands

This project uses a named target 'dev' in aws-targets.json (not the
default target). All CLI invocations must explicitly pass --target dev.

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: std.deploy.target-dev

* docs: overhaul documentation to describe current state only

- Remove SKIP_ONLINE_EVAL references throughout
- Fix model IDs in all documentation
- Remove .kiro references from public docs
- Merge duplicate Online Eval sections in README
- Fix GUARDRAIL_ID default (auto-creates, not skips)
- Fix target name in troubleshooting (dev, not default)
- Add --target dev to all documented deploy commands
- Add Declarative vs Imperative section to ARCHITECTURE.md
- Remove stale development process docs (8 root-level .md files)
- Pad all README tables for aligned vertical bars

Standards-Consulted: std.docs.current-state-only, std.deploy.target-dev, std.config.model-id-consistency
Standards-Gaps: none
Standards-Proposed: std.docs.current-state-only

* chore: update agentcore config and CDK dependencies

- agentcore.json: add onlineEvalConfigs, policyEngines, gateway config
- aws-targets.json.template: minor format fix
- CDK packages: update @aws/agentcore-cdk dependency range

Standards-Consulted: std.cdk.prefer-declarative, std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: improve agent resilience and MCP client handling

- main.py: add graceful degradation when MCP tools unavailable,
  safe fallback to LLM-only mode on tool initialization failure
- mcp_client/client.py: add get_all_mcp_clients_safe() with error
  collection instead of hard failure
- trigger: minor fix
- show_ticket.sh: minor fix

Standards-Consulted: std.agentcore.mcp-sigv4-auth
Standards-Gaps: none
Standards-Proposed: none

* feat: add end-to-end test script

scripts/test-e2e.sh publishes a ticket to SNS, polls DynamoDB for
resolution (10s intervals, 120s timeout), and asserts status=Resolved
with a non-empty resolution_comment. Exits 0 on pass, 1 on fail.

Usage:
  ./scripts/test-e2e.sh                     # sample ticket
  ./scripts/test-e2e.sh /path/to/ticket.json  # custom ticket

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: upgrade FAST_MODEL_ID to Claude Haiku 4.5

Replace claude-3-5-haiku-20241022-v1:0 (legacy, access-gated) with
claude-haiku-4-5-20251001-v1:0 (current, available in account).

Verified: model invocable, E2E test passes all 3 tiers (LOW/HIGH/CRITICAL).

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy
Standards-Gaps: none
Standards-Proposed: none

* fix: add .gitignore with lib/ un-ignore for CDK source files

The root .gitignore excludes lib/ globally (for compiled JS output in
other samples). This project's CDK TypeScript source lives in
agentcore/cdk/lib/ and must be tracked. Add project-level .gitignore
with negation rules so 'git add' works without -f flag.

Standards-Consulted: std.git.no-deployed-state
Standards-Gaps: none
Standards-Proposed: none

* docs: remove sample-level LICENSE, inherit from monorepo root

Remove the local MIT-0 LICENSE file from it-incident-response-agent.
The sample should inherit the root repo's Apache 2.0 license, consistent
with all other samples in 02-use-cases/.

* feat: migrate observability to declarative agentcore.json, add Cedar policy steering

- Move OTEL/X-Ray env vars to agentcore.json runtimes[].envVars[]
- Add instrumentation.enableOtel: true
- Add onlineEvalConfigs[] (4 built-in evaluators, 100% sampling)
- Add policyEngines[] with Cedar policies (resource is AgentCore::Gateway)
- Add policyEngineConfiguration to gateway (LOG_ONLY mode)
- Remove ~150 lines of imperative CDK (custom resource, env var overrides)
- L3 construct now handles gateway lambda:InvokeFunction automatically
- Rename target from 'default' to 'dev'
- Fix trigger Lambda runtimeSessionId length (min 33 chars)
- Add Cedar policy syntax steering file
- Update README with CLI commands for online-eval + policy-engine

* chore: remove .kiro/ from git tracking, add to .gitignore

* fix: update evaluate.py

* refactor: simplify evaluate.py to retrieve online eval results

Replace complex on-demand evaluation with a script that queries the
online evaluation results log group. The continuous online evaluation
(agentcore.json onlineEvalConfigs[]) scores all invocations automatically.

Standards-Consulted: std.docs.current-state-only
Standards-Gaps: none
Standards-Proposed: none

* chore: clean up developer-only artifacts and reduce consumer confusion

- Remove AGENTS.md from tracking (Kiro AI context, not for consumers)
- Reorganize .gitignore with categories, add developer-only file exclusions
- Rename docs/online-eval-workaround.md → online-evaluation.md
- Trim ARCHITECTURE.md auth deep-dive (link to authentication-guide.md)
- Simplify README: collapse manual path, clarify CLI-first section,
  remove duplicate env-var table, consolidate Configure section

* feat: add OTEL span attributes, tool-call hooks, e2e test, and eval reporter

- Add ticket.id/priority/requester_id/mode as OTEL span attributes for
  end-to-end trace correlation via CloudWatch Transaction Search
- Add Strands BeforeToolCallEvent/AfterToolCallEvent hooks for per-tool
  call timing in runtime logs
- Add scripts/e2e_test.py with live status polling, log tailing, and
  post-resolution tool call timeline
- Rewrite scripts/evaluate.py to parse online eval results with summary
  (avg scores by evaluator) and detailed per-trace breakdown

* remove: deprecate 02-use-cases/it-incident-response-agent (v1)

The v1 sample at 02-use-cases/it-incident-response-agent/ is superseded by
02-use-cases/automation-agents/it-incident-response-agent/, which is an
evolved version of the same use case with significant improvements:

- CLI-first workflow (agentcore.json + agentcore deploy) vs raw CDK
- Zero external prerequisites to deploy (Auth0/Jira optional, not required)
- All 6 AgentCore services demonstrated (adds Policy Engine, Guardrails)
- Production patterns: DLQ, idempotency, cost routing, graceful degradation
- Local dev support (agentcore dev with hot-reload)
- L3 CDK constructs instead of L1 CfnResource boilerplate
- Comprehensive documentation and design-decisions ADRs

The v1 code used raw L1 CfnResource constructs with mandatory Auth0 +
Jira dependencies, making it inaccessible for quick-start consumers.
All v1 functionality (Jira integration, Auth0 CUSTOM_JWT, Atlassian 3LO,
online evaluation) is preserved in the automation-agents version as
optional toggles.

* style: fix lint and format issues for CI compliance

Python (ruff):
- Remove unused imports: get_all_mcp_clients, get_streamable_http_mcp_client
  (main.py), os (jira_oauth_provider.py), time (seeder.py)
- Auto-format 8 files to pass ruff format check

TypeScript (Prettier):
- Auto-format cdk-stack.ts, infra-construct.ts, bin/cdk.ts

All CI checks now pass:
- ruff check: 0 errors
- ruff format --check: 21 files formatted
- prettier --check: all files pass
- tsc --noEmit: compiles clean
- agentcore validate: Valid

* chore: gitignore eval doc build artifacts

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* fix: resolve ruff lint errors in e2e_test.py

- F541: Remove extraneous f-prefix on string without placeholders (line 157)
- F841: Remove unused variable base_ts (line 270)

Standards-Consulted: std.python.ruff-lint-clean
Standards-Gaps: none
Standards-Proposed: none

* fix: additional e2e_test.py improvements

* fix: e2e_test.py refinements

* fix: code review improvements - error handling, threading, cleanup

- Wrap _resolve_ticket DDB call in try/except (non-fatal failure)
- Add DEBUG log for silent OTEL ImportError
- Remove unused imports in mcp_client/jira.py
- Add docstrings to memory/session.py
- Move import threading to top-level in e2e_test.py
- Replace mutable list stop flag with threading.Event

Verified: all Python files parse cleanly, tsc --noEmit passes,
agentcore validate passes, CDK tests pass, 50-ticket E2E test 100% pass.

* feat: enable Transaction Search observability and tighten IAM scoping

- Add OTEL/GenAI observability env vars (AGENT_OBSERVABILITY_ENABLED,
  message-content capture, application signals) to agentcore.json
- Add Transaction Search custom resource Lambda to route X-Ray segments
  to CloudWatch Logs (aws/spans) for online eval ingestion
- Scope trigger Lambda to bedrock-agentcore:InvokeAgentRuntime on the
  specific runtime ARN (least privilege)
- Add resource-based lambda:InvokeFunction permissions for Gateway targets
- Make _fail_ticket DDB write non-fatal with exception logging
- Misc lint/cleanup in lambdas and e2e_test.py

* docs: reflect auto-enabled Transaction Search via custom resource

Transaction Search is now provisioned automatically by the CDK stack
(transaction_search.py custom resource) when onlineEvalConfigs is set,
so manual 'aws application-signals start-monitoring' is no longer required.
Update README, online-evaluation.md, and ARCHITECTURE.md accordingly.

* refactor: remove redundant L3-provided config, restore Memory resource

- Remove redundant XRayTracing IAM statement from RuntimeAdditionalPolicy (L3 RuntimeExecutionRole already grants xray put-trace perms); keep CloudWatch Logs Insights

- Remove instrumentation.enableOtel from agentcore.json (OTEL wrapping provided by Dockerfile CMD opentelemetry-instrument for Container build)

- Move AGENT_MODEL_ID/FAST_MODEL_ID into agentcore.json runtimes[].envVars[] (declarative, was imperative addPropertyOverride)

- Restore Memory resource (ITIncidentAgentMemory, SUMMARIZATION, namespace incidents/{actorId}) so memory code is backed by a provisioned resource instead of a no-op

- Enable ACTIVE X-Ray tracing on trigger Lambda for full service-map coverage

- Update README/ARCHITECTURE/online-evaluation docs; add 'agentcore add memory' CLI instructions

* docs: fix stale references in auth and schema docs

- authentication-guide: JIRA_MCP_URL is a hardcoded constant set by CDK, not auto-derived from JIRA_SITE_URL

- custom-jwt-auth-upgrade: correct stale function name _get_oauth_token() -> _create_custom_jwt_client()

- .llm-context/README: remove reference to non-existent mcp.ts schema file

* fix: deploy blockers for Memory namespace and gateway target IAM ordering

- Memory SUMMARIZATION namespace requires {sessionId}: incidents/{actorId} -> incidents/{actorId}/{sessionId} (CreateMemory validation failed without it). Retrieval still works via the incidents/{actorId} prefix (prefix matching).

- GatewayTargets now explicitly depend on the gateway role DefaultPolicy. The AgentCoreMcp L3 creates the lambda:InvokeFunction policy but does not order targets after it, causing deterministic 'Gateway execution role lacks permission' CREATE_FAILED. Replaces the ineffective resource-based fn.addPermission approach.

- README: Getting Started section (CI doc gate), Memory namespace + sessionId note

- ARCHITECTURE: corrected Memory namespace note

* style: lint fixes (ruff/pylint) with no behavior change

- main.py: remove unused imports GATEWAY_URL, MEMORY_ID (ruff F401); they are imported where actually used in mcp_client/memory modules

- mcp_client/client.py: remove unnecessary else-after-return (pylint R1705)

- mcp_client/client.py, jira.py: scoped 'pylint: disable=missing-kwoa' with justification on @requires_access_token-decorated calls (decorator injects access_token; pylint cannot see the transform)

* style: black formatting in lambda handlers (no behavior change)

- transaction_search.py: collapse wrapped log line

- ticket_event_handler.py: expand ALLOWED_FIELDS set to multi-line, collapse RuntimeError

* fix: auto-trigger KB ingestion on deploy by passing DataSourceId to seeder

The seeder gates ingestion on 'kb_id and data_source_id', but the CDK only passed KnowledgeBaseId — DataSourceId was never wired through, so start_ingestion_job never ran and the auto-created KB stayed empty until manual ingestion.

Capture the data source id on InfraConstruct (knowledgeBaseDataSourceId) and pass DataSourceId to the TriggerSeeder custom resource. README updated: ingestion is now automatic; manual command kept as optional re-index.

* fix: validate ticket_id/issue_key in agent entrypoint to avoid uncaught KeyError

payload['ticket_id'] was read outside the main try block, so a malformed/direct invoke missing ticket_id (and issue_key) raised an uncaught KeyError that crashed the invoke generator with no structured response. Use payload.get() with an explicit guard that yields a structured Failed result and returns; tighten is_jira_mode to bool(JIRA_MCP_URL).

* fix: agent entrypoint robustness

Guard model output extraction; empty output raises ValueError so the ticket is marked Failed (requires human processing) rather than resolved with a fallback. Sanitize both title and description through the guardrail. Remove dual logger alias. Avoid unbound agent reference when both initializations fail in prompt mode.

Findings #3, #6, #7, #8

* fix: memory cross-session retrieval

Use namespace_path (prefix match) instead of namespace (exact match) so prior-session memories are retrieved during enrichment.

Finding #4

* fix: atomic change-request write + reason field

Use transact_write_items for the dual DynamoDB write so the change request and audit records commit atomically. Add the reason parameter to the tool schema and wire it through, making the RequireReasonForChangeRequest Cedar policy functional.

Findings #5, #12

* fix: DynamoDB Decimal serialization in tools

Convert DynamoDB Decimal values to native int/float before json.dumps so tool responses serialize correctly.

Finding #15

* fix: trigger region + KB ingestion re-run + QueryKb env

Pass region_name to boto3 clients in the ticket event trigger. Add commonEnv to QueryKbFn. Bump the seeder Version to 3 so the KB data source ingestion re-runs.

Findings #9, #10, #14

* fix: e2e span duration unit

Correct the span duration unit conversion in the e2e test.

Finding #11

* style: pylint cleanups in e2e_test and evaluate scripts

- Drop unused loop variable, specify UTF-8 encoding on open()
- Simplify elif-after-return in _score_bar
- Add main() docstrings and wrap long lines

* style: wrap long lines in agent and lambda modules (C0301)

* style: apply ruff format (line-length 120)

* chore: rename folder

* feat(docs): update docs

* chore(usecases) - restructure under workflow

* feat(it-incident-agent): stream real-time pipeline stages + evaluations UI + demo

- Agent (main.py): emit real SSE stage events at each pipeline phase
  (guardrail, memory, tools, diagnose, per-tool-call, persist, emit)
  using agent.stream_async() instead of blocking agent() call
- Docs: add Real-Time Progress Streaming section to ARCHITECTURE.md
- README: add demo GIF showcasing the full workflow
- lambdas/tools: minor cleanup in create_change_request.py
- .pylintrc: project lint config

* style: add blank line before _stage_event function

* chore: update .gitignore for AgentCore CLI and CDK artifacts

* feat: add AgentCore CDK infrastructure (DynamoDB, Lambda, Cognito, EventBridge)

* feat: implement dual-agent claims processor with memory and MCP Gateway

* feat: update Lambda tool handlers with input validation and routing

* feat: add one-command deploy/destroy scripts and .env.example

* feat: add E2E test suite, Cedar tests, lint script, and unit tests

* docs: add architecture, deployment guide, ADRs, and update README

* refactor: remove legacy infra/ directory (replaced by agentcore/cdk/)

* chore: add gitignore negations for claims-agent CDK lib and Dockerfile

* fix: switch test_invoke.py to SigV4 auth (Runtime uses AWS_IAM, not JWT)

* docs: regenerate architecture diagrams and fix Runtime auth description

* style: fix import sorting and trailing whitespace (ruff auto-fix)

* chore: add wilmatos to CONTRIBUTORS.md

* style(event-driven-claims-agent): apply ruff format

* chore(event-driven-claims-agent): improve lint.sh with verbose output, format check, and tsc

* fix(claims-agent): use SigV4 for Runtime invocation, not JWT

The Runtime uses IAM (SigV4) auth; CUSTOM_JWT is only for the Gateway.
- Trigger Lambda: replace Cognito JWT flow with SigV4 signing
- test_e2e.py: switch from Bearer token to SigV4, relax assertions
  to match actual agent streaming output format
- Dockerfile: add non-root user and healthcheck (CKV_DOCKER_2/3)
- test_local.py: add URL scheme validation, suppress S310 lint

---------

Signed-off-by: Will Matos <wilmatos@amazon.com>
Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akarsha15010@iiitd.ac.in>
Co-authored-by: Will Matos <wmatosjr@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Harness GA Samples — AWS Skills, S3 Filesystem, Step Functions, Builder Agent (#1688)

* Add Harness GA samples: AWS Skills, S3 filesystem, Step Functions, builder agent

Four new samples under 01-features/01-harness for the Harness GA launch:

- 01-advanced-examples/08-aws-skills: enable native AWS Skills from the AWS
  Agent Toolkit via the awsSkills source (all / glob / specific / mixed modes)
- 01-advanced-examples/09-s3-filesystem: mount an S3 Files access point as the
  agent filesystem; includes s3_knowledge_base.py — a persistent LLM-wiki
  knowledge base (ingest / query / lint) on the S3 mount
- 01-advanced-examples/10-stepfunctions-orchestration: a Step Functions STANDARD
  state machine that drives the harness lifecycle (create -> poll READY ->
  invoke -> delete) via a Lambda task worker
- 02-use-cases/03-aws-builder-agent: harness + AWS Skills compose an AWS
  engineering agent that designs and scaffolds a serverless app

All samples use the GA boto3 SDK shapes (create_harness/invoke_harness) with no
internal endpoints or configuration. Updated the harness README index.

* Rename s3_knowledge_base.py to s3_llm_wiki.py to avoid Bedrock Knowledge Bases confusion

The LLM-wiki sample is a self-maintained markdown wiki on the agent's
filesystem, unrelated to the Amazon Bedrock Knowledge Bases feature. Rename the
file and scrub 'knowledge base' wording (mount default /mnt/wiki, pages/ subdir)
across the script and READMEs to prevent customer confusion.

* Fix S3 filesystem + Step Functions samples after end-to-end testing

Verified the samples against the live GA API and fixed real bugs found:

S3 filesystem (s3_filesystem.py, s3_llm_wiki.py):
- S3 Files mounts REQUIRE VPC network mode — add networkConfiguration
  (networkMode=VPC + subnets + security groups) to create_harness; add
  required --subnet-ids/--security-group-ids CLI args.
- Execution role needs s3files permissions (ListMountTargets/Get*/ClientMount/
  ClientWrite/ClientRootAccess), not plain s3:* — correct the attached policy.
- README: document VPC + mount-target prerequisites and the new args.

Step Functions (stepfunctions_orchestration.py):
- Lambda role also needs *AgentRuntime* actions (CreateHarness provisions an
  underlying AgentRuntime) — without them CreateHarness returns AccessDenied.
- CheckStatus Choice now matches CREATE_FAILED/UPDATE_FAILED so a failed
  creation fails fast instead of looping on the WaitForReady default forever.

* Rework Step Functions sample to native integration; fix S3 Files IAM/VPC guidance

Step Functions: replace the Lambda task-worker approach with the native
arn:aws:states:::bedrockagentcore:invokeHarness service integration — a single
Task state, no Lambda, no glue. The state machine's own role gets
bedrock-agentcore:InvokeHarness; output is Converse-shaped
(Output.Message.Content[].Text). Rewrote the README accordingly.

S3 filesystem: scope the execution-role IAM to what the runtime actually needs —
s3files:GetAccessPoint (unscoped, validated at harness create time) plus
s3files:ClientMount/ClientWrite (conditioned on the access point). Document that
S3 Files mounts require VPC network mode with private subnets that have egress
(route to a NAT gateway); public subnets do not connect. Same IAM fix applied to
the s3_llm_wiki.py sample.

* Remove Step Functions sample; renumber to avoid collision with merged samples

Upstream main now occupies advanced-examples 01-12 (incl. 06-async-step-function,
08-gemini-model-provider, 09-openai-model-provider). Renumber our two samples to
free slots and drop the Step Functions sample (upstream added its own):

- delete 10-stepfunctions-orchestration
- 08-aws-skills  -> 13-aws-skills
- 09-s3-filesystem -> 14-s3-filesystem

Updated all cross-references (harness index README, builder-agent note).

* docs: fix evaluations next step link (#1679)

* Add Weather Agent use case with harness, gateway, guardrails, evaluation and observability (#1648)

* Add Weather Agent use case with harness, gateway, guardrails, evaluations, and observability

* fix: resolve lint errors and security finding (unused imports, f-strings, bind to localhost)

* fix: address PR feedback (README clarifications, region detection, graceful eval error, trace
  display)

* feat: add Skills (xlsx report generation) and Optimization (system prompt recommendations)

* feat: add Skills (xlsx report generation) and Optimization (system prompt recommendations)

* fix: address PR feedback (README clarifications, region detection, graceful eval error, trace
  display)

* Agentcore optimization nys (#1722)

* Add failure insights sample (insights.py) and update README

- Add insights.py: runs FailureAnalysis, UserIntent, and ExecutionSummary
  batch insight jobs on the HR Assistant agent. Supports --generate-traces
  to send curated failure-mode sessions, --online to create a recurring
  daily OnlineEvaluationConfig, and --insight to select individual insight
  types. Uses both aws/spans and the runtime log group as data sources.

- Update README with a full Failure Insights section covering all three
  insight types, data source requirements, CLI examples, and how to chain
  insights into a system prompt recommendation.

* sample for agentcore insights feature with SDK scripts and CLI examples

* agent loops image

* move CLI insights step to after deploy and baseline eval in optimization workflow

* remove step 0 from CLI examples

* add insights.py description in How It Works section

* adding docs links to readme

* rename failure insights to insights throughout

* fix pylint and ruff issues in insights.py

- Add encoding="utf-8" to file read/write calls
- Wrap long lines to stay within 100-char limit
- Add pylint disable comments for intentional broad-exception-caught
- Rename loop variable to avoid module-scope naming false positive
- Remove f-string prefix from string literals without placeholders (ruff fix)

* remove generated state and config files

* remove TEST_LOG.md from registry

* scope aws-targets gitignore to exclude gateway config files

* clearing outputs from NBs

* fix ruff/pylint line-length conflict in optimize folder

* update repository structure in readme

* updating main readme

* replace account numbers and resource IDs with placeholders in optimization notebook

* Amazon Bedrock AgentCore Gateway websearch samples and usecases  (#1721)

* Add AgentCore Web Search Tool samples and workshop content

- 01-features: new 03-web-search folder with setup, raw MCP, Strands,
  and LangChain samples; updated requirements.txt with pinned versions
- 06-workshops: new 03-Agent-Core-web-search workshop with 6 notebooks
  covering gateway setup, Strands agent, LangChain agent, CVE scanner,
  earnings brief, and iterative research pattern
- 06-workshops/05-AgentCore-tools/README.md: added Web Search Tool section

* feat: add deep-research-agent with auto-provisioning and search privacy notices

- Add deep-research-agent use case with iterative Plan/Search/Reflect/Synthesize loop
- Add gateway_setup.py with auto-detect/prompt/provision flow (no hard prerequisites)
- Add search privacy callout to all 03-web-search README files
- Fix model ID default to use cross-region inference profile
- Add user-friendly error handling for auth failures

* Update finance budget assistant for Claude Haiku 4.5 (#1742)

- Update BUDGET_SYSTEM_PROMPT in lab1: the previous prompt broke the
  structured output instructions with Claude Haiku 4.5
- Remove outdated note about enabling model access for Claude 3.7 Sonnet
- Update references from Anthropic Claude 3.7 Sonnet to Claude Haiku 4.5
  in lab1 and README

* Add skip-extraction sample and rename 08-redrive to 08-manage-extraction (#1746)

Adds a runnable sample demonstrating extractionMode=SKIP on CreateEvent,
which stores events in short-term memory without triggering long-term
extraction. Renames the folder to 08-manage-extraction to cover both
skip and redrive as extraction lifecycle controls.

Co-authored-by: Gal Goldman <galgold@amazon.com>

* feat(memory): add multi-region-replication example (#1747)

* feat(memory): add multi-region-replication example

* feat(memory): update func

* chore: ruff formatting

* feat(use-cases): add multi-ISV orchestration sample (Salesforce + SAP) (#1640)

* feat(use-cases): add multi-ISV orchestration sample — Salesforce + SAP

Add a standalone use case under 02-use-cases/multi-isv-orchestration/
demonstrating how to connect Salesforce Lightning Platform and AWS for
SAP MCP Server to a single AgentCore Gateway, enabling cross-system AI
agent workflows through one unified MCP endpoint.

Three Jupyter notebooks walk through:
- 01: Salesforce as integration target (CustomOauth2, 43 tools)
- 02: SAP MCP Server as MCP target (9 tools, read-only default)
- 03: Cross-ISV queries (Customer 360, pipeline reconciliation)

Includes gateway_mcp_client.py utility, architecture diagrams, and
documented workarounds (Content-Type, domainName, org hibernation).

Originally proposed under 01-tutorials/02-AgentCore-gateway/ in
#1487; relocated to 02-use-cases/ to fit the new repo structure
where 01-features/ is CLI-only and end-to-end samples live under
02-use-cases/.

* security(multi-isv): scope Gateway IAM role and harden notebook inputs

Address threat-model review feedback on the multi-ISV orchestration sample:

- Scope the Gateway execution-role policy: split the single Resource:"*"
  statement into four scoped statements (bedrock:InvokeModel limited to the
  Claude model/inference-profile ARNs, secretsmanager:GetSecretValue limited
  to the bedrock-agentcore-* secret prefix, iam:PassRole limited to the role
  itself with a PassedToService condition); remove the unused s3:GetObject.
- Stop printing the Cognito client secret in the NB01 summary; show the
  describe-user-pool-client retrieval command instead.
- Validate SF_DOMAIN against a strict [A-Za-z0-9-]+ pattern to prevent
  redirecting tool calls to an attacker-controlled host.
- Update the README Disclaimer to reflect the scoped IAM policy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(multi-isv): add sample to workflow-automation category README

List multi-isv-orchestration in the 02-workflow-automation-agents
samples table after relocating the folder into that category.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* `feat(04-coding-agents): add sample 05 — autonomous coding agent with durable orchestration` (#1725)

* feat: add sample 05 — autonomous coding agent with durable orchestration

Event-driven headless coding backend on AgentCore Runtime with:
- Lambda Durable Function orchestrator (zero-cost suspension)
- 4 specialized runtimes (coding agent, sandbox, Swift sandbox, evaluator)
- Cedar policy enforcement at sandbox layer
- AgentCore Memory for cross-ticket learning
- Evaluator agent for read-only code review
- CDK deployment (8 stacks)

* docs: note that sandbox examples cover Python and Swift but are extendable to other frameworks

* fix: resolve ruff lint violations (E741, E401, F541) across four files

- Rename ambiguous variable l to lesson in list comprehensions
  (shared/memory.py, orchestrator/handler.py)
- Split multi-import into separate statements (sandbox/app.py)
- Remove unnecessary f-string prefix (cdk/stacks/storage_stack.py)
- Add property-based tests verifying lint compliance and behavior preservation

* fix: suppress 8 false-positive ASH security findings with inline annotations

- Add # nosec B108 to intentional /tmp usage in isolated containers/microVMs
- Add # nosec B602 to sandboxed subprocess executor (sandbox/app.py)
- Add # nosec B108 to test files (assertions and fixtures, not real /tmp usage)
- Add #checkov:skip=CKV_DOCKER_3 to Dockerfile.swift (entrypoint.sh handles su)
- Each annotation includes justification for audit trail

* chore: remove AgentCore diagram icon PNGs from claims agent docs

* feat: refactor agent core — inline MCP client, add routing module, remove legacy modules

- Rewrite main.py: inline @requires_access_token MCP client builder,
  structured output tools, confidence-based routing via routing.py
- Add routing.py: extracted pure routing logic (resolve_decision,
  resolve_routing, decide_action) with safe fallback defaults
- Update config.py: L3 construct auto-generated env var support,
  memory retrieval tuning params, credential provider config
- Update memory/session.py: configurable retrieval top_k and relevance
- Update Dockerfile: base image, uv sync steps
- Update pyproject.toml/requirements.txt/uv.lock: dependency refresh
- Remove mcp_client/ module: replaced by inline client in main.py
- Remove model/ module: load_model() now inline in main.py
- Remove parsing.py: regex parsing replaced by structured output tools

* feat: update CDK infra and agentcore.json for Identity-managed auth

- agentcore.json: add Cognito OAuth credential provider, OnlineEval
  evaluator config, SEMANTIC + SUMMARIZATION memory strategies
- cdk-stack.ts: patch Lambda ARNs into gateway targets, wire CUSTOM_JWT
  authorizer from Cognito discovery URL, add gateway target dependency
  ordering fix, suppress mis-parsed target outputs
- infra-construct.ts: add DynamoDB GSIs (status, claim_id), S3 bucket
  with EventBridge notifications, SNS topic, 6 Lambda tool functions +
  trigger, EventBridge rule for S3 PutObject
- cdk.ts: updated stack instantiation with spec/mcpSpec/credentials
- package.json/package-lock.json: CDK dependency updates

* feat: update Lambda handlers and trigger for simplified routing

- trigger/handler.py: SigV4-signed HTTPS invocation to Runtime,
  email parsing with claimant_email extraction, SSE response buffering
- list_pending_claims/handler.py: use GSI query instead of table scan
- notification/handler.py: updated response format, error handling
- resolve_claim/handler.py: write resolution to both Claims + Reviews tables

* feat: add deploy, teardown, auth, and observability scripts

* test: add unit tests for routing, structured output, Lambda handlers, trigger

* docs: update architecture, decisions, deployment, and configuration docs

- AGENTS.md: updated AI assistant context for current architecture
- README.md: updated quick start, project structure, commands
- .env.example: updated template for Identity-managed auth
- .gitignore: remove docs/decisions/ exclusion (publish ADRs)
- docs/ARCHITECTURE.md: updated system design, component descriptions
- docs/CONFIGURATION.md: updated config reference
- docs/README.md: updated index and prerequisites
- docs/deployment.md: updated deploy/verify/teardown steps
- docs/tutorial.md: updated guided walkthrough
- docs/decisions/0004: rewritten as Hybrid Auth (SigV4 + Cognito M2M)
- docs/decisions/0010: rewritten + renamed (Identity token vault)
- docs/decisions/0011-0012: now tracked (externalized config, GSI)
- docs/decisions/README.md: updated index with correct titles

* claims-agent: fire-and-forget trigger, resilient prompts, e2e timing

- Trigger Lambda: fire-and-forget invocation (read first 5 lines only,
  don't buffer full SSE stream). Timeout bumped to 65s for cold starts.
- Trigger Lambda timeout in CDK: 60s → 90s to cover Runtime cold start.
- Processor prompt: graceful handling when lookup_policy fails, guard
  against tool hallucination and fabricated policy details.
- E2E tests: add per-test timing, increase async wait to 90s.
- ARCHITECTURE.md: document fire-and-forget pattern.
- Add scripts/analyze_traces.py for OTEL trace analysis.

* feat(claims-agent): add cost-based model routing for Validation Agent

Route the Validation Agent (Phase 2) to Haiku via FAST_MODEL_ID,
saving ~80% cost and 3-8s latency per invocation. The validator
performs classification only (no tool use), making it an ideal
candidate for a smaller model.

Changes:
- Add FAST_MODEL_ID env var to config.py, agentcore.json, .env.example
- Update load_model() to accept fast=True for cost routing
- Wire get_validator() to use the fast model
- Add ADR-0013 documenting the decision
- Update AGENTS.md, ARCHITECTURE.md, CONFIGURATION.md

* claims-agent: cost routing (FAST_MODEL_ID) + deterministic Phase 3

Performance optimizations:
- Add FAST_MODEL_ID (Haiku) for Phase 2 Validation Agent — classification
  task doesn't need Sonnet. Saves 3-8s and ~80% cost per invocation.
- Replace Phase 3 LLM call with direct MCPClient.call_tool_async() calls.
  Routing is deterministic after Phase 2; no LLM needed. Saves 6-16s.
- Combined: pipeline goes from 3 Sonnet calls to 1 Sonnet + 1 Haiku + 0.
  Measured: 65s (deployed old) → 28s (local new) = 56% reduction.

Code changes:
- config.py: add FAST_MODEL_ID env var
- main.py: load_model(fast=True) for validator, _call_tool() helper for
  direct MCP calls, deterministic Phase 3 with non-fatal error handling
- agentcore.json: add FAST_MODEL_ID to runtime envVars
- .env.example: document FAST_MODEL_ID

Documentation:
- AGENTS.md: updated description, architecture diagram, invariant #8
- ARCHITECTURE.md: Phase 3 deterministic section, model routing line
- CONFIGURATION.md: FAST_MODEL_ID in both config tables
- deployment.md: fix --no-browser → --logs, port 3000 → 8080, Phase 3 output
- README.md: updated Phase 3 expected output
- ADR-0013: cost-based model routing decision
- ADR-0014: deterministic Phase 3 decision
- Skill ref: mcp-client-patterns.md (correct call_tool_async API)

* chore(claims-agent): sanitize agentcore.json and improve E2E tests/docs

- Replace env-specific Cognito discovery URL with PLACEHOLDER_USER_POOL_ID
- Add gateway exceptionLevel: NONE
- test_e2e.py: evidence-based assertions + --verbose flag
- deployment.md: add troubleshooting and config reference
- Add fix_credential_region.sh helper
- gitignore local backup and perf/design artifacts

* chore(claims-agent): placeholder the region in agentcore.json discovery URLs

Replace hardcoded us-west-2 with PLACEHOLDER_REGION in both the credentials
and gateway CUSTOM_JWT discovery URLs. Both values are overridden at deploy
(agentcore add credential / CDK authorizer patch), so this keeps the committed
config free of environment-specific region info.

* docs(claims-agent): refresh architecture diagram, fix ADRs, drop demo video

- Regenerate architecture.png (landscape high-level diagram) + commit
  reproducible source docs/diagrams/architecture.py and AgentCore icons
- Reference architecture.png from README.md and docs/ARCHITECTURE.md
- Remove stale/duplicate ADR 0010-unsafe-unwrap.md (superseded by
  0010-identity-token-vault-for-secrets.md; pattern not in code)
- Remove 6MB demo.mp4; README now embeds demo.gif (to be added)

* docs(claims-agent): add demo.gif and embed it in README

* fix(claims-agent): remove f-string prefix from strings without placeholders (F541)

* fix: apply ruff format to 5 Python files (CI lint fix)

---------

Signed-off-by: Will Matos <wilmatos@amazon.com>
Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akarsha15010@iiitd.ac.in>
Co-authored-by: Will Matos <wmatosjr@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Ed Fraga <39071108+edfragas@users.noreply.github.com>
Co-authored-by: 吴杨帆 <39647285+wyf027@users.noreply.github.com>
Co-authored-by: JobRamos <33988720+JobRamos@users.noreply.github.com>
Co-authored-by: Bharathi Srinivasan <bhrsrini@amazon.com>
Co-authored-by: Naga Gaddamu <zigeesha@hotmail.com>
Co-authored-by: philgut-aws <philgut@amazon.de>
Co-authored-by: gel-work <171434940+gel-work@users.noreply.github.com>
Co-authored-by: Gal Goldman <galgold@amazon.com>
Co-authored-by: Joachim Aumann <aumannjoachim@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Sascha Möllering <smoell@amazon.de>
2026-07-09 17:48:51 -04:00
sumanayanamandra bde5786ae2 Add AgentCore Web Search Tool managed connector for customer service agent (#1749)
* Add AgentCore Web Search Tool managed connector, remove third-party search dependency

* added testing examples, verify no stale refs, update interceptor allowed tools, link to docs for IAM action

* address review: remove tavily completely, delete WEB_SEARCH_README, fix checkov findings (PITR, DLQ, concurrency, scoped IAM)

---------

Co-authored-by: Sumana Yanamandra <syanaman@amazon.com>
2026-07-09 13:27:38 -04:00
Senthil 1229a4c385 feat: add AgentCore Gateway tool search plugin sample (#1622)
* feat: add AgentCore Gateway tool search plugin sample

Add sample demonstrating semantic tool discovery with
AgentCore Gateway and Strands Agents using travel-domain
Lambda tools.

* docs: add name to CONTRIBUTORS.md

* refactor: convert notebook to separate Python scripts with detailed README

- Replace notebook with deploy.py, invoke.py, cleanup.py, config.py
- Add detailed README with architecture diagram and usage instructions
- Add requirements.txt and .gitignore
- Add architecture diagram from AgentCore SDK

* fix: resolve lint errors in invoke.py and travel_tools.py

- Remove f-prefix from strings without placeholders (F541)
- Remove unused json import (F401)
- Remove unused local variables interests and category (F841)

* Adding benchmark results

* feat: add intent relevance benchmark and update scaling benchmark

---------

Signed-off-by: Senthil <34865595+senthilkumarmohan@users.noreply.github.com>
2026-07-08 07:50:46 -04:00
Akarsha Sehwag eb4b9609c4 feat(Memory): update namespaces to clarify multi-tenancy usecase (#1754)
* Update namespace docu

Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>

* Update namespaces and memory strategies to show multi-tenancy ex

Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>

---------

Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>
2026-07-07 02:44:18 -04:00
Diego Brasil 131cf1f980 Add Receipts IDP agent (Intelligent Document Processing) with a model degradation ladder (#1748)
* Add Receipts IDP agent (Intelligent Document Processing) with a model degradation ladder

* style: apply ruff format (line-length 120) to receipts IDP sample

Fixes the python-lint CI job on PR #1748. The CI runs both
`ruff check` and `ruff format --check` against the repo-root
config (line-length = 120); the sample previously only ran
`ruff check`, so the formatter job failed on 26 files.

Reformats those files (whitespace/wrapping only, no logic change)
and updates the sample Makefile's `make lint` to run BOTH ruff
commands at line-length 120, matching CI exactly. Adds `make format`
to auto-fix.

* fix(destroy): handle DELETE_FAILED / orphaned AgentCore control-plane resources

Addresses PR review (destroy.sh). AgentCore control-plane resources
(Runtime, Gateway, GatewayTarget, PolicyEngine, Evaluator) can fail to
delete on the first pass due to control-plane resource ordering, leaving
the stack in DELETE_FAILED. The old script's blind 'cloudformation wait'
then exited with an opaque error and no guidance.

destroy.sh now:
  1. polls delete-stack to a terminal status;
  2. on DELETE_FAILED, retries the plain delete once (transient ordering
     orphans usually clear);
  3. if still stuck, re-issues delete with --retain-resources <ids> (valid
     only in DELETE_FAILED) so the stack + everything billable is removed;
  4. prints each retained resource (ResourceType -> PhysicalResourceId) and
     points to the new docs/deployment.md recovery section for the exact
     bedrock-agentcore-control delete-* calls.

docs/deployment.md gains a 'Teardown & DELETE_FAILED recovery' section with
the verified delete-gateway / delete-gateway-target / delete-agent-runtime
commands. All four teardown paths (clean, absent, recover, terminal) verified
offline with a mocked aws CLI.

* ci: scope workflow permissions (Checkov CKV2_GHA_1)

Addresses PR review (ci.yml). Add top-level 'permissions: read-all' and
per-job overrides so the workflow token is least-privilege:
  - unit: contents:read (checkout only)
  - e2e:  contents:read + id-token:write (OIDC role assumption via
          aws-actions/configure-aws-credentials)

Verified with checkov 3.3.6: CKV2_GHA_1 FAILED -> PASSED, no new finding.
Token-scope audit confirms every step that uses a GITHUB_TOKEN scope still
has it granted.

---------

Co-authored-by: di-brasil <di-brasil@users.noreply.github.com>
2026-07-07 02:42:19 -04:00
satveerkhurpa 426f41ce69 Add OBO training: overview, protocol reference, and end-to-end examples (#1753)
* Add OBO training: overview, protocol reference, and end-to-end examples

* Address CodeQL + ruff findings ...

* Apply ruff format across all Python files

* Silence prints inside functions handling client_secret

CodeQL's clear-text-logging query flags any print inside a function
that receives client_secret as a parameter, even when the message body
is a static string. Removed per-app progress prints from provider-creation
functions (all four 01_create_providers.py + both 00_create_*_apps.py);
callers still print a summary count after the loop. .env writes are
unchanged — secrets must persist to file for the runtime.

* Reformat obo-training with line-length=120 (matches root pyproject.toml)

---------

Co-authored-by: Satveer Khurpa <khurpas@amazon.com>
2026-07-06 11:00:00 -05:00
Sascha Möllering 73b5488bb1 feat(04-coding-agents): add sample 05 — autonomous coding agent with durable orchestration (#1725)
* feat: add sample 05 — autonomous coding agent with durable orchestration

Event-driven headless coding backend on AgentCore Runtime with:
- Lambda Durable Function orchestrator (zero-cost suspension)
- 4 specialized runtimes (coding agent, sandbox, Swift sandbox, evaluator)
- Cedar policy enforcement at sandbox layer
- AgentCore Memory for cross-ticket learning
- Evaluator agent for read-only code review
- CDK deployment (8 stacks)

* docs: note that sandbox examples cover Python and Swift but are extendable to other frameworks

* fix: resolve ruff lint violations (E741, E401, F541) across four files

- Rename ambiguous variable l to lesson in list comprehensions
  (shared/memory.py, orchestrator/handler.py)
- Split multi-import into separate statements (sandbox/app.py)
- Remove unnecessary f-string prefix (cdk/stacks/storage_stack.py)
- Add property-based tests verifying lint compliance and behavior preservation

* fix: suppress 8 false-positive ASH security findings with inline annotations

- Add # nosec B108 to intentional /tmp usage in isolated containers/microVMs
- Add # nosec B602 to sandboxed subprocess executor (sandbox/app.py)
- Add # nosec B108 to test files (assertions and fixtures, not real /tmp usage)
- Add #checkov:skip=CKV_DOCKER_3 to Dockerfile.swift (entrypoint.sh handles su)
- Each annotation includes justification for audit trail
2026-06-29 11:15:53 -04:00
Joachim Aumann 065f087a15 feat(use-cases): add multi-ISV orchestration sample (Salesforce + SAP) (#1640)
* feat(use-cases): add multi-ISV orchestration sample — Salesforce + SAP

Add a standalone use case under 02-use-cases/multi-isv-orchestration/
demonstrating how to connect Salesforce Lightning Platform and AWS for
SAP MCP Server to a single AgentCore Gateway, enabling cross-system AI
agent workflows through one unified MCP endpoint.

Three Jupyter notebooks walk through:
- 01: Salesforce as integration target (CustomOauth2, 43 tools)
- 02: SAP MCP Server as MCP target (9 tools, read-only default)
- 03: Cross-ISV queries (Customer 360, pipeline reconciliation)

Includes gateway_mcp_client.py utility, architecture diagrams, and
documented workarounds (Content-Type, domainName, org hibernation).

Originally proposed under 01-tutorials/02-AgentCore-gateway/ in
#1487; relocated to 02-use-cases/ to fit the new repo structure
where 01-features/ is CLI-only and end-to-end samples live under
02-use-cases/.

* security(multi-isv): scope Gateway IAM role and harden notebook inputs

Address threat-model review feedback on the multi-ISV orchestration sample:

- Scope the Gateway execution-role policy: split the single Resource:"*"
  statement into four scoped statements (bedrock:InvokeModel limited to the
  Claude model/inference-profile ARNs, secretsmanager:GetSecretValue limited
  to the bedrock-agentcore-* secret prefix, iam:PassRole limited to the role
  itself with a PassedToService condition); remove the unused s3:GetObject.
- Stop printing the Cognito client secret in the NB01 summary; show the
  describe-user-pool-client retrieval command instead.
- Validate SF_DOMAIN against a strict [A-Za-z0-9-]+ pattern to prevent
  redirecting tool calls to an attacker-controlled host.
- Update the README Disclaimer to reflect the scoped IAM policy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(multi-isv): add sample to workflow-automation category README

List multi-isv-orchestration in the 02-workflow-automation-agents
samples table after relocating the folder into that category.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:50:01 -04:00
Akarsha Sehwag dea7328db0 feat(memory): add multi-region-replication example (#1747)
* feat(memory): add multi-region-replication example

* feat(memory): update func

* chore: ruff formatting
2026-06-26 10:16:44 -04:00
gel-work fb14ec6b3c Add skip-extraction sample and rename 08-redrive to 08-manage-extraction (#1746)
Adds a runnable sample demonstrating extractionMode=SKIP on CreateEvent,
which stores events in short-term memory without triggering long-term
extraction. Renames the folder to 08-manage-extraction to cover both
skip and redrive as extraction lifecycle controls.

Co-authored-by: Gal Goldman <galgold@amazon.com>
2026-06-25 16:16:26 -04:00
philgut-aws e74dccaacd Update finance budget assistant for Claude Haiku 4.5 (#1742)
- Update BUDGET_SYSTEM_PROMPT in lab1: the previous prompt broke the
  structured output instructions with Claude Haiku 4.5
- Remove outdated note about enabling model access for Claude 3.7 Sonnet
- Update references from Anthropic Claude 3.7 Sonnet to Claude Haiku 4.5
  in lab1 and README
2026-06-24 14:50:27 -07:00
Naga Gaddamu 16df45472a Amazon Bedrock AgentCore Gateway websearch samples and usecases (#1721)
* Add AgentCore Web Search Tool samples and workshop content

- 01-features: new 03-web-search folder with setup, raw MCP, Strands,
  and LangChain samples; updated requirements.txt with pinned versions
- 06-workshops: new 03-Agent-Core-web-search workshop with 6 notebooks
  covering gateway setup, Strands agent, LangChain agent, CVE scanner,
  earnings brief, and iterative research pattern
- 06-workshops/05-AgentCore-tools/README.md: added Web Search Tool section

* feat: add deep-research-agent with auto-provisioning and search privacy notices

- Add deep-research-agent use case with iterative Plan/Search/Reflect/Synthesize loop
- Add gateway_setup.py with auto-detect/prompt/provision flow (no hard prerequisites)
- Add search privacy callout to all 03-web-search README files
- Fix model ID default to use cross-region inference profile
- Add user-friendly error handling for auth failures
2026-06-23 10:53:17 -07:00
Bharathi Srinivasan a444af49f4 Agentcore optimization nys (#1722)
* Add failure insights sample (insights.py) and update README

- Add insights.py: runs FailureAnalysis, UserIntent, and ExecutionSummary
  batch insight jobs on the HR Assistant agent. Supports --generate-traces
  to send curated failure-mode sessions, --online to create a recurring
  daily OnlineEvaluationConfig, and --insight to select individual insight
  types. Uses both aws/spans and the runtime log group as data sources.

- Update README with a full Failure Insights section covering all three
  insight types, data source requirements, CLI examples, and how to chain
  insights into a system prompt recommendation.

* sample for agentcore insights feature with SDK scripts and CLI examples

* agent loops image

* move CLI insights step to after deploy and baseline eval in optimization workflow

* remove step 0 from CLI examples

* add insights.py description in How It Works section

* adding docs links to readme

* rename failure insights to insights throughout

* fix pylint and ruff issues in insights.py

- Add encoding="utf-8" to file read/write calls
- Wrap long lines to stay within 100-char limit
- Add pylint disable comments for intentional broad-exception-caught
- Rename loop variable to avoid module-scope naming false positive
- Remove f-string prefix from string literals without placeholders (ruff fix)

* remove generated state and config files

* remove TEST_LOG.md from registry

* scope aws-targets gitignore to exclude gateway config files

* clearing outputs from NBs

* fix ruff/pylint line-length conflict in optimize folder

* update repository structure in readme

* updating main readme

* replace account numbers and resource IDs with placeholders in optimization notebook
2026-06-22 14:08:16 -04:00
JobRamos e720768134 Add Weather Agent use case with harness, gateway, guardrails, evaluation and observability (#1648)
* Add Weather Agent use case with harness, gateway, guardrails, evaluations, and observability

* fix: resolve lint errors and security finding (unused imports, f-strings, bind to localhost)

* fix: address PR feedback (README clarifications, region detection, graceful eval error, trace
  display)

* feat: add Skills (xlsx report generation) and Optimization (system prompt recommendations)

* feat: add Skills (xlsx report generation) and Optimization (system prompt recommendations)

* fix: address PR feedback (README clarifications, region detection, graceful eval error, trace
  display)
2026-06-22 12:27:28 -04:00
吴杨帆 4002ce6bef docs: fix evaluations next step link (#1679) 2026-06-22 11:38:04 -04:00
Ed Fraga bb763db66c Harness GA Samples — AWS Skills, S3 Filesystem, Step Functions, Builder Agent (#1688)
* Add Harness GA samples: AWS Skills, S3 filesystem, Step Functions, builder agent

Four new samples under 01-features/01-harness for the Harness GA launch:

- 01-advanced-examples/08-aws-skills: enable native AWS Skills from the AWS
  Agent Toolkit via the awsSkills source (all / glob / specific / mixed modes)
- 01-advanced-examples/09-s3-filesystem: mount an S3 Files access point as the
  agent filesystem; includes s3_knowledge_base.py — a persistent LLM-wiki
  knowledge base (ingest / query / lint) on the S3 mount
- 01-advanced-examples/10-stepfunctions-orchestration: a Step Functions STANDARD
  state machine that drives the harness lifecycle (create -> poll READY ->
  invoke -> delete) via a Lambda task worker
- 02-use-cases/03-aws-builder-agent: harness + AWS Skills compose an AWS
  engineering agent that designs and scaffolds a serverless app

All samples use the GA boto3 SDK shapes (create_harness/invoke_harness) with no
internal endpoints or configuration. Updated the harness README index.

* Rename s3_knowledge_base.py to s3_llm_wiki.py to avoid Bedrock Knowledge Bases confusion

The LLM-wiki sample is a self-maintained markdown wiki on the agent's
filesystem, unrelated to the Amazon Bedrock Knowledge Bases feature. Rename the
file and scrub 'knowledge base' wording (mount default /mnt/wiki, pages/ subdir)
across the script and READMEs to prevent customer confusion.

* Fix S3 filesystem + Step Functions samples after end-to-end testing

Verified the samples against the live GA API and fixed real bugs found:

S3 filesystem (s3_filesystem.py, s3_llm_wiki.py):
- S3 Files mounts REQUIRE VPC network mode — add networkConfiguration
  (networkMode=VPC + subnets + security groups) to create_harness; add
  required --subnet-ids/--security-group-ids CLI args.
- Execution role needs s3files permissions (ListMountTargets/Get*/ClientMount/
  ClientWrite/ClientRootAccess), not plain s3:* — correct the attached policy.
- README: document VPC + mount-target prerequisites and the new args.

Step Functions (stepfunctions_orchestration.py):
- Lambda role also needs *AgentRuntime* actions (CreateHarness provisions an
  underlying AgentRuntime) — without them CreateHarness returns AccessDenied.
- CheckStatus Choice now matches CREATE_FAILED/UPDATE_FAILED so a failed
  creation fails fast instead of looping on the WaitForReady default forever.

* Rework Step Functions sample to native integration; fix S3 Files IAM/VPC guidance

Step Functions: replace the Lambda task-worker approach with the native
arn:aws:states:::bedrockagentcore:invokeHarness service integration — a single
Task state, no Lambda, no glue. The state machine's own role gets
bedrock-agentcore:InvokeHarness; output is Converse-shaped
(Output.Message.Content[].Text). Rewrote the README accordingly.

S3 filesystem: scope the execution-role IAM to what the runtime actually needs —
s3files:GetAccessPoint (unscoped, validated at harness create time) plus
s3files:ClientMount/ClientWrite (conditioned on the access point). Document that
S3 Files mounts require VPC network mode with private subnets that have egress
(route to a NAT gateway); public subnets do not connect. Same IAM fix applied to
the s3_llm_wiki.py sample.

* Remove Step Functions sample; renumber to avoid collision with merged samples

Upstream main now occupies advanced-examples 01-12 (incl. 06-async-step-function,
08-gemini-model-provider, 09-openai-model-provider). Renumber our two samples to
free slots and drop the Step Functions sample (upstream added its own):

- delete 10-stepfunctions-orchestration
- 08-aws-skills  -> 13-aws-skills
- 09-s3-filesystem -> 14-s3-filesystem

Updated all cross-references (harness index README, builder-agent note).
2026-06-19 12:11:41 -04:00
Will Matos 97e89df7b6 feat(it-incident-response-agent): production-ready IT incident response agent with streaming and observability (#1724)
* feat(usecases): it-incident-response

* add jira integration

* fix minor memory usage points

* docs: add IT incident response agent project docs and assets

* config: add AgentCore project configuration and schema context

* infra: add CDK project for AgentCore L3 construct deployment

* feat: add Strands agent application (runtime, memory, MCP client, model)

* feat: add Lambda functions for tools, infra providers, and ticket trigger

* feat: add tool schemas, seed data, and knowledge base runbooks

* chore: add deployment, evaluation, and ticket utility scripts

* docs: comply with use-case README template (add details table and disclaimer)

* chore: allow esbuild install script in CDK project

* fix: create S3 Vectors bucket+index for KB (CFN does not auto-create)

The Bedrock KnowledgeBase CloudFormation resource with type S3_VECTORS
requires a pre-existing vector bucket and index. Passing an empty
s3VectorsConfiguration fails schema validation. The console's 'quick
create' auto-provisions these, but CloudFormation does not.

Changes:
- Import aws-cdk-lib/aws-s3vectors
- Create CfnVectorBucket (named per account+region)
- Create CfnIndex (float32, 1024 dims, cosine, no metadata keys)
- Wire IndexArn, IndexName, VectorBucketArn into KB storageConfiguration
- Grant KB role s3vectors:* actions on the vector index
- Add removalPolicy to bucket+index
- Add troubleshooting row to README
- Deleted the ROLLBACK_COMPLETE stack to unblock next deploy

* fix: resolve deploy issues (template envsubst, target name, IndexName removal)

- aws-targets.json.template: fix envsubst-incompatible default syntax
  (${AWS_REGION:-us-west-2} → ${AWS_REGION}), change name 'dev' → 'default'
- scripts/deploy.sh: export AWS_REGION with default before envsubst runs
- infra-construct.ts: remove IndexName from s3VectorsConfiguration (caused
  CFN 'oneOf 2 subschemas matched' validation error — only IndexArn +
  VectorBucketArn are needed for BYO S3 Vectors)
- deployed-state.json: updated by successful deploy

* docs: update Quickstart to lead with deploy.sh as primary path

* chore: stop tracking deployed-state.json (deployment-specific, not shared)

* refactor(auth): rename OAUTH_PROVIDER_NAME to GATEWAY_OAUTH_PROVIDER_NAME

Scope auth env vars per boundary for clarity:
- OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

Code maintains backward-compat fallback to legacy names.
CDK injects new names into Runtime env vars at deploy.
.env.example and agentcore/.env.local.example updated
with boundary labels (Boundary 2, Boundary 3).

* docs(auth): add authentication boundary guide

New docs/authentication-guide.md explains the 3 auth boundaries:
1. Runtime Inbound (SigV4 vs CUSTOM_JWT)
2. Gateway Outbound (AWS_IAM vs CUSTOM_JWT M2M)
3. Jira Outbound (USER_FEDERATION 3LO)

Covers: conceptual overview, env var reference, local dev
implications, troubleshooting, and why all 3 patterns exist.

* docs: fix local dev ports, CLI commands, and env var references

README.md:
- Add Port Mapping section (8081=Web UI, 8082=Runtime container)
- Add troubleshooting entry for workload access token error
- Fix agentcore invoke --dev (invalid) -> agentcore dev prompt
- Update config table to use GATEWAY_OAUTH_* var names

docs/custom-jwt-auth-upgrade.md:
- Update all OAUTH_PROVIDER_NAME -> GATEWAY_OAUTH_PROVIDER_NAME
- Update all GATEWAY_AUDIENCE -> GATEWAY_OAUTH_AUDIENCE

docs/ARCHITECTURE.md:
- Wrap ASCII diagrams in <details> tags for readability

* Fix S3 Vectors Knowledge Base schema: remove indexName from s3VectorsConfiguration

CloudFormation's AWS::Bedrock::KnowledgeBase type with S3_VECTORS storage
has a schema constraint (oneOf) that rejects when both indexArn and indexName
are provided. Pass only vectorBucketArn + indexArn to satisfy the schema.

The indexName is implicit in the indexArn and Bedrock manages metadata
internally during ingestion, so it's not needed in the configuration.

Fixes: Properties validation failed - 'only 1 subschema matches out of 2'
Verified: Stack now deploys successfully with CREATE_COMPLETE status

* feat: migrate online eval to declarative agentcore.json

Remove the custom resource workaround for Online Evaluation. The
AgentCoreOnlineEvaluationConfig L3 construct (@aws/agentcore-cdk
v0.1.0-alpha.34+) now handles dependency ordering automatically.

Changes:
- Delete lambdas/infra/online_eval_provider.py (custom resource Lambda)
- Remove SKIP_ONLINE_EVAL logic from cdk-stack.ts and bin/cdk.ts
- Online eval is now purely declarative via agentcore.json onlineEvalConfigs[]
- To disable: set onlineEvalConfigs to [] in agentcore.json

Standards-Consulted: std.cdk.prefer-declarative
Standards-Gaps: none
Standards-Proposed: none

* fix: align model IDs with available Bedrock models

Update all model ID references to use the exact identifiers from
`aws bedrock list-foundation-models`:
- AGENT_MODEL_ID: us.anthropic.claude-sonnet-4-6 (not -20250929-v1:0)
- FAST_MODEL_ID: us.anthropic.claude-3-5-haiku-20241022-v1:0
- JUDGE_MODEL_ID: us.anthropic.claude-sonnet-4-6

The previous IDs (with -20250929-v1:0 suffix) were invalid and caused
runtime ValidationException on agent invocation.

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format
Standards-Gaps: none
Standards-Proposed: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy

* fix: add --target dev to all agentcore CLI commands

This project uses a named target 'dev' in aws-targets.json (not the
default target). All CLI invocations must explicitly pass --target dev.

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: std.deploy.target-dev

* docs: overhaul documentation to describe current state only

- Remove SKIP_ONLINE_EVAL references throughout
- Fix model IDs in all documentation
- Remove .kiro references from public docs
- Merge duplicate Online Eval sections in README
- Fix GUARDRAIL_ID default (auto-creates, not skips)
- Fix target name in troubleshooting (dev, not default)
- Add --target dev to all documented deploy commands
- Add Declarative vs Imperative section to ARCHITECTURE.md
- Remove stale development process docs (8 root-level .md files)
- Pad all README tables for aligned vertical bars

Standards-Consulted: std.docs.current-state-only, std.deploy.target-dev, std.config.model-id-consistency
Standards-Gaps: none
Standards-Proposed: std.docs.current-state-only

* chore: update agentcore config and CDK dependencies

- agentcore.json: add onlineEvalConfigs, policyEngines, gateway config
- aws-targets.json.template: minor format fix
- CDK packages: update @aws/agentcore-cdk dependency range

Standards-Consulted: std.cdk.prefer-declarative, std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: improve agent resilience and MCP client handling

- main.py: add graceful degradation when MCP tools unavailable,
  safe fallback to LLM-only mode on tool initialization failure
- mcp_client/client.py: add get_all_mcp_clients_safe() with error
  collection instead of hard failure
- trigger: minor fix
- show_ticket.sh: minor fix

Standards-Consulted: std.agentcore.mcp-sigv4-auth
Standards-Gaps: none
Standards-Proposed: none

* feat: add end-to-end test script

scripts/test-e2e.sh publishes a ticket to SNS, polls DynamoDB for
resolution (10s intervals, 120s timeout), and asserts status=Resolved
with a non-empty resolution_comment. Exits 0 on pass, 1 on fail.

Usage:
  ./scripts/test-e2e.sh                     # sample ticket
  ./scripts/test-e2e.sh /path/to/ticket.json  # custom ticket

Standards-Consulted: std.deploy.target-dev
Standards-Gaps: none
Standards-Proposed: none

* feat: upgrade FAST_MODEL_ID to Claude Haiku 4.5

Replace claude-3-5-haiku-20241022-v1:0 (legacy, access-gated) with
claude-haiku-4-5-20251001-v1:0 (current, available in account).

Verified: model invocable, E2E test passes all 3 tiers (LOW/HIGH/CRITICAL).

Standards-Consulted: std.config.model-id-consistency, std.bedrock.verify-model-id-format, std.bedrock.validate-model-before-deploy
Standards-Gaps: none
Standards-Proposed: none

* fix: add .gitignore with lib/ un-ignore for CDK source files

The root .gitignore excludes lib/ globally (for compiled JS output in
other samples). This project's CDK TypeScript source lives in
agentcore/cdk/lib/ and must be tracked. Add project-level .gitignore
with negation rules so 'git add' works without -f flag.

Standards-Consulted: std.git.no-deployed-state
Standards-Gaps: none
Standards-Proposed: none

* docs: remove sample-level LICENSE, inherit from monorepo root

Remove the local MIT-0 LICENSE file from it-incident-response-agent.
The sample should inherit the root repo's Apache 2.0 license, consistent
with all other samples in 02-use-cases/.

* feat: migrate observability to declarative agentcore.json, add Cedar policy steering

- Move OTEL/X-Ray env vars to agentcore.json runtimes[].envVars[]
- Add instrumentation.enableOtel: true
- Add onlineEvalConfigs[] (4 built-in evaluators, 100% sampling)
- Add policyEngines[] with Cedar policies (resource is AgentCore::Gateway)
- Add policyEngineConfiguration to gateway (LOG_ONLY mode)
- Remove ~150 lines of imperative CDK (custom resource, env var overrides)
- L3 construct now handles gateway lambda:InvokeFunction automatically
- Rename target from 'default' to 'dev'
- Fix trigger Lambda runtimeSessionId length (min 33 chars)
- Add Cedar policy syntax steering file
- Update README with CLI commands for online-eval + policy-engine

* chore: remove .kiro/ from git tracking, add to .gitignore

* fix: update evaluate.py

* refactor: simplify evaluate.py to retrieve online eval results

Replace complex on-demand evaluation with a script that queries the
online evaluation results log group. The continuous online evaluation
(agentcore.json onlineEvalConfigs[]) scores all invocations automatically.

Standards-Consulted: std.docs.current-state-only
Standards-Gaps: none
Standards-Proposed: none

* chore: clean up developer-only artifacts and reduce consumer confusion

- Remove AGENTS.md from tracking (Kiro AI context, not for consumers)
- Reorganize .gitignore with categories, add developer-only file exclusions
- Rename docs/online-eval-workaround.md → online-evaluation.md
- Trim ARCHITECTURE.md auth deep-dive (link to authentication-guide.md)
- Simplify README: collapse manual path, clarify CLI-first section,
  remove duplicate env-var table, consolidate Configure section

* feat: add OTEL span attributes, tool-call hooks, e2e test, and eval reporter

- Add ticket.id/priority/requester_id/mode as OTEL span attributes for
  end-to-end trace correlation via CloudWatch Transaction Search
- Add Strands BeforeToolCallEvent/AfterToolCallEvent hooks for per-tool
  call timing in runtime logs
- Add scripts/e2e_test.py with live status polling, log tailing, and
  post-resolution tool call timeline
- Rewrite scripts/evaluate.py to parse online eval results with summary
  (avg scores by evaluator) and detailed per-trace breakdown

* remove: deprecate 02-use-cases/it-incident-response-agent (v1)

The v1 sample at 02-use-cases/it-incident-response-agent/ is superseded by
02-use-cases/automation-agents/it-incident-response-agent/, which is an
evolved version of the same use case with significant improvements:

- CLI-first workflow (agentcore.json + agentcore deploy) vs raw CDK
- Zero external prerequisites to deploy (Auth0/Jira optional, not required)
- All 6 AgentCore services demonstrated (adds Policy Engine, Guardrails)
- Production patterns: DLQ, idempotency, cost routing, graceful degradation
- Local dev support (agentcore dev with hot-reload)
- L3 CDK constructs instead of L1 CfnResource boilerplate
- Comprehensive documentation and design-decisions ADRs

The v1 code used raw L1 CfnResource constructs with mandatory Auth0 +
Jira dependencies, making it inaccessible for quick-start consumers.
All v1 functionality (Jira integration, Auth0 CUSTOM_JWT, Atlassian 3LO,
online evaluation) is preserved in the automation-agents version as
optional toggles.

* style: fix lint and format issues for CI compliance

Python (ruff):
- Remove unused imports: get_all_mcp_clients, get_streamable_http_mcp_client
  (main.py), os (jira_oauth_provider.py), time (seeder.py)
- Auto-format 8 files to pass ruff format check

TypeScript (Prettier):
- Auto-format cdk-stack.ts, infra-construct.ts, bin/cdk.ts

All CI checks now pass:
- ruff check: 0 errors
- ruff format --check: 21 files formatted
- prettier --check: all files pass
- tsc --noEmit: compiles clean
- agentcore validate: Valid

* chore: gitignore eval doc build artifacts

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Will Matos <wilmatos@amazon.com>

* fix: resolve ruff lint errors in e2e_test.py

- F541: Remove extraneous f-prefix on string without placeholders (line 157)
- F841: Remove unused variable base_ts (line 270)

Standards-Consulted: std.python.ruff-lint-clean
Standards-Gaps: none
Standards-Proposed: none

* fix: additional e2e_test.py improvements

* fix: e2e_test.py refinements

* fix: code review improvements - error handling, threading, cleanup

- Wrap _resolve_ticket DDB call in try/except (non-fatal failure)
- Add DEBUG log for silent OTEL ImportError
- Remove unused imports in mcp_client/jira.py
- Add docstrings to memory/session.py
- Move import threading to top-level in e2e_test.py
- Replace mutable list stop flag with threading.Event

Verified: all Python files parse cleanly, tsc --noEmit passes,
agentcore validate passes, CDK tests pass, 50-ticket E2E test 100% pass.

* feat: enable Transaction Search observability and tighten IAM scoping

- Add OTEL/GenAI observability env vars (AGENT_OBSERVABILITY_ENABLED,
  message-content capture, application signals) to agentcore.json
- Add Transaction Search custom resource Lambda to route X-Ray segments
  to CloudWatch Logs (aws/spans) for online eval ingestion
- Scope trigger Lambda to bedrock-agentcore:InvokeAgentRuntime on the
  specific runtime ARN (least privilege)
- Add resource-based lambda:InvokeFunction permissions for Gateway targets
- Make _fail_ticket DDB write non-fatal with exception logging
- Misc lint/cleanup in lambdas and e2e_test.py

* docs: reflect auto-enabled Transaction Search via custom resource

Transaction Search is now provisioned automatically by the CDK stack
(transaction_search.py custom resource) when onlineEvalConfigs is set,
so manual 'aws application-signals start-monitoring' is no longer required.
Update README, online-evaluation.md, and ARCHITECTURE.md accordingly.

* refactor: remove redundant L3-provided config, restore Memory resource

- Remove redundant XRayTracing IAM statement from RuntimeAdditionalPolicy (L3 RuntimeExecutionRole already grants xray put-trace perms); keep CloudWatch Logs Insights

- Remove instrumentation.enableOtel from agentcore.json (OTEL wrapping provided by Dockerfile CMD opentelemetry-instrument for Container build)

- Move AGENT_MODEL_ID/FAST_MODEL_ID into agentcore.json runtimes[].envVars[] (declarative, was imperative addPropertyOverride)

- Restore Memory resource (ITIncidentAgentMemory, SUMMARIZATION, namespace incidents/{actorId}) so memory code is backed by a provisioned resource instead of a no-op

- Enable ACTIVE X-Ray tracing on trigger Lambda for full service-map coverage

- Update README/ARCHITECTURE/online-evaluation docs; add 'agentcore add memory' CLI instructions

* docs: fix stale references in auth and schema docs

- authentication-guide: JIRA_MCP_URL is a hardcoded constant set by CDK, not auto-derived from JIRA_SITE_URL

- custom-jwt-auth-upgrade: correct stale function name _get_oauth_token() -> _create_custom_jwt_client()

- .llm-context/README: remove reference to non-existent mcp.ts schema file

* fix: deploy blockers for Memory namespace and gateway target IAM ordering

- Memory SUMMARIZATION namespace requires {sessionId}: incidents/{actorId} -> incidents/{actorId}/{sessionId} (CreateMemory validation failed without it). Retrieval still works via the incidents/{actorId} prefix (prefix matching).

- GatewayTargets now explicitly depend on the gateway role DefaultPolicy. The AgentCoreMcp L3 creates the lambda:InvokeFunction policy but does not order targets after it, causing deterministic 'Gateway execution role lacks permission' CREATE_FAILED. Replaces the ineffective resource-based fn.addPermission approach.

- README: Getting Started section (CI doc gate), Memory namespace + sessionId note

- ARCHITECTURE: corrected Memory namespace note

* style: lint fixes (ruff/pylint) with no behavior change

- main.py: remove unused imports GATEWAY_URL, MEMORY_ID (ruff F401); they are imported where actually used in mcp_client/memory modules

- mcp_client/client.py: remove unnecessary else-after-return (pylint R1705)

- mcp_client/client.py, jira.py: scoped 'pylint: disable=missing-kwoa' with justification on @requires_access_token-decorated calls (decorator injects access_token; pylint cannot see the transform)

* style: black formatting in lambda handlers (no behavior change)

- transaction_search.py: collapse wrapped log line

- ticket_event_handler.py: expand ALLOWED_FIELDS set to multi-line, collapse RuntimeError

* fix: auto-trigger KB ingestion on deploy by passing DataSourceId to seeder

The seeder gates ingestion on 'kb_id and data_source_id', but the CDK only passed KnowledgeBaseId — DataSourceId was never wired through, so start_ingestion_job never ran and the auto-created KB stayed empty until manual ingestion.

Capture the data source id on InfraConstruct (knowledgeBaseDataSourceId) and pass DataSourceId to the TriggerSeeder custom resource. README updated: ingestion is now automatic; manual command kept as optional re-index.

* fix: validate ticket_id/issue_key in agent entrypoint to avoid uncaught KeyError

payload['ticket_id'] was read outside the main try block, so a malformed/direct invoke missing ticket_id (and issue_key) raised an uncaught KeyError that crashed the invoke generator with no structured response. Use payload.get() with an explicit guard that yields a structured Failed result and returns; tighten is_jira_mode to bool(JIRA_MCP_URL).

* fix: agent entrypoint robustness

Guard model output extraction; empty output raises ValueError so the ticket is marked Failed (requires human processing) rather than resolved with a fallback. Sanitize both title and description through the guardrail. Remove dual logger alias. Avoid unbound agent reference when both initializations fail in prompt mode.

Findings #3, #6, #7, #8

* fix: memory cross-session retrieval

Use namespace_path (prefix match) instead of namespace (exact match) so prior-session memories are retrieved during enrichment.

Finding #4

* fix: atomic change-request write + reason field

Use transact_write_items for the dual DynamoDB write so the change request and audit records commit atomically. Add the reason parameter to the tool schema and wire it through, making the RequireReasonForChangeRequest Cedar policy functional.

Findings #5, #12

* fix: DynamoDB Decimal serialization in tools

Convert DynamoDB Decimal values to native int/float before json.dumps so tool responses serialize correctly.

Finding #15

* fix: trigger region + KB ingestion re-run + QueryKb env

Pass region_name to boto3 clients in the ticket event trigger. Add commonEnv to QueryKbFn. Bump the seeder Version to 3 so the KB data source ingestion re-runs.

Findings #9, #10, #14

* fix: e2e span duration unit

Correct the span duration unit conversion in the e2e test.

Finding #11

* style: pylint cleanups in e2e_test and evaluate scripts

- Drop unused loop variable, specify UTF-8 encoding on open()
- Simplify elif-after-return in _score_bar
- Add main() docstrings and wrap long lines

* style: wrap long lines in agent and lambda modules (C0301)

* style: apply ruff format (line-length 120)

* chore: rename folder

* feat(docs): update docs

* chore(usecases) - restructure under workflow

* feat(it-incident-agent): stream real-time pipeline stages + evaluations UI + demo

- Agent (main.py): emit real SSE stage events at each pipeline phase
  (guardrail, memory, tools, diagnose, per-tool-call, persist, emit)
  using agent.stream_async() instead of blocking agent() call
- Docs: add Real-Time Progress Streaming section to ARCHITECTURE.md
- README: add demo GIF showcasing the full workflow
- lambdas/tools: minor cleanup in create_change_request.py
- .pylintrc: project lint config

* style: add blank line before _stage_event function

* chore: update .gitignore for AgentCore CLI and CDK artifacts

* feat: add AgentCore CDK infrastructure (DynamoDB, Lambda, Cognito, EventBridge)

* feat: implement dual-agent claims processor with memory and MCP Gateway

* feat: update Lambda tool handlers with input validation and routing

* feat: add one-command deploy/destroy scripts and .env.example

* feat: add E2E test suite, Cedar tests, lint script, and unit tests

* docs: add architecture, deployment guide, ADRs, and update README

* refactor: remove legacy infra/ directory (replaced by agentcore/cdk/)

* chore: add gitignore negations for claims-agent CDK lib and Dockerfile

* fix: switch test_invoke.py to SigV4 auth (Runtime uses AWS_IAM, not JWT)

* docs: regenerate architecture diagrams and fix Runtime auth description

* style: fix import sorting and trailing whitespace (ruff auto-fix)

* chore: add wilmatos to CONTRIBUTORS.md

* style(event-driven-claims-agent): apply ruff format

* chore(event-driven-claims-agent): improve lint.sh with verbose output, format check, and tsc

* fix(claims-agent): use SigV4 for Runtime invocation, not JWT

The Runtime uses IAM (SigV4) auth; CUSTOM_JWT is only for the Gateway.
- Trigger Lambda: replace Cognito JWT flow with SigV4 signing
- test_e2e.py: switch from Bearer token to SigV4, relax assertions
  to match actual agent streaming output format
- Dockerfile: add non-root user and healthcheck (CKV_DOCKER_2/3)
- test_local.py: add URL scheme validation, suppress S310 lint

---------

Signed-off-by: Will Matos <wilmatos@amazon.com>
Signed-off-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akshseh@amazon.de>
Co-authored-by: Akarsha Sehwag <akarsha15010@iiitd.ac.in>
Co-authored-by: Will Matos <wmatosjr@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-06-18 22:44:35 -04:00