Prompts

Manage and optimize agent prompts

Prompts are the instructions that guide agent behavior.

Diagram

Prompt System

📝 Prompt

🤖 Agent

💬 Behavior

Quick Start

  1. Basic Prompt
    rust
    use praisonai::Agent;
    
    let agent = Agent::new()
        .name("Assistant")
        .instructions("You are a helpful assistant. Be concise and accurate.")
        .build()?;
  2. Prompt Template
    rust
    use praisonai::{Agent, Prompt};
    
    let prompt = Prompt::template(r#"
    You are a {role} assistant.
    Your expertise is in {domain}.
    Always respond in {language}.
    "#)
        .var("role", "technical")
        .var("domain", "AI")
        .var("language", "English");
    
    let agent = Agent::new()
        .instructions(prompt)
        .build()?;

Prompt Components

ComponentDescription
SystemCore behavior instructions
ContextBackground information
ExamplesFew-shot examples
ConstraintsRules and limitations

Related