Skip to content

feat(extensions): label the agentcore_session context - #978

Draft
ParidelPooya wants to merge 2 commits into
mainfrom
feat/agentcore-session-e7
Draft

ParidelPooya wants to merge 2 commits into
mainfrom
feat/agentcore-session-e7

Conversation

@ParidelPooya

@ParidelPooya ParidelPooya commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What

The agentcore_session child context records the subtype AgentcoreSession. Each job's child context records the subtype AgentcoreSessionJob.

Why

Execution history and plugins filter operations by subtype. Every other agentcore_session operation has an AgentCore subtype, but the session child context and each job's child context had only the default RunInChildContext. So a consumer could not find a session or a job without parsing operation names.

Change

  • AgentcoreOperationSubType.SESSION = "AgentcoreSession" and AgentcoreOperationSubType.SESSION_JOB = "AgentcoreSessionJob". The values are the same as in the JavaScript SDK.
  • agentcore_session passes ChildConfig(sub_type=AgentcoreOperationSubType.SESSION) to its child context.
  • AgentcoreSession.invoke passes ChildConfig(sub_type=AgentcoreOperationSubType.SESSION_JOB) to each job's child context.
  • The existing agentcore() subtype values do not change. The session steps, the job callbacks and the job request steps keep their subtypes.
  • The job subtype matches the JavaScript twin feat(extensions): label the agentcoreSession child context aws-durable-execution-sdk-js#1273, which labels each job's child context AgentcoreSessionJob. So both SDKs record the same history.

This changes the recorded history of agentcore_session. The API is experimental and not released, so no execution in flight depends on the old value.

Decisions the issue did not cover

  • Per-job child context: AgentcoreSessionJob. This departs from the issue text "Jobs keep the existing subtypes", to match feat(extensions): label the agentcoreSession child context aws-durable-execution-sdk-js#1273 and the JS microvmSession pair. The job's callback and request steps keep their existing subtypes.
  • Python microvm_session records no subtypes yet, on its session or its jobs. That gap is separate and existed before this PR.
  • Edited test (rule 5.4): test_labels_every_operation_with_its_subtype in agentcore_operation_test.py compared every enum value with the agentcore() operations. The new SESSION and SESSION_JOB values are not agentcore() operations. So that check now leaves out both.

Testing

  • New test_labels_every_operation_with_its_subtype in agentcore_session_test.py runs a session with two jobs. It lists each of the 9 operations with its subtype, from the result tree and from every history event.
  • Mutation check: without the new subtype, the new test fails ('review': 'RunInChildContext' != 'AgentcoreSession'). With it restored, the test passes.
  • Mutation check: without SESSION_JOB in invoke, the new test fails ('build': 'RunInChildContext' != 'AgentcoreSessionJob', same for test). With it restored, the test passes.
  • AgentCore tests: 85 passed. Full extensions suite: 624 passed.
  • mypy src tests: no issues. hatch fmt --check: passed. lintcommit.py --range origin/main..HEAD: passed.

Closes #945
Part of #954
Twin: aws/aws-durable-execution-sdk-js#1236

The agentcore_session child context now records the subtype
AgentcoreSession, the same value as the JavaScript SDK. The steps
and the job operations keep their subtypes. A job's own child
context keeps the default subtype, as in microvm_session.

This changes the recorded history of agentcore_session. The API is
experimental and not released.

Closes #945
Each AgentcoreSession.invoke job now records the subtype
AgentcoreSessionJob on its child context. The JavaScript SDK records
the same subtype, so both SDKs write the same execution history.

@yaythomas yaythomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AgentCore session] E7: Label agentcore_session operations with a subtype

3 participants