tanhm07@hotmail.com commited on
Commit
67d4406
·
1 Parent(s): 4c1b4d9

change to participant notes

Browse files
Files changed (1) hide show
  1. app.py +81 -18
app.py CHANGED
@@ -362,8 +362,87 @@ def run_agent(system_prompt, email, show_raw_output):
362
  with gr.Blocks(title="Executive Agent Lab") as demo:
363
  gr.Markdown("# Executive Agent Lab")
364
  gr.Markdown(
365
- "Build your own email triage agent by writing the system prompt, then test it on sample or custom emails."
366
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  with gr.Row():
369
  with gr.Column(scale=1):
@@ -403,22 +482,6 @@ with gr.Blocks(title="Executive Agent Lab") as demo:
403
  - when to use the tool and when not to use it"""
404
  )
405
 
406
- with gr.Accordion("Instructor Tools", open=False):
407
- gr.Markdown("""
408
- ### How to use this app in a session
409
-
410
- 1. Ask participants to start with Basic / Structured prompts
411
- 2. Let them test and struggle with outputs
412
- 3. Introduce tool calling concept
413
- 4. Have them refine prompts to trigger tool correctly
414
- 5. Only then reveal the reference prompt
415
-
416
- Key teaching point:
417
- Participants are designing agent behavior, not just prompting."""
418
- )
419
-
420
- load_reference_btn = gr.Button("Load Reference Prompt")
421
-
422
  with gr.Column(scale=1):
423
  gr.Markdown("## Test Input")
424
  gr.Markdown("Load a sample email or paste your own.")
 
362
  with gr.Blocks(title="Executive Agent Lab") as demo:
363
  gr.Markdown("# Executive Agent Lab")
364
  gr.Markdown(
365
+ "*Built by Tan Hong Ming (NUS) · For learning prompt engineering, agentic workflows, and tool use*"
366
+ )
367
+ with gr.Accordion("How to Use This Lab", open=False):
368
+ gr.Markdown("""
369
+ ## What this lab is about
370
+
371
+ This lab helps you practice three ideas:
372
+
373
+ 1. Prompt engineering
374
+ 2. Agentic workflows
375
+ 3. Agent tool use
376
+
377
+ You will improve an email triage agent by editing its system prompt.
378
+
379
+ ## Suggested workflow
380
+
381
+ ### Step 1
382
+ Click **Load Basic** and then **Run Agent**.
383
+
384
+ Observe what the agent does well and what it does poorly.
385
+
386
+ ### Step 2
387
+ Improve the system prompt so the agent can do the following for each email:
388
+
389
+ 1. Identify the primary intent
390
+ 2. Classify priority as Low, Medium, or High
391
+ 3. Assign an owner from: Sales, Support, Finance, HR, Operations, Legal
392
+ 4. Determine the next action from: Respond, Escalate, Delegate, Request More Information
393
+ 5. Briefly explain the reasoning
394
+ 6. Draft a professional reply
395
+
396
+ ### Step 3
397
+ Test your prompt on different sample emails.
398
+
399
+ Compare how the output changes when your instructions become more specific.
400
+
401
+ ### Step 4
402
+ Get the agent to use the status lookup tool when needed.
403
+
404
+ The tool call format is:
405
+
406
+ `CALL_TOOL: lookup_status <reference_id>`
407
+
408
+ Examples:
409
+
410
+ `CALL_TOOL: lookup_status SG-18427`
411
+ `CALL_TOOL: lookup_status INC-2041`
412
+
413
+ The tool should only be used when the email refers to a specific order, shipment, incident, or ticket and current status information is needed.
414
+
415
+ ### Step 5
416
+ After you get it working, look at the source code to understand what happens under the hood.
417
+
418
+ ## What to look for in the code
419
+
420
+ Here is the simple flow:
421
+
422
+ 1. The app sends your system prompt and the email to the model
423
+ 2. The model either:
424
+ - answers directly, or
425
+ - outputs a tool call like `CALL_TOOL: lookup_status SG-18427`
426
+ 3. The app detects that tool call in the model output
427
+ 4. The Python function runs the lookup
428
+ 5. The tool result is sent back to the model
429
+ 6. The model produces the final answer
430
+
431
+ So when you read the code, focus on these parts:
432
+
433
+ - where the model is called
434
+ - how `CALL_TOOL:` is detected
435
+ - how `lookup_status()` works
436
+ - how the tool result is passed back into the model"""
437
+ )
438
+
439
+ gr.Markdown("### Reference")
440
+
441
+ gr.Markdown(
442
+ "Once you have tried building your own prompt, you can load a working example below."
443
+ )
444
+
445
+ load_reference_btn = gr.Button("Load Reference Prompt")
446
 
447
  with gr.Row():
448
  with gr.Column(scale=1):
 
482
  - when to use the tool and when not to use it"""
483
  )
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
  with gr.Column(scale=1):
486
  gr.Markdown("## Test Input")
487
  gr.Markdown("Load a sample email or paste your own.")