File tree Expand file tree Collapse file tree
bedrock_agentcore/strands-agent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ def required_env(key: str) -> str:
4747DEPLOYMENT_NAME = os .environ .get ("TEMPORAL_DEPLOYMENT_NAME" , workflows .DEPLOYMENT_NAME )
4848BUILD_ID = os .environ .get ("TEMPORAL_BUILD_ID" , workflows .BUILD_ID )
4949
50+ # @@@SNIPSTART python-agentcore-activity-tracker
5051# How long the Worker keeps polling after it goes idle.
5152DEBOUNCE = float (os .environ .get ("AGENTCORE_DEBOUNCE_SECONDS" , "60" ))
5253# How long the drain waits for in-flight Activities (a model or tool call).
@@ -94,8 +95,10 @@ async def execute_activity(self, input: ExecuteActivityInput):
9495 finally :
9596 self ._tracker .inflight -= 1
9697 self ._tracker .changed .set ()
98+ # @@@SNIPEND
9799
98100
101+ # @@@SNIPSTART python-agentcore-runtime-handler
99102@app .entrypoint
100103@app .async_task # keeps /ping on "HealthyBusy" until this returns
101104async def invoke (payload : dict ) -> dict :
@@ -135,6 +138,7 @@ async def invoke(payload: dict) -> dict:
135138 await tracker .wait_until_idle (DEBOUNCE )
136139 log .info ("worker idle for %ss; drained" , DEBOUNCE )
137140 return {"message" : "worker drained" , "task_queue" : task_queue }
141+ # @@@SNIPEND
138142
139143
140144if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments