You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarification on bypass_state_injection usage in _process_agent_instruction #3790
I’m trying to understand the rationale behind the bypass_state_injection flag in the _process_agent_instruction function:
async def _process_agent_instruction(
self, agent, invocation_context: InvocationContext
) -> str:
"""Process agent instruction with state injection."""
raw_si, bypass_state_injection = await agent.canonical_instruction(
ReadonlyContext(invocation_context)
)
si = raw_si
if not bypass_state_injection:
si = await instructions_utils.inject_session_state(
raw_si, ReadonlyContext(invocation_context)
)
return si
Currently, it seems that the necessity of bypassing state injection is determined by whether the “instruction” is a string or a callable. In my use case, I am using a third-party tool to manage instructions dynamically, which means the instruction cannot be represented as a simple string—but that doesn’t necessarily mean it shouldn’t have state injected.
Could you clarify the intended use of bypass_state_injection and whether there’s a recommended approach for handling instructions that are not strings but still require session state injection?
Activity