A utility class for generating optimized system prompts based on example
inputs and desired outputs using a two-agent collaborative workflow.
This class leverages:
1. `writer` – An agent that crafts an initial prompt tailored to produce
the desired output from a given input.
2. `reader` – An agent that reviews and refines the generated prompt for
clarity, accuracy, and adherence to the intended task.
Both agents are orchestrated by an `AutoAgentManager` to enable iterative
collaboration until the prompt meets the defined termination condition.
Attributes:
writer (Agent): The prompt creation agent.
reader (Agent): The prompt review and refinement agent.
manager (AutoAgentManager): Coordinates the interaction between
`writer` and `reader` agents.
Args:
agent_factory (AgentFactory): The factory used to create new agents.
Methods:
generate(input: str, output: str) -> str:
Generates a refined prompt based on an example input and its
expected output. The process:
- Passes the input and output examples to the manager.
- Iteratively runs writer and reader agents.
- Returns the final crafted system prompt.