Skip to content

[Agent] Add a merge option for system prompt #2151

Description

@YummYume

Hi,

When declaring an agent using the prompt option, it will be completely skipped if a system message already exists (https://github.com/symfony/ai/blob/main/src/agent/src/InputProcessor/SystemPromptInputProcessor.php#L50). I think this should be mentioned in the documentation. Furthermore, a merge option could be added to merge the two system prompts together instead of keeping only one.

My use case is the following : I have system prompt instructions coming from a (trusted) remote source, which is being added dynamically. I don't think I can use an input processor for this, as the prompt depends on dynamic factors. I still want to use the static prompt declared in my ai.agent configuration, though, as the two should be merged.

What do you think? I'd be glad to open a PR for it when I have the time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AgentIssues & PRs about the AI Agent componentRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions