feat: save templateId to agent state metadata #292
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Save templateId to agent state metadata
Summary
This PR implements the requested change to save
templateIdto the agent state metadata when received from the client in the initial prompt, and then continue using it from state metadata only.Changes Made
template_id: str | Nonefield toStateMetadataTypedDict inagent_session.pytemplate_idfromrequest.template_idwhen creating new agent sessiontemplate_idwhen loading existing state fromrequest.agent_state(handled automatically by existing code)Implementation Details
The implementation follows the existing pattern in the codebase where metadata fields are defined in the
StateMetadataTypedDict and initialized when creating a new agent session. Thetemplate_idwill be automatically preserved when loading existing state because the existing code already handles loading the full metadata dictionary.This is a minimal change that only adds the storage capability without modifying any existing logic that uses template_id, as requested.
Testing
Link to Devin run: https://app.devin.ai/sessions/da452696c2494389ba3bf66a14b8d894
Requested by: [email protected]