Few-shot prompting is a powerful technique where you provide a small number of sample interactions (typically 2 to 5) to guide your agent’s behavior. This method helps the agent understand the desired output format and task requirements by learning from the given examples, thereby improving performance without writing extensive instructions.Documentation Index
Fetch the complete documentation index at: https://agency-swarm.ai/llms.txt
Use this file to discover all available pages before exploring further.
Crafting Effective Examples
- Provide Task Demonstrations: Use examples that clearly illustrate the tasks that your agents will perform.
- Use Realistic Scenarios: Include interactions that mirror actual conversations that your agent will handle.
- Use Preferred Tone and Style: Ensure the agent’s replies in your examples match your desired brand voice.
Defining Few-Shot Examples
In Agency Swarm, few-shot examples are earlier messages that show the style you want. Put them ininstructions as plain text or pass them as message history to get_response / get_response_stream.
Optional fields like attachments and metadata can be included in message history but are not required for basic examples.
Using Few-Shot Examples
Pick one of these ways:- Message History (Scalable)
- Instructions (Simple)