Skip to content

Commit 413fc75

Browse files
committed
fix: improve password reset prompt to look up email from Slack profile
Update the agent system prompt and tool descriptions so the agent tries to look up the user's email from their Slack profile before triggering a password reset, falling back to asking the user if the lookup fails.
1 parent f3bc921 commit 413fc75

6 files changed

Lines changed: 18 additions & 14 deletions

File tree

claude-agent-sdk/agent/casey.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@
5757
2. Search the knowledge base for relevant articles
5858
3. If the KB has a solution, walk the user through it step by step
5959
4. If the issue requires action (password reset, ticket creation), use the appropriate tool
60-
- For password resets: look up the user's email address using Slack MCP tools before \
61-
triggering the reset — don't ask the user for information you can look up yourself
60+
- For password resets: follow the instructions in the `trigger_password_reset` tool description to obtain the user's email before calling it
6261
5. After taking action, confirm what was done and what the user should expect next
6362
6. If you cannot resolve the issue, create a support ticket and let the user know
6463

claude-agent-sdk/agent/tools/password_reset.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
"Trigger a password reset for a specified user account. "
88
"Use this tool when a user requests a password reset for their own account "
99
"or reports being locked out. The reset link will be sent to their registered "
10-
"email address. Before calling this tool, look up the user's email address "
11-
"using available Slack tools if possible, rather than asking the user for it."
10+
"email address. "
11+
"IMPORTANT: You need the user's email address for target_user. "
12+
"First, try to look up the user's Slack profile to get their email address. "
13+
"If the lookup fails or does not return an email, ask the user for their email address. "
14+
"Never guess or assume — you must either look it up or ask for it."
1215
),
1316
input_schema={"target_user": str},
1417
)

openai-agents-sdk/agent/support_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
2. Search the knowledge base for relevant articles
5353
3. If the KB has a solution, walk the user through it step by step
5454
4. If the issue requires action (password reset, ticket creation), use the appropriate tool
55-
- For password resets: look up the user's email address using Slack MCP tools before \
56-
triggering the reset — don't ask the user for information you can look up yourself
55+
- For password resets: follow the instructions in the `trigger_password_reset` tool description to obtain the user's email before calling it
5756
5. After taking action, confirm what was done and what the user should expect next
5857
6. If you cannot resolve the issue, create a support ticket and let the user know
5958

openai-agents-sdk/agent/tools/password_reset.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ async def trigger_password_reset(
1414
or reports being locked out. The reset link will be sent to their registered
1515
email address.
1616
17-
Before calling this tool, look up the user's email address using available
18-
Slack tools if possible, rather than asking the user for it.
17+
IMPORTANT: You need the user's email address for target_user. First, try to
18+
look up the user's Slack profile to get their email address. If the lookup fails
19+
or does not return an email, ask the user for their email address. Never guess
20+
or assume — you must either look it up or ask for it.
1921
2022
Args:
21-
target_user: The username or email of the user whose password should be reset.
23+
target_user: The email address of the user whose password should be reset.
2224
"""
2325
return (
2426
f"Password reset initiated for **{target_user}**.\n\n"

pydantic-ai/agent/casey.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
2. Search the knowledge base for relevant articles
5353
3. If the KB has a solution, walk the user through it step by step
5454
4. If the issue requires action (password reset, ticket creation), use the appropriate tool
55-
- For password resets: look up the user's email address using Slack MCP tools before \
56-
triggering the reset — don't ask the user for information you can look up yourself
55+
- For password resets: follow the instructions in the `trigger_password_reset` tool description to obtain the user's email before calling it
5756
5. After taking action, confirm what was done and what the user should expect next
5857
6. If you cannot resolve the issue, create a support ticket and let the user know
5958

pydantic-ai/agent/tools/password_reset.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ async def trigger_password_reset(ctx: RunContext[CaseyDeps], target_user: str) -
1010
or reports being locked out. The reset link will be sent to their registered
1111
email address.
1212
13-
Before calling this tool, look up the user's email address using available
14-
Slack tools if possible, rather than asking the user for it.
13+
IMPORTANT: You need the user's email address for target_user. First, try to
14+
look up the user's Slack profile to get their email address. If the lookup fails
15+
or does not return an email, ask the user for their email address. Never guess
16+
or assume — you must either look it up or ask for it.
1517
1618
Args:
1719
ctx: The run context with dependencies.
18-
target_user: The username or email of the user whose password should be reset.
20+
target_user: The email address of the user whose password should be reset.
1921
"""
2022
return (
2123
f"Password reset initiated for **{target_user}**.\n\n"

0 commit comments

Comments
 (0)