Skip to main content

prepend_protocol_instructions

Function prepend_protocol_instructions 

Source
pub fn prepend_protocol_instructions(
    prompt: &str,
    profile: ProtocolRequestProfile,
    schema_instruction_mode: ProtocolSchemaInstructionMode,
    workspace_root: &Path,
) -> String
Expand description

Prepends structured response protocol instructions to a prompt.

Tells agents to emit one top-level JSON object that matches Agentty’s structured protocol while selecting the cheapest safe schema guidance for the current provider. Providers without native structured output receive the full JSON Schema in the prompt; providers with native enforcement get policy and field-routing instructions only. workspace_root names the only writable directory for the turn. If the prompt already contains the protocol marker, this function returns the prompt unchanged to avoid duplicated guidance.