Skip to Content
Recodocs

AgentCore identity

Is the AgentCore credential written only into the outbound header?

6 min read

What this set answers, and who needs it

The key distinction is between knowing a person's identity and holding a credential for a particular operation. The notebook tests the boundary that keeps credentials outside the material an assistant reads.

The set answers whether a credential from Amazon Bedrock AgentCore Identity can be fetched at dispatch and written only into the outbound Authorization header, so tool arguments, the model-visible result, receipts and object reprs carry none of it.

AgentCoreCredentialReader in recohut_kit.agentcore.identity is that reader. The README states that it is the SecretReader for HttpToolExecutor: the value is fetched at dispatch and placed only in the header. The application chooses the binding (provider name, kind, scopes), the HTTPS origin and the path prefixes. A scripted stand-in for a model supplies only a relative path. AgentCore Identity owns the vault. The kit owns the dispatch boundary, typed refusals and IdentityReceipt records.

Nothing in this set is an agent. Tool calls are fixed by the notebook. It proves credential plumbing, refusals, receipts and the live AWS lifecycle, not model behavior. A Strands agent with a Bedrock model would call the same executor unchanged; this set does not run that loop.

A backend AI engineer owns the header boundary and the tool that acts on a user's own account. A platform engineer provisions the tagged workload identity and API-key provider, then closes the lane. An identity engineer, in the third notebook, covers recorded outbound calls toward an enterprise identity provider.

On 2026-10-31 the set was consolidated from 8 notebooks to 4. Each merged notebook keeps every original cell, named by part. Original notebooks 1–2 are file 01, 3–4 are file 02, 5–7 are file 03, and notebook 8 stays 08-live-teardown.ipynb, fourth in the run order. Part text still says "notebook 3" or "notebook 8". None of the three merged notebooks was re-executed after the merge: the kit .venv used for the attempt lacks the bedrock_agentcore package, and the live notebook is a billed AWS lane. Stored outputs are from the original notebooks and are named in each part divider. Execution status, attempts and consumed units are authoritative in docs/agentcore-identity/agentcore-identity-verification.md.

How to run it

From the kit root:

uv venv --python 3.13 .venv-agentcore-identity
uv pip install --python .venv-agentcore-identity/bin/python \
  -e '.[agentcore]' -e packages/strands nbconvert ipykernel pandas ruff
.venv-agentcore-identity/bin/python -m ipykernel install --user \
  --name agentcore-identity --display-name agentcore-identity

Recorded versions for that extra are bedrock-agentcore==1.24.1 and boto3==1.43.105. No pin, pyproject.toml or project.yaml value was changed.

Execute each notebook once, in order. Timeout is 900 seconds, --allow-errors is set, and the kernel is agentcore-identity:

.venv-agentcore-identity/bin/jupyter nbconvert --to notebook --execute --inplace --allow-errors \
  --ExecutePreprocessor.timeout=900 --ExecutePreprocessor.kernel_name=agentcore-identity \
  examples/agentcore-identity/<notebook>.ipynb

Check before execution and with --executed afterwards:

.venv-agentcore-identity/bin/python scripts/check_agentcore_identity_notebooks.py \
  examples/agentcore-identity/*.ipynb --executed --aws-profile recohut

Call caps from the README order table: file 01 is scripted, then recorded with Stubber, 0 AWS calls and 0 model calls; file 02 is AWS live, Part A at most 12 AWS calls and 0 token requests, Part B at most 8 Identity requests and 4 control-plane reads; file 03 is recorded or scripted plus recorded, 0 AWS calls; file 08 is AWS live, at most 24 AWS calls and 0 token requests. Live notebooks open live.aws_session() with profile recohut and region us-east-1. Notebooks write only under .runtime/ (ignored). If original notebook 3 or 4 fails part-way, run notebook 8 anyway: deletes are idempotent.

The notebooks in order

NotebookWhat it doesRecorded output
01-credential-boundary-and-token-flows.ipynbPart A: one scripted API key on the outbound header, and a missing provider or unknown binding refused with nothing sent. Part B sends 2LO (M2M), an API key, a user-scoped workload token and an STS IAM JWT through the native IdentityClient; sigv4_auth signs with an explicit session, and Gateway outbound credential configs validate against the botocore shape.yes
02-live-provision-and-token-at-dispatch.ipynbPart A: one tagged workload identity and one tagged API-key provider with a random synthetic key, plus managed secret metadata. Part B: token and key fetched at dispatch against a local echo.yes
03-recorded-3lo-inbound-and-delegation.ipynbPart A: recorded 3LO consent refusal and retry. Part B: inbound IAM and custom JWT authorizers, a resource policy, and a Cognito M2M issuer. Part C: custom OAuth2 on-behalf-of and private-key JWT providers, refused combinations, the XAA ID-JAG gap, and a consent portal.yes
08-live-teardown.ipynbDelete the API-key provider and workload identity from notebook 3, check Get and List absence, read the managed secret's metadata only (deletion-schedule right after delete), and clear the handoff.yes

Saved output counts are 24, 20, 35 and 10. All four notebooks have recorded output.

What the recorded outputs show

File 01, Part A, prints AgentCoreCredentialReader(bindings=['orders-api-key', 'retired-api-key']) and synthetic credentials generated; values are never printed. One call is GET /v1/orders/ORD-1007, scheme Bearer, credential_present True, credential_matches True. The model-visible result is {'echo': '/v1/orders/ORD-1007', 'ok': True}. The scripted identity lists ['GetWorkloadAccessToken', 'GetResourceApiKey']. Six surfaces (tool arguments, model-visible result, identity-receipt repr and jsonl, HTTP-receipt jsonl, reader and result repr) are False for both api_key and workload_token, then No credential substring on any surface.

File 02, Part A, prints baseline tagged resources for agentcore-identity: 0. The workload identity is kit-identity-workload-eacbca, ARN redacted to …eacbca, secret_source None. The API-key provider is kit-identity-key-eacbca, secret_source='MANAGED', secret ARN ending …Ll9BdH. The control-plane readback begins with that workload identity and <arn…eacbca>.

File 03, Part A, prints recorded: user-scoped workload token, then an authorization URL (no token yet). The refusal is IdentityRefused(code='user_consent_required', retryable=True, native_code=None); its str is only user_consent_required. Next: send the user to host: idp.example.test and outbound requests: 0. A later cell prints recorded: session confirmed for the user (no browser in this notebook). The stub URL is https://idp.example.test/authorize?request_uri=urn:example:req-1, and that URL is not in the printed refusal.

File 08 prints a handoff for provider kit-identity-key-eacbca and workload kit-identity-workload-eacbca, region us-east-1, ARNs <arn…eacbca> and <arn…Ll9BdH>. Delete outcomes are {'api_key_provider': 'deleted', 'workload_identity': 'deleted'}. Both names have get_not_found True and in_list False, then Both resources absent by Get and List. The secret line is right after delete: deletion-schedule.

What is not shown or not run

The three merged files were not re-executed after the merge. Part dividers name originals that were run, including 01-boundary-scripted.ipynb, 03-live-provision.ipynb and 05-3lo-recorded.ipynb. The outputs quoted above are not the full counted set. Quoted outputs for file 01 stop as the identity-receipt section starts, so they omit Part B. For file 02 they stop inside the Part A readback, so they omit a Part B header hash, leak scan, live provider_not_found, and any HTTP status for sigv4_auth. For file 03 they stop before the retry dispatch, so they omit a user token in the header and all of Parts B and C. For file 08 they stop at deletion-schedule, so they omit the poll (at most 120 seconds), the ListSecrets check and a tagged-inventory count. The teardown text says this run did not exercise a second pass. The README says offline notebooks and notebook 4 print runtime deleted: True; that line is not among the outputs above.

File 03 does not run live 3LO. The README browser checkpoint is Not run: a live 3LO lane would need browser consent. Part B has no live authorizer attachment; live Cognito belongs to another workstream. Part C has no live lane (a real Okta or Entra tenant, a KMS key and a Gateway). Credentials are synthetic (secrets.token_urlsafe, or synthetic- plus a random value). The outbound target is an httpx.MockTransport echo at https://echo.invalid; no external service receives a key. Only the live key's SHA-256 is kept, in the untracked handoff. The cached getting-started sample covers Runtime and Memory only, and nothing from it is used. No consumed-unit total appears in the outputs above.

Where it fits in the kit

The only kit module the notebooks import is recohut_kit.agentcore.identity. They do not import HttpToolExecutor. The README is what places AgentCoreCredentialReader on that boundary.

NotebookNames imported from recohut_kit.agentcore.identity
01-credential-boundary-and-token-flows.ipynbAgentCoreCredentialReader, CredentialBinding, IdentityRefused, WorkloadTokenSource
02-live-provision-and-token-at-dispatch.ipynbcreate_api_key_provider, create_workload_identity
03-recorded-3lo-inbound-and-delegation.ipynbAgentCoreCredentialReader, CredentialBinding, IdentityRefused, WorkloadTokenSource, gateway_oauth_credential_config
08-live-teardown.ipynbdelete_api_key_provider, delete_workload_identity, identity_resource_absent

They also import identity_lab, pandas and IPython.display. File 02 imports botocore.exceptions.ClientError. File 03 imports botocore.validate.ParamValidator and bedrock_agentcore.services.identity.UserIdIdentifier. The README says wrapped calls come from installed bedrock_agentcore/identity/auth.py, bedrock_agentcore/services/identity.py and the botocore service models. Inbound-authorizer, on-behalf-of, XAA, certificate-auth and consent-portal patterns were paraphrased from awslabs/agentcore-samples commit abab3d8b, path 01-features/05-authenticate-and-authorize/.

How is this page?

Last updated on