Description
Passing session via workflow.run(..., session=...) causes a runtime collision in AgentExecutor.
AgentExecutor always calls:
agent.run(..., session=self._session, options=options, **run_kwargs)
If workflow kwargs include session, Python receives two values for the session argument and raises TypeError.
Expected behavior:
- either reserve/filter
session from workflow kwargs, or
- validate early and raise a clear workflow-level error.
Steps To Reproduce
import asyncio
from agent_framework import WorkflowBuilder, AgentExecutor, AgentResponse, AgentSession, Message, Content
class SimpleAgent:
id = "simple-agent"
name = "Simple Agent"
async def run(self, messages=None, *, stream=False, session: AgentSession | None = None, options=None, **kwargs):
return AgentResponse(messages=[Message(role="assistant", contents=[Content.from_text("ok")])])
def create_session(self, **kwargs):
return AgentSession()
async def main():
wf = WorkflowBuilder(start_executor=AgentExecutor(SimpleAgent(), id="a")).build()
await wf.run("hello", session="user-passed")
asyncio.run(main())
Error Messages / Stack Traces
TypeError: <Agent>.run() got multiple values for keyword argument 'session'
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/_agent_executor.py (_prepare_agent_run_args, _run_agent, _run_agent_streaming)
Potentially similar collisions can happen for other reserved run params if passed through workflow kwargs.
Description
Passing
sessionviaworkflow.run(..., session=...)causes a runtime collision inAgentExecutor.AgentExecutoralways calls:If workflow kwargs include
session, Python receives two values for thesessionargument and raisesTypeError.Expected behavior:
sessionfrom workflow kwargs, orSteps To Reproduce
Error Messages / Stack Traces
Package Versions
1.0.0rc21.0.0b26022502ba27493(main)Python Version
Python 3.13.5Additional Context
Likely area:
packages/core/agent_framework/_workflows/_agent_executor.py(_prepare_agent_run_args,_run_agent,_run_agent_streaming)Potentially similar collisions can happen for other reserved run params if passed through workflow kwargs.