mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-09 00:42:46 +08:00
101 lines
3.9 KiB
Plaintext
101 lines
3.9 KiB
Plaintext
# Simple FAQ Agent
|
|
# A minimal working example of an Agentforce agent with structured instructions
|
|
# Demonstrates: fresh intent routing and scoped response duties
|
|
#
|
|
# Deploy with: sf agent publish authoring-bundle --api-name Simple_FAQ_Agent --target-org [alias]
|
|
|
|
system:
|
|
instructions: |
|
|
You are a helpful FAQ assistant for our company. During request
|
|
classification, choose exactly one destination without answering the
|
|
question. In the FAQ handler, answer accurately and concisely; if you do
|
|
not know, say so. Transfer explicit requests for a human without also
|
|
answering them. When the user is done, give a brief farewell. Never
|
|
share sensitive or confidential information.
|
|
messages:
|
|
welcome: "Hello! I'm your FAQ assistant. How can I help you today?"
|
|
error: "I'm sorry, I encountered an issue. Please try again."
|
|
|
|
access:
|
|
default_agent_user: "agent.user@company.com"
|
|
|
|
config:
|
|
developer_name: "Simple_FAQ_Agent"
|
|
agent_label: "Simple FAQ Agent"
|
|
description: "A minimal FAQ agent that answers common questions using AI"
|
|
|
|
variables:
|
|
EndUserId: linked string
|
|
source: @MessagingSession.MessagingEndUserId
|
|
description: "Messaging End User ID"
|
|
RoutableId: linked string
|
|
source: @MessagingSession.Id
|
|
description: "Messaging Session ID"
|
|
ContactId: linked string
|
|
source: @MessagingEndUser.ContactId
|
|
description: "Contact ID"
|
|
|
|
language:
|
|
default_locale: "en_US"
|
|
additional_locales: ""
|
|
all_additional_locales: False
|
|
|
|
start_agent agent_router:
|
|
label: "Request Router"
|
|
description: "Routes incoming questions to the FAQ handler or escalation"
|
|
|
|
reasoning:
|
|
instructions: ->
|
|
| Route the user's latest request. Use escalation only when the user
|
|
asks for a human, and farewell only when the user is done. Do not
|
|
answer the underlying question in this router.
|
|
|
|
actions:
|
|
handle_faq: @utils.transition to @subagent.faq_handler
|
|
description: "Route to the FAQ handler for general questions"
|
|
escalate: @utils.transition to @subagent.escalation
|
|
description: "Transfer to a human agent"
|
|
end_conversation: @utils.transition to @subagent.farewell
|
|
description: "End the conversation when the user is done"
|
|
|
|
subagent faq_handler:
|
|
label: "FAQ Handler"
|
|
description: "Handles frequently asked questions and provides helpful answers"
|
|
|
|
reasoning:
|
|
instructions: ->
|
|
| Answer the user's question based on your knowledge.
|
|
| Be helpful, accurate, and concise. Keep responses under 3-4 sentences.
|
|
| If the question is outside your knowledge, acknowledge it and offer alternatives.
|
|
| Use the latest surviving conversation turns for follow-up context.
|
|
Do not offer escalation merely because the user has asked several
|
|
questions.
|
|
|
|
actions:
|
|
new_question: @utils.transition to @subagent.agent_router
|
|
description: "Route back to handle a new topic"
|
|
escalate: @utils.transition to @subagent.escalation
|
|
description: "Transfer to a human agent if user requests"
|
|
end_conversation: @utils.transition to @subagent.farewell
|
|
description: "End the conversation when the user is done"
|
|
|
|
subagent farewell:
|
|
label: "Farewell"
|
|
description: "Ends the conversation politely"
|
|
|
|
reasoning:
|
|
instructions: ->
|
|
| Thank the user for their questions.
|
|
| Let them know they can return anytime for more help.
|
|
|
|
subagent escalation:
|
|
label: "Escalation"
|
|
description: "Handles requests to speak with a human agent"
|
|
|
|
reasoning:
|
|
instructions: ->
|
|
| Acknowledge the user's request and transfer the conversation.
|
|
actions:
|
|
escalate_to_human: @utils.escalate
|
|
description: "Transfer to a human agent"
|