-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugSomething isn't workingSomething isn't workingpythonworkflowsRelated to Workflows in agent-frameworkRelated to Workflows in agent-framework
Description
Description
Workflow-level kwargs are cleared when continuing a paused workflow with run(responses=...).
What happens now:
- Initial run stores kwargs in workflow state (e.g.,
custom_data). - Workflow pauses with pending request(s).
- Continuation call
run(responses=...)executes with no kwargs. _run_workflow_with_tracingwritesrun_kwargs or {}again, overwriting prior kwargs to{}.- Subsequent agent/tool invocation loses original run context.
Expected behavior:
- Continuation via
run(responses=...)should preserve existing run kwargs unless explicitly overridden.
Steps To Reproduce
import asyncio
from agent_framework import WorkflowBuilder, AgentExecutor, AgentResponse, AgentSession, Message, Content
class ApprovalAgent:
id = "approval-agent"
name = "Approval Agent"
def __init__(self):
self.calls = []
self._asked = False
async def run(self, messages=None, *, stream=False, session=None, options=None, **kwargs):
self.calls.append(dict(kwargs))
if not self._asked:
self._asked = True
call = Content.from_function_call(call_id="c1", name="do_thing", arguments="{}")
req = Content.from_function_approval_request(id="r1", function_call=call)
return AgentResponse(messages=[Message(role="assistant", contents=[req])])
return AgentResponse(messages=[Message(role="assistant", contents=[Content.from_text("done")])])
def create_session(self, **kwargs):
return AgentSession()
async def main():
agent = ApprovalAgent()
wf = WorkflowBuilder(start_executor=AgentExecutor(agent, id="a")).build()
r1 = await wf.run("go", custom_data={"token": "abc"})
req = r1.get_request_info_events()[0]
_ = await wf.run(responses={req.request_id: req.data.to_function_approval_response(True)})
print(agent.calls) # observed: [{'custom_data': {'token': 'abc'}}, {}]
asyncio.run(main())Error Messages / Stack Traces
No exception is raised; behavior regression is visible in captured kwargs:
[{'custom_data': {'token': 'abc'}}, {}]
Package Versions
- agent-framework-core:
1.0.0rc2 - agent-framework-orchestrations:
1.0.0b260225 - Source commit tested:
02ba27493(main)
Python Version
Python 3.13.5
Additional Context
Likely area:
packages/core/agent_framework/_workflows/_workflow.py(run kwargs persistence during response-only runs)packages/core/agent_framework/_workflows/_agent_executor.py(kwargs read viaWORKFLOW_RUN_KWARGS_KEY)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpythonworkflowsRelated to Workflows in agent-frameworkRelated to Workflows in agent-framework