Skip to content

Extend instructions after agent construction (but not using a dynamic instruction) #3290

@baek54321

Description

@baek54321

Question

I have an application with multiple layers and functions. I create an agent with some instructions in one place and pass the agent through two layers of function until he is then actually called/used (e.g., run/run_sync is called).

Is there a way to extend the initial instruction when the agent has been created and not use the dynamic instruction (decorator) to do it? My issue with the decorator is that it gets re-evaluated multiple times when I ran several queries with the agent and that is creating a mess in the overall message history. I want the additional instruction being treated like the initial instructions added to the agent creation, except that I don't have the information at that time but a bit later.

I have also considered switching to system prompts as dynamic system prompts seem not to be re-evaluated but I am not sure this is the right way. Generally, instructions seem the right thing to use for my situation, I just don't have all the information at the time of agent creation (but before runtime via run/run_sync.

Thanks in advance for any suggestion!

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions