-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Hi,
I’m encountering a bug? while trying to set history.
I’m not sure if I’m implementing it correctly, but here’s the code.
Example:
# The idea:
# Agent A - Shared History
# |
# |
# |
# Agent B - Shared History
# |
# |
# |
# Agent C - Shared History
agentA = ...(...)
@agentA.system_prompt
def base() -> str:
return "A1"
result = agentA.run(..., message_history=[])
history = result.new_messages()
# In exe the System promt is "A1" ✅
agentB = ...(...)
@agentB.system_prompt
def base(ctx: GraphRunContext[..]) -> str:
return "B2" + ctx.deps ❌
result = agentB.run(..., message_history=history)
history = agentB.new_messages()
# In exe the System promt is "A1" --> Need to be "B2" + ctx + previous history ❌
agentC = ...(...)
@agentC.system_prompt
def base(ctx: GraphRunContext[..]) -> str:
return "C3" + ctx.deps ❌
result = agentC.run(..., message_history=history)
history = agentC.new_messages()
# In exe the System promt is "A1" --> Need to be "C3" + ctx + previous history ❌The issue is that a new message is being injected from the previous agent to continue the story, along with a new agent. However, the system prompt being used is from the first agent rather than the current one.
Could you take a look and let me know if I’m on the right track or if I’m missing something?
Or do I need to inject in the system prompt ?
Thanks in advance for your help!
Metadata
Metadata
Assignees
Labels
No labels