-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementationquestion[Component] This issue is asking a question or clarification[Component] This issue is asking a question or clarification
Description
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?
Thanks in advance!
Metadata
Metadata
Assignees
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementationquestion[Component] This issue is asking a question or clarification[Component] This issue is asking a question or clarification