diff --git a/WORKSHOP.txt b/WORKSHOP.txt index 182ada4..9b9dfc1 100644 --- a/WORKSHOP.txt +++ b/WORKSHOP.txt @@ -1,7 +1,7 @@ -Behavioural and technical practice -Four agents handle intake and both interview phases. The chat page displays the session ID. Summary generation comes next. +Five collaborating specialists +Expand the two-agent workflow into the reference application's full handoff graph and scoped tool sets. -Checkpoint: 07-interviewers +Checkpoint: 07-handoffs Source tag: workshop-v3-reference.1 Reference revision: 443eac269743643d1bd5a35582fa3fac27bc6ad5 Workshop profile: foundry-workshop-v3 diff --git a/src/InterviewCoach.Agent/AgentDelegateFactory.cs b/src/InterviewCoach.Agent/AgentDelegateFactory.cs index 76979f3..4ed8c41 100644 --- a/src/InterviewCoach.Agent/AgentDelegateFactory.cs +++ b/src/InterviewCoach.Agent/AgentDelegateFactory.cs @@ -134,20 +134,46 @@ private static Workflow CreateHandOffWorkflow(IServiceProvider sp, string key) var interviewDataTools = interviewData.ListToolsAsync().GetAwaiter().GetResult(); // --- Triage Agent --- + // Routes using the latest request and completed phases. Has no application tools. var triageAgent = CreateProviderAgent( services: sp, name: "triage", description: "Routes the conversation to the correct interview specialist.", instructions: """ - You route an interview between receptionist, behavioural_interviewer, and technical_interviewer. - Handle the latest user request first, using earlier messages only as context. - If the user supplies an answer, route to the interviewer who asked the latest question, even if they also want to finish. - If the user wants to stop or finish, acknowledge their choice and end this turn without a handoff. - Summary generation comes in the next lesson. Do not restart intake or an earlier interview phase. - Honor an explicit request for behavioural or technical practice by routing to that interviewer. - Route to receptionist only while intake is incomplete. - Otherwise keep an answer with the interviewer who asked the latest question. - After technical practice, ask whether the user wants more practice; wait for their choice. + You are the Triage agent for an AI Interview Coach system. + Your ONLY job is to analyze the conversation and hand off to the right specialist agent. + You do NOT answer questions or conduct interviews yourself. + + IMPORTANT: Before routing, review the FULL conversation history to determine + which phases have already been completed. Repeat an earlier phase only for + changed input or an explicit user request. The interview follows this sequence: + 1. Receptionist (session setup, document intake) + 2. Behavioural Interviewer + 3. Technical Interviewer + 4. Summariser + + Routing rules (apply in order; the latest user request takes priority over earlier messages): + - If the user wants to stop or finish, hand off to "summariser" immediately. + Do not restart intake or ask another interview question. + - If the latest message supplies a new or replacement resume or job description, hand off to + "receptionist" first, even if it also asks to begin practice. A URL alone is not parsed document text. + - If the user explicitly requests a specific phase, honour that request. + - If the user is answering the latest technical question, hand off to "technical_interviewer". + - If the user is answering the latest behavioural question, hand off to "behavioural_interviewer". + - If the receptionist has NOT yet collected the resume and job description + → hand off to "receptionist" + - If document intake is complete and behavioural interview has NOT started + → hand off to "behavioural_interviewer" + - If behavioural interview is complete and technical interview has NOT started + → hand off to "technical_interviewer" + - If technical interview is complete + → hand off to "summariser" + - If unclear, ask the user to clarify what they'd like to do. + + A specialist may return to you for changed input or an early finish. + Read the handoff reason and apply the routing rules; a return does not always mean a phase is complete. + + Always be brief and supportive. Let the specialists do the detailed work. """); // --- Receptionist Agent --- @@ -204,6 +230,7 @@ Always maintain a supportive and encouraging tone. tools: [.. interviewDataTools]); // --- Technical Interviewer Agent --- + // Saves technical feedback before transferring to the summariser. var technicalAgent = CreateProviderAgent( services: sp, name: "technical_interviewer", @@ -219,23 +246,57 @@ 1. Fetch the interview session record to get the resume and job description cont 4. Before each update, call get_interview_session and preserve all six resume/job fields. Set Transcript to ONLY the new questions, answers, and analysis to append; never resend old text. 5. After a few questions (typically 3-5), ask if the user wants to continue or wrap up. - 6. If the user wants to finish, give brief feedback and acknowledge the end of practice. - Do not ask another question or hand off. Only hand off to "triage" for an unexpected request. + 6. When done, hand off directly to "summariser" to generate the interview summary. + Only hand off to "triage" if the user wants to do something unexpected. Focus on practical, real-world scenarios relevant to the job. Always maintain a supportive and encouraging tone. """, tools: [.. interviewDataTools]); - // Connect the four available agents. + // --- Summariser Agent --- + // Generates the final interview summary. + // Hands back to Triage only after summary — this is the end of the sequence. + var summariserAgent = CreateProviderAgent( + services: sp, + name: "summariser", + description: "Produces the final interview summary and recommendations.", + instructions: """ + You are the Summariser for an AI Interview Coach system. + Your job is to generate a comprehensive interview summary. + + Process: + 1. Fetch the interview session record to get the full transcript. Also review the latest user + message for a final answer that has not been saved yet, and include that new answer in the update. + 2. Generate a summary that includes: + - Overview of the interview session + - Key highlights and strong answers + - Areas for improvement + - Specific recommendations for the user + - Overall readiness assessment + 3. Preserve all six resume/job fields and call update_interview_session with ONLY the new summary + in Transcript. The repository appends it; never send the stored transcript again. + 4. Call complete_interview_session with the same ID. Confirm completion only when its returned + record has IsCompleted true. Report tool failures honestly. + 5. Present the summary to the user. + 6. Hand off back to triage in case the user wants to do anything else. + + Always maintain a supportive and encouraging tone. + """, + tools: [.. interviewDataTools]); + + // Build the handoff workflow + // Normal phase changes follow the specialist chain. + // Each specialist can return to triage for a changed request. #pragma warning disable MAAIW001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. var workflow = AgentWorkflowBuilder .CreateHandoffBuilderWith(triageAgent) - .WithHandoffs(triageAgent, [receptionistAgent, behaviouralAgent, technicalAgent]) + .WithHandoffs(triageAgent, [receptionistAgent, behaviouralAgent, technicalAgent, summariserAgent]) .WithHandoffs(receptionistAgent, [behaviouralAgent, triageAgent]) .WithHandoffs(behaviouralAgent, [technicalAgent, triageAgent]) - .WithHandoff(technicalAgent, triageAgent) + .WithHandoffs(technicalAgent, [summariserAgent, triageAgent]) + .WithHandoff(summariserAgent, triageAgent) .Build(); #pragma warning restore MAAIW001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.