-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Per documentation, the global_instruction
can be used to set instructions for all agents.
The doc string looks like this:
global_instruction: Union[str, InstructionProvider] = ''
"""Instructions for all the agents in the entire agent tree.
global_instruction ONLY takes effect in root agent.
For example: use global_instruction to make all agents have a stable identity
or personality.
"""
The heading sounds very promising: Instructions for all the agents in the entire agent tree.
- i.e. if I have an overall goal I want to achieve or want to set specific instructions that all LLMs must follow, I'd imagine this is the perfect place for it. Or things like the current date and time could be something set in global instructions.
The second sentence appears a bit contradictory but I interpret this as: only the root agent's global_instruction is considered (i.e. if sub-agents also define global_instruction, then only the root agent's global_instruction is used).
The problem arises when your root agent is not an LlmAgent. If you wrap it in e.g. a LoopAgent or a SequenceAgent, the global_instruction is completely lost. This can drastically alter the behavior of an agent (and its sub-agents) if you decide to put that agent into a loop, even though you'd not expect this to have significant behavioral changes for that agent / agent group.
Here's an example: 19e3186
On its own, the agent honors its own global_instruction, and so would all its sub-agents. As soon as it is put in a LoopAgent, the global_instruction vanishes.