Best Practices

Implementing these best practices will help you create effective, maintainable multi-agent systems in Kodey.ai. These guidelines are based on real-world experience and can help you avoid common pitfalls.

Supervisor Prompt Best Practices

How to Implement Supervisor Prompt Best Practices

  1. Always start with the default supervisor prompt

    • Retain the core functionality
    • Add your customizations without removing essential instructions
    • Preserve the "Respond with the worker to act next" instruction
  2. Add your customizations while preserving the core functionality

    • Add your content after or around the default text
    • Never remove or significantly modify the default instructions
    • Ensure your additions complement rather than conflict with the defaults
  3. Create clear, distinct criteria for when each agent should be selected

    • Define specific triggers for each agent
    • Avoid overlapping criteria that could cause confusion
    • Make selection criteria as objective as possible
  4. Use XML tags to organize different routing conditions

    • Create tags for different conversation flows
    • Use descriptive tag names that indicate purpose
    • Ensure all tags are properly closed
  5. Keep routing logic simple and understandable

    • Avoid overly complex conditions
    • Use plain language to describe routing criteria
    • Focus on the most important factors for agent selection
  6. Test thoroughly after making changes

    • Try various inputs that should trigger different agents
    • Test edge cases and transitions
    • Verify that the system behaves as expected

Agent Prompt Best Practices

How to Implement Agent Prompt Best Practices

  1. Follow the three-part structure: description, notes, actions

    • Begin with a clear description of the agent's identity and purpose
    • Include notes with guidelines and constraints
    • Detail specific actions or behaviors expected of the agent
  2. Focus each agent on a specific domain or function

    • Give each agent a clear area of expertise
    • Avoid making agents responsible for too many different tasks
    • Create clear boundaries between agent responsibilities
  3. Include examples of ideal responses when possible

    • Show the agent what good responses look like
    • Include sample dialogues for common scenarios
    • Demonstrate the preferred tone and style
  4. Be specific about the tone, style, and approach you want

    • Describe the personality or character the agent should embody
    • Specify the level of formality or informality
    • Indicate whether responses should be brief or detailed
  5. Use XML tags to organize different response types

    • Create tags for different types of interactions
    • Separate procedural elements from general guidance
    • Use tags to isolate specific knowledge domains
  6. Test with various inputs to ensure consistent performance

    • Try a range of questions or requests within the agent's domain
    • Test edge cases and unusual inputs
    • Verify that responses maintain the desired quality and style

XML Tag Best Practices

How to Use XML Tags Effectively

  1. Choose descriptive tag names that reflect content purpose

    • Use names that clearly indicate what the section contains
    • Avoid overly general names like "section1" or "part2"
    • Keep names reasonably short but meaningful
  2. Keep tag naming consistent across all your prompts

    • Use the same tag names for similar content across agents
    • Maintain consistent capitalization and formatting
    • Create a naming convention and stick to it
  3. Close all tags properly to avoid parsing issues

    • Ensure every opening tag has a corresponding closing tag
    • Check for typos in tag names between opening and closing tags
    • Verify that tags are properly nested
  4. Nest tags logically when representing hierarchical information

    • Use nested tags for subcategories or related content
    • Maintain clear parent-child relationships
    • Ensure nested tags are closed in the correct order
  5. Use tags to separate distinct conversation flows or procedures

    • Create dedicated tags for different interaction types
    • Separate procedural steps from general guidelines
    • Use tags to isolate specific knowledge domains
  6. Don't overuse tags—only create them for meaningful separations

    • Use tags when they add clarity or structure
    • Avoid creating tags for very small sections
    • Keep the overall structure intuitive and readable

Testing and Refinement Best Practices

How to Test and Refine Your Prompts

  1. Start with basic test cases that should clearly trigger specific agents

    • Begin with straightforward examples
    • Verify that the core functionality works as expected
    • Establish a baseline of performance
  2. Test edge cases where the routing decision might be ambiguous

    • Try inputs that could potentially match multiple agents
    • Test corner cases and unusual requests
    • Identify any uncertainties in your routing logic
  3. Try conversational paths that involve transitions between agents

    • Test sequences that should trigger different agents in succession
    • Verify that context is maintained appropriately
    • Check that transitions feel natural to the user
  4. Check how the system handles unexpected or off-topic inputs

    • Try inputs that don't clearly match any agent's expertise
    • Test recovery from misunderstandings
    • Verify that the system gracefully handles unusual requests
  5. Make small, incremental changes when refining prompts

    • Change one aspect at a time
    • Test after each change to isolate effects
    • Keep track of which changes improve performance
  6. Document what works well for future reference

    • Record effective prompt structures
    • Note successful routing patterns
    • Keep examples of particularly effective agent prompts

General System Design Best Practices

How to Design Effective Multi-Agent Systems

  1. Start simple and add complexity as needed

    • Begin with fewer agents and add more if necessary
    • Focus on core functionality first
    • Expand capabilities incrementally
  2. Create clear separation of concerns

    • Give each agent a distinct role
    • Minimize overlap between agent responsibilities
    • Make agent selection criteria unambiguous
  3. Balance specificity and flexibility

    • Make prompts detailed enough to guide behavior
    • Allow enough flexibility for natural responses
    • Avoid overly rigid instructions that limit adaptability
  4. Design for conversation flows, not just individual responses

    • Consider the entire user journey
    • Plan for transitions between topics and agents
    • Ensure a coherent overall experience
  5. Regularly review and update your system

    • Revisit prompts periodically to identify improvements
    • Update content as your needs evolve
    • Incorporate feedback from actual usage
  6. Use versioning and backups

    • Keep copies of working configurations
    • Test changes in a sandbox before applying them
    • Maintain a history of prompt versions

By following these best practices, you can create effective multi-agent systems on the Kodey.ai platform that deliver consistent, high-quality interactions for your users.