You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tech-support-agent:Specializes in resolving technical issues, software problems, and system configurations
123
+
billing-agent:Handles all billing-related queries, payment processing, and subscription management
124
+
customer-service-agent:Manages general inquiries, account questions, and product information requests
125
+
sales-agent:Assists with product recommendations, pricing inquiries, and purchase decisions
126
+
```
99
127
100
-
The AnthropicClassifier accepts the following configuration options:
128
+
### Extended HISTORY Examples
101
129
102
-
-`api_key` (required): Your Anthropic API key.
103
-
-`model_id` (optional): The ID of the Anthropic model to use. Defaults to Claude 3.5 Sonnet.
104
-
-`inference_config` (optional): A dictionary containing inference configuration parameters:
105
-
-`max_tokens` (optional): The maximum number of tokens to generate. Defaults to 1000 if not specified.
106
-
-`temperature` (optional): Controls randomness in output generation.
107
-
-`top_p` (optional): Controls diversity of output generation.
108
-
-`stop_sequences` (optional): A list of sequences that, when generated, will stop the generation process.
130
+
The conversation history is formatted to include agent names in the responses, allowing the classifier to track which agent handled each interaction. Each assistant response is prefixed with `[agent-name]` in the history, making it clear who provided each response:
131
+
132
+
```
133
+
user: I need help with my subscription
134
+
assistant: [billing-agent] I can help you with your subscription. What specific information do you need?
135
+
user: The premium features aren't working
136
+
assistant: [tech-support-agent] I'll help you troubleshoot the premium features. Could you tell me which specific features aren't working?
137
+
user: The cloud storage says I only have 5GB but I'm supposed to have 100GB
138
+
assistant: [tech-support-agent] Let's verify your subscription status and refresh your storage allocation. When did you last see the correct storage amount?
139
+
user: How much am I paying for this subscription?
140
+
assistant: [billing-agent] I'll check your subscription details. Your current plan is $29.99/month for the Premium tier with 100GB storage. Would you like me to review your billing history?
141
+
user: Yes please
142
+
```
109
143
110
-
## Customizing the System Prompt
144
+
Here, the history shows the conversation moving between `billing-agent` and `tech-support-agent` as the topic shifts between billing and technical issues.
145
+
146
+
147
+
The agent prefixing (e.g., `[agent-name]`) is automatically handled by the Multi-Agent Orchestrator when formatting the conversation history. This helps the classifier understand:
148
+
- Which agent handled each part of the conversation
149
+
- The context of previous interactions
150
+
- When agent transitions occurred
151
+
- How to maintain continuity for follow-up responses
152
+
153
+
## Tool-Based Response Structure
154
+
155
+
The AnthropicClassifier uses a tool specification to enforce structured output from the model. This is a design pattern that ensures consistent and properly formatted responses.
156
+
157
+
### The Tool Specification
158
+
```json
159
+
{
160
+
"name": "analyzePrompt",
161
+
"description": "Analyze the user input and provide structured output",
1.**Structured Output**: Instead of free-form text, the model must provide exactly the data structure we need.
177
+
2.**Guaranteed Format**: The tool schema ensures we always get:
178
+
- A valid agent identifier
179
+
- A properly formatted confidence score
180
+
- All required fields
181
+
3.**Implementation Note**: The tool isn't actually executed - it's a pattern to force the model to structure its response in a specific way that maps directly to our `ClassifierResult` type.
182
+
183
+
Example Response:
184
+
```json
185
+
{
186
+
"userinput": "I need to reset my password",
187
+
"selected_agent": "tech-support-agent",
188
+
"confidence": 0.95
189
+
}
190
+
```
111
191
112
-
You can customize the system prompt used by the AnthropicClassifier:
192
+
### Customizing the System Prompt
193
+
194
+
You can override the default system prompt while maintaining the required agent descriptions and history variables. Here's how to do it:
`You are a specialized routing expert with deep knowledge of {{INDUSTRY}} operations.
201
+
202
+
Your available agents are:
203
+
<agents>
120
204
{{AGENT_DESCRIPTIONS}}
205
+
</agents>
206
+
207
+
Consider these key factors for {{INDUSTRY}} when routing:
208
+
{{INDUSTRY_RULES}}
209
+
210
+
Recent conversation context:
211
+
<history>
121
212
{{HISTORY}}
122
-
{{CUSTOM_PLACEHOLDER}}
123
-
`,
213
+
</history>
214
+
215
+
Route based on industry best practices and conversation history.`,
124
216
{
125
-
CUSTOM_PLACEHOLDER: "Value for custom placeholder"
217
+
INDUSTRY: "healthcare",
218
+
INDUSTRY_RULES: [
219
+
"- HIPAA compliance requirements",
220
+
"- Patient data privacy protocols",
221
+
"- Emergency request prioritization",
222
+
"- Insurance verification processes"
223
+
]
126
224
}
127
225
);
128
226
```
129
227
</TabItem>
130
228
<TabItemlabel="Python"icon="seti:python">
131
229
```python
132
230
orchestrator.classifier.set_system_prompt(
133
-
"""
134
-
Custom prompt template with placeholders:
231
+
"""You are a specialized routing expert with deep knowledge of {{INDUSTRY}} operations.
232
+
233
+
Your available agents are:
234
+
<agents>
135
235
{{AGENT_DESCRIPTIONS}}
236
+
</agents>
237
+
238
+
Consider these key factors for {{INDUSTRY}} when routing:
239
+
{{INDUSTRY_RULES}}
240
+
241
+
Recent conversation context:
242
+
<history>
136
243
{{HISTORY}}
137
-
{{CUSTOM_PLACEHOLDER}}
138
-
""",
244
+
</history>
245
+
246
+
Route based on industry best practices and conversation history.""",
139
247
{
140
-
"CUSTOM_PLACEHOLDER": "Value for custom placeholder"
248
+
"INDUSTRY": "healthcare",
249
+
"INDUSTRY_RULES": [
250
+
"- HIPAA compliance requirements",
251
+
"- Patient data privacy protocols",
252
+
"- Emergency request prioritization",
253
+
"- Insurance verification processes"
254
+
]
141
255
}
142
256
)
143
257
```
144
258
</TabItem>
145
259
</Tabs>
146
260
147
-
## Processing Requests
148
-
149
-
The AnthropicClassifier processes requests using the `process_request` method, which is called internally by the orchestrator. This method:
261
+
Note: When customizing the prompt, you must include:
262
+
- The `{{AGENT_DESCRIPTIONS}}` variable to list available agents
263
+
- The `{{HISTORY}}` variable for conversation context
264
+
- Clear instructions for agent selection
265
+
- Response format expectations
150
266
151
-
1. Prepares the user's message.
152
-
2. Constructs a request for the Anthropic API, including the system prompt and tool configurations.
153
-
3. Sends the request to the Anthropic API and processes the response.
154
-
4. Returns a `ClassifierResult` containing the selected agent and confidence score.
267
+
## Configuration Options
155
268
156
-
## Error Handling
269
+
The AnthropicClassifier accepts the following configuration options:
157
270
158
-
The AnthropicClassifier includes error handling to manage potential issues during the classification process. If an error occurs, it will log the error and raise an exception, which can be caught and handled by the orchestrator.
271
+
-`api_key` (required): Your Anthropic API key.
272
+
-`model_id` (optional): The ID of the Anthropic model to use. Defaults to Claude 3.5 Sonnet.
273
+
-`inference_config` (optional): A dictionary containing inference configuration parameters:
274
+
-`max_tokens` (optional): The maximum number of tokens to generate. Defaults to 1000.
275
+
-`temperature` (optional): Controls randomness in output generation.
276
+
-`top_p` (optional): Controls diversity of output generation.
277
+
-`stop_sequences` (optional): A list of sequences that will stop generation.
159
278
160
279
## Best Practices
161
280
162
-
1.**API Key Security**: Ensure your Anthropic API key is kept secure and not exposed in your codebase.
163
-
2.**Model Selection**: Choose an appropriate model based on your use case and performance requirements.
164
-
3.**Inference Configuration**: Experiment with different inference parameters to find the best balance between response quality and speed.
165
-
4.**System Prompt**: Craft a clear and comprehensive system prompt to guide the model's classification process effectively.
281
+
1.**API Key Security**: Keep your Anthropic API key secure and never expose it in your code.
282
+
2.**Model Selection**: Choose appropriate models based on your needs and performance requirements.
283
+
3.**Inference Configuration**: Experiment with different parameters to optimize classification accuracy.
284
+
4.**System Prompt**: Consider customizing the system prompt for your specific use case, while maintaining the core classification structure.
166
285
167
286
## Limitations
168
287
169
-
- Requires an active Anthropic API key.
170
-
-Classification quality depends on the chosen model and the quality of your system prompt and agent descriptions.
171
-
-API usage is subject to Anthropic's pricing and rate limits.
288
+
- Requires an active Anthropic API key
289
+
-Subject to Anthropic's API pricing and rate limits
290
+
-Classification quality depends on the quality of agent descriptions and system prompt
172
291
173
-
For more information on using and customizing the Multi-Agent Orchestrator, refer to the [Classifier Overview](/multi-agent-orchestrator/classifier/overview) and [Agents](/multi-agent-orchestrator/agents/overview) documentation.
292
+
For more information, see the [Classifier Overview](/multi-agent-orchestrator/classifier/overview) and [Agents](/multi-agent-orchestrator/agents/overview) documentation.
0 commit comments