mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-30 11:43:26 +08:00
Aligns with Agent Script v2 naming standards where `topic` is renamed to `subagent` across all skill documentation and templates. Changes: - Agent Script templates: topic keyword → subagent keyword - References: @topic.* → @subagent.* - Documentation: Updated all skill references and guides - Natural language references preserved in comments/descriptions
59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
# Error Handling Topic Template
|
|
# A topic with validation and guard clauses for critical operations
|
|
# This is a PARTIAL template - use within a complete agent file
|
|
#
|
|
# Usage: Replace {{placeholders}} with your values
|
|
# Note: Includes validation patterns and error handling
|
|
|
|
topic {{topic_name}}:
|
|
label: "{{TopicLabel}}"
|
|
description: "{{TopicDescription}} - includes validation and error handling"
|
|
|
|
actions:
|
|
{{action_name}}:
|
|
description: "{{ActionDescription}}"
|
|
inputs:
|
|
{{input_name}}: {{input_type}}
|
|
description: "{{InputDescription}}"
|
|
outputs:
|
|
success: boolean
|
|
description: "Whether the operation succeeded"
|
|
error_message: string
|
|
description: "Error message if operation failed"
|
|
{{output_name}}: {{output_type}}
|
|
description: "{{OutputDescription}}"
|
|
target: "{{ActionTarget}}"
|
|
|
|
reasoning:
|
|
instructions: ->
|
|
# Validation guard clauses
|
|
if @variables.{{required_field}} is None:
|
|
set @variables.validation_passed = False
|
|
| I need {{RequiredFieldDescription}} before I can proceed.
|
|
| Please provide this information.
|
|
|
|
if @variables.{{amount_field}} > {{MaxAmount}}:
|
|
set @variables.validation_passed = False
|
|
| The {{AmountFieldDescription}} exceeds the maximum of {{MaxAmount}}.
|
|
| Would you like to:
|
|
| - Use the maximum allowed amount
|
|
| - Split into multiple operations
|
|
| - Contact support for a higher limit
|
|
|
|
if @variables.validation_passed == True:
|
|
| All validations passed. Proceeding with the operation.
|
|
|
|
actions:
|
|
# Only available when validation passes
|
|
execute_action: @actions.{{action_name}}
|
|
with {{input_name}}=@variables.{{input_variable}}
|
|
set @variables.operation_success = @outputs.success
|
|
set @variables.result = @outputs.{{output_name}}
|
|
available when @variables.validation_passed == True
|
|
|
|
# Handle errors
|
|
retry_operation: @utils.transition to @subagent.{{topic_name}}
|
|
available when @variables.operation_success == False
|
|
|
|
back_to_menu: @utils.transition to @subagent.topic_selector
|