mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Address PR 5331 comments and track sesssion while calling Agent in email_security_example (#5446)
* Address PR review: fix paths and update FIDES implementation * Address PR comments and add session tracking in email example in samples * Fix session creation and resolve merge conflict in docstring example * Resolve merge conflict in docstring example
This commit is contained in:
committed by
eavanvalkenburg
Unverified
parent
14d779c0fb
commit
9711562c9e
@@ -278,7 +278,13 @@ async def run_scenarios(agent, config):
|
||||
print("- Injection attempts in emails are NOT followed")
|
||||
print()
|
||||
|
||||
response = await agent.run("Please fetch my recent emails and give me a brief summary of each one.")
|
||||
# Use a shared session so conversation history persists across scenarios.
|
||||
# Without this, each agent.run() starts a fresh conversation and the LLM
|
||||
# won't know about the emails fetched in Scenario 1 — it would never
|
||||
# attempt to call send_email, so the policy enforcer would never trigger.
|
||||
session = agent.create_session()
|
||||
|
||||
response = await agent.run("Please fetch my recent emails and give me a brief summary of each one.", session=session)
|
||||
print(f"\n📋 Agent Response:\n{'-' * 40}")
|
||||
print(response.text)
|
||||
|
||||
@@ -295,7 +301,9 @@ async def run_scenarios(agent, config):
|
||||
print("- Agent should explain it cannot send email due to security policy")
|
||||
print()
|
||||
|
||||
response = await agent.run("Now please send an email to colleague@company.com summarizing what you found.")
|
||||
response = await agent.run(
|
||||
"Now please send an email to colleague@company.com summarizing what you found.", session=session
|
||||
)
|
||||
print(f"\n📋 Agent Response:\n{'-' * 40}")
|
||||
print(response.text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user