Skip to content

OSSS.ai.workflows.prompt_loader

OSSS.ai.workflows.prompt_loader

Prompt loading utilities for workflow execution.

This module provides functions to load prompts from agent prompts.py files and apply custom prompt configurations from workflow definitions.

load_agent_prompts(agent_type)

Load prompts from an agent's prompts.py file.

Parameters

agent_type : str The type of agent (e.g., 'refiner', 'critic', 'historian', 'synthesis')

Returns

Dict[str, str] Dictionary containing available prompts for the agent type

get_system_prompt(agent_type, custom_prompt=None)

Get the system prompt for an agent, with optional custom override.

Parameters

agent_type : str The type of agent (e.g., 'refiner', 'critic', 'historian', 'synthesis') custom_prompt : Optional[str] Custom prompt to override the default system prompt

Returns

Optional[str] The system prompt to use, or None if no prompt is available

get_template_prompt(agent_type, template_name, **kwargs)

Get and format a template prompt for an agent.

Parameters

agent_type : str The type of agent (e.g., 'refiner', 'critic', 'historian', 'synthesis') template_name : str The name of the template prompt to retrieve **kwargs Variables to substitute in the template

Returns

Optional[str] The formatted template prompt, or None if not found

apply_rich_configuration_to_prompts(agent_type, config)

Apply rich configuration options to generate customized system prompts.

Maps configuration options like refinement_level, search_depth, etc. to prompt modifications that control agent behavior.

Parameters

agent_type : str The type of agent (refiner, historian, critic, synthesis) config : Dict[str, Any] Rich configuration dictionary with agent-specific options

Returns

str Customized system prompt based on configuration

apply_prompt_configuration(agent_type, config)

Apply prompt configuration from workflow node configuration.

Supports both simple custom prompts and rich configuration options.

Parameters

agent_type : str The type of agent config : Dict[str, Any] Configuration dictionary that may contain prompt overrides

Returns

Dict[str, str] Dictionary containing the configured prompts