You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have developed and deployed a multi-agent workflow as an API, which is integrated with a chatbot interface (Copilot Studio).
As part of the workflow, the service requires user approval before executing certain actions. I am successfully intercepting logs and passing UserProxy questions to the chatbot.
✅ Current Progress:
The chatbot receives and displays the approval request (UserProxy question).
The user responds within Copilot Studio, and I capture the response.
❌ Issue:
When I send the response back to the service through the API, it initializes the workflow from the beginning instead of continuing the existing session.
🔹 Expected Behavior:
The response should be pushed back to the correct agent/session/conversation instead of restarting the flow.
🔹 Request:
Please suggest changes to ensure that the response reaches the right agent (UserProxy) in the same session/conversation without starting a new workflow.
Below is my current implementation.
kva_rest.py
from pydantic import BaseModel
import json
from joiner import Joiner
import asyncio
import requests
app = FastAPI()
class UserInput(BaseModel):
user_input: str
user_email: str
first_msg: str
@app.post("/conversation")
async def conversation(user_data: UserInput):
joiner = Joiner()
await joiner.initialize()
print("MagenticOne initialized.", user_data)
# Create task and log streaming tasks
task_future = asyncio.create_task(joiner.run_task(user_data.user_input, conversation_id = "12345", first_msg = user_data.first_msg))
final_answer = None
# Stream and process logs
async for log_entry in joiner.stream_logs():
print(json.dumps(log_entry, indent=2))
if (
log_entry.get("type") == "OrchestrationEvent"
and log_entry.get("source") == "Orchestrator (-> UserProxy)"
):
api_url_user_question = "https://prod-36.westus.logic.azure.com:443/workflows/bdad6ce67d8d4028aa0fafe9d30c90cb/triggers/manual/paths/invoke"
query_params = {
"api-version": "2016-06-01",
"sp": "/triggers/manual/run",
"sv": "1.0",
"sig": "V4xvvpSdPva5AXAaeFd7xGhIxcuwHY4R4pMv1IYp4-o"
}
payload = {"message": log_entry.get("message"), "user_input": user_data.user_input, "user_email": user_data.user_email}
question = log_entry.get("message")
topic_id = log_entry.get("topic_id") # Get the topic ID of the conversation
print(f"UserProxy asked: {question} in topic {topic_id}")
try:
response = requests.post(api_url_user_question, params=query_params, json=payload)
response.raise_for_status()
pushResponse = response.json()
return True, f"{onboardingRequestResponse['response']}"
except requests.exceptions.RequestException as e:
return False, f"Failed to create push response: {e}"
except ValueError:
return False, "Error parsing API response. Please check the format."
# Wait for task to complete
await task_future
# Get the final answer
final_answer = joiner.get_final_answer()
if final_answer is not None:
print(f"Final answer: {final_answer}")
api_url = "https://prod-36.westus.logic.azure.com:443/workflows/bdad6ce67d8d4028aa0fafe9d30092cb/triggers/manual/paths/invoke"
query_params = {
"api-version": "2016-06-01",
"sp": "/triggers/manual/run",
"sv": "1.0",
"sig": "V4xvvpSdPva5AXAaeFd7xGhIxcuwHY4R4pMv1IYp4-o"
}
payload = {"message": final_answer, "user_input": user_data.user_input, "user_email": user_data.user_email}
try:
response = requests.post(api_url, params=query_params, json=payload)
response.raise_for_status()
pushResponse = response.json()
return True, f"{onboardingRequestResponse['response']}"
except requests.exceptions.RequestException as e:
return False, f"Failed to create push response: {e}"
except ValueError:
return False, "Error parsing API response. Please check the format."
else:
print("No final answer found in logs.")
return {"message": final_answer}
@app.get("/")
async def root():
return {"message": "success"}
joiner.py
import logging
import os
from typing import Optional, AsyncGenerator, Dict, Any, List
from datetime import datetime
import json
from dataclasses import asdict
from autogen_core import SingleThreadedAgentRuntime
from autogen_core import EVENT_LOGGER_NAME
from autogen_core import AgentId, AgentProxy
from autogen_core import DefaultTopicId
from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor
from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor
from autogen_core.code_executor import CodeBlock
from autogen_magentic_one.agents.coder import Coder, Executor
from autogen_magentic_one.agents.weather_agent import WeatherAgent
from autogen_magentic_one.agents.fetch_onboarding_steps import FetchOnboardingSteps
from autogen_magentic_one.agents.create_ad_account import ADAccountRequest
from autogen_magentic_one.agents.create_servicenow_account import ServiceNowAccountRequest
from autogen_magentic_one.agents.create_remedy_account import RemedyRequestAgent
from autogen_magentic_one.agents.laptop_request import LaptopRequest
from autogen_magentic_one.agents.create_incident import CreateIncident
from autogen_magentic_one.agents.orchestrator import LedgerOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import BroadcastMessage
from autogen_magentic_one.utils import LogHandler, create_completion_client_from_env
from autogen_magentic_one.messages import RequestReplyMessage
from autogen_core.models import UserMessage
from threading import Lock
async def confirm_code(code: CodeBlock) -> bool:
return True
class Joiner:
def __init__(self, logs_dir: str = None, save_screenshots: bool = False) -> None:
"""
A helper class to interact with the MagenticOne system.
Initialize MagenticOne instance.
Args:
logs_dir: Directory to store logs and downloads
save_screenshots: Whether to save screenshots of web pages
"""
self.logs_dir = logs_dir or os.getcwd()
self.runtime: Optional[SingleThreadedAgentRuntime] = None
self.log_handler: Optional[LogHandler] = None
self.save_screenshots = save_screenshots
if not os.path.exists(self.logs_dir):
os.makedirs(self.logs_dir)
async def initialize(self) -> None:
"""
Initialize the MagenticOne system, setting up agents and runtime.
"""
# Create the runtime
self.runtime = SingleThreadedAgentRuntime()
# Set up logging
logger = logging.getLogger(EVENT_LOGGER_NAME)
logger.setLevel(logging.INFO)
self.log_handler = LogHandler(filename=os.path.join(self.logs_dir, "log.jsonl"))
logger.handlers = [self.log_handler]
# Create client
client = create_completion_client_from_env(model="gpt-4o")
# Register agents.
await WeatherAgent.register(self.runtime, "WeatherAgent", lambda: WeatherAgent(model_client=client))
weather_agent = AgentProxy(AgentId("WeatherAgent", "default"), self.runtime)
await FetchOnboardingSteps.register(self.runtime, "FetchOnboardingSteps", lambda: FetchOnboardingSteps(model_client=client))
fetch_onboarding_steps = AgentProxy(AgentId("FetchOnboardingSteps", "default"), self.runtime)
await ADAccountRequest.register(self.runtime, "ADAccountRequest", lambda: ADAccountRequest(model_client=client))
create_ad_account = AgentProxy(AgentId("ADAccountRequest", "default"), self.runtime)
await ServiceNowAccountRequest.register(self.runtime, "ServiceNowAccountRequest", lambda: ServiceNowAccountRequest(model_client=client))
create_servicenow_account = AgentProxy(AgentId("ServiceNowAccountRequest", "default"), self.runtime)
await RemedyRequestAgent.register(self.runtime, "RemedyRequestAgent", lambda: RemedyRequestAgent(model_client=client))
create_remedy_account = AgentProxy(AgentId("RemedyRequestAgent", "default"), self.runtime)
await LaptopRequest.register(self.runtime, "LaptopRequest", lambda: LaptopRequest(model_client=client))
laptop_request = AgentProxy(AgentId("LaptopRequest", "default"), self.runtime)
await CreateIncident.register(self.runtime, "CreateIncident", lambda: CreateIncident(model_client=client))
create_incident = AgentProxy(AgentId("CreateIncident", "default"), self.runtime)
await Coder.register(self.runtime, "Coder", lambda: Coder(model_client=client))
coder = AgentProxy(AgentId("Coder", "default"), self.runtime)
await UserProxy.register(
self.runtime,
"UserProxy",
lambda: UserProxy(description="The current user interacting with you."),
)
user_proxy = AgentProxy(AgentId("UserProxy", "default"), self.runtime)
# await RoundRobinOrchestrator.register(self.runtime, "orchestrator", lambda: RoundRobinOrchestrator([weather_agent, coder, user_proxy]))
agent_list = [user_proxy, coder, weather_agent, fetch_onboarding_steps, create_ad_account, create_servicenow_account, create_remedy_account, laptop_request, create_incident]
await LedgerOrchestrator.register(
self.runtime,
"Orchestrator",
lambda: LedgerOrchestrator(
agents=agent_list,
model_client=client,
max_rounds=30,
max_time=25 * 60,
max_stalls_before_replan=10,
return_final_answer=True,
),
)
self.runtime.start()
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
"""
Clean up resources.
"""
if self.code_executor:
await self.code_executor.__aexit__(exc_type, exc_value, traceback)
async def run_task(self, task: str, conversation_id: str, first_msg: str) -> None:
"""
Run a specific task through the MagenticOne system.
Args:
task (str): The task description to be executed.
conversation_id (str): The ID of the conversation to send the message to.
"""
if not self.runtime:
raise RuntimeError("MagenticOne not initialized. Call initialize() first.")
task_message = BroadcastMessage(content=UserMessage(content=task, source="UserProxy"))
target_topic_id = DefaultTopicId(conversation_id)
print("target_topic_id::",target_topic_id)
"""await self.runtime.publish_message(task_message, topic_id=target_topic_id)"""
if first_msg == "yes":
await self.runtime.publish_message(task_message, topic_id=DefaultTopicId())
else:
# Send response back to UserProxy
response_message = BroadcastMessage(content=UserMessage(content=task, source="UserProxy"))
target_topic_id = DefaultTopicId() # Make sure this topic ID is correct
print(f"Sending response to UserProxy: {task}")
await self.runtime.publish_message(response_message, topic_id=target_topic_id)
await self.runtime.stop_when_idle()
def get_final_answer(self) -> Optional[str]:
"""
Get the final answer from the Orchestrator.
Returns:
The final answer as a string
"""
if not self.log_handler:
raise RuntimeError("Log handler not initialized")
for log_entry in self.log_handler.logs_list:
if (
log_entry.get("type") == "OrchestrationEvent"
and log_entry.get("source") == "Orchestrator (final answer)"
):
return log_entry.get("message")
return None
async def stream_logs(self) -> AsyncGenerator[Dict[str, Any], None]:
"""
Stream logs from the system as they are generated. Stops when it detects both
the final answer and termination condition from the Orchestrator.
Yields:
Dictionary containing log entry information
"""
if not self.log_handler:
raise RuntimeError("Log handler not initialized")
last_index = 0
found_final_answer = False
found_termination = False
found_termination_no_agent = False
while True:
current_logs = self.log_handler.logs_list
while last_index < len(current_logs):
log_entry = current_logs[last_index]
yield log_entry
# Check for termination condition
if (
log_entry.get("type") == "OrchestrationEvent"
and log_entry.get("source") == "Orchestrator (final answer)"
):
found_final_answer = True
if (
log_entry.get("type") == "OrchestrationEvent"
and log_entry.get("source") == "Orchestrator (termination condition)"
):
found_termination = True
if (
log_entry.get("type") == "OrchestrationEvent"
and log_entry.get("source") == "Orchestrator (termination condition)"
and log_entry.get("message") == "No agent selected."
):
found_termination_no_agent = True
if self.runtime._run_context is None:
return
if found_termination_no_agent and found_final_answer:
return
elif found_termination and not found_termination_no_agent:
return
last_index += 1
await asyncio.sleep(0.1) # Small delay to prevent busy waiting
def get_all_logs(self) -> List[Dict[str, Any]]:
"""
Get all logs that have been collected so far.
Returns:
List of all log entries
"""
if not self.log_handler:
raise RuntimeError("Log handler not initialized")
return self.log_handler.logs_list
Payload to initiate the flow,
{"user_input":"onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru", "user_email":"karunakaran.gn@kyncomdigiwasusdev.onmicrosoft.com", "first_msg": "yes"}
payload to send response to the userProxy question
FastAPI Starting development server 🚀
Searching for package file structure from directories with __init__.py files
Importing from C:\Users\KarunakaranGN\Downloads\New folder (2)\magenticone\interface
module 🐍 kva_rest.py
code Importing the FastAPI app object from the module with the following code:
from kva_rest import app
app Using import string: kva_rest:app
server Server started at http://127.0.0.1:8000
server Documentation at http://127.0.0.1:8000/docs
tip Running in development mode, for production use: fastapi run
Logs:
INFO Will watch for changes in these directories: ['C:\\Users\\KarunakaranGN\\Downloads\\New folder
(2)\\magenticone\\interface']
INFO Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO Started reloader process [34496] using WatchFiles
INFO Started server process [29116]
INFO Waiting for application startup.
INFO Application startup complete.
MagenticOne initialized. user_input='onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru' user_email='karunakaran.gn@kyncomdigiwasusdev.onmicrosoft.com' first_msg='yes'
target_topic_id:: 12345/default
---------------------------------------------------------------------------
[2025-02-07T19:31:06.961000], UserProxy:
onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru
{
"timestamp": "2025-02-07T19:31:06.961000",
"source": "UserProxy",
"message": "onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru",
"type": "OrchestrationEvent"
}
C:\Karun\Documents\LUCA\AgenticAI\AG 04\autogen\python\packages\autogen-magentic-one\src\autogen_magentic_one\agents\orchestrator.py:152: UserWarning: Resolved model mismatch: gpt-4o-2024-08-06 != gpt-4o-2024-11-20. Model mapping may be incorrect.
response = await self._model_client.create(
{
"timestamp": "2025-02-07T19:31:13.067354",
"prompt_tokens": 398,
"completion_tokens": 316,
"type": "LLMCallEvent"
}
C:\Karun\Documents\LUCA\AgenticAI\AG 04\autogen\python\packages\autogen-magentic-one\src\autogen_magentic_one\agents\orchestrator.py:165: UserWarning: Resolved model mismatch: gpt-4o-2024-08-06 != gpt-4o-2024-11-20. Model mapping may be incorrect.
response = await self._model_client.create(
---------------------------------------------------------------------------
[2025-02-07T19:31:17.338581], Orchestrator (thought):
Initial plan:
We are working to address the following user request:
onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru
To answer this request we have assembled the following team:
UserProxy: The current user interacting with you.
Coder: A helpful and general-purpose AI assistant that has strong language skills, Python skills, and Linux command line skills.
WeatherAgent: A weather agent that fetches summarized weather details for a location using an external API.
FetchOnboardingSteps: An agent that provides onboarding steps for new employees and follows the steps to onboard the employee
ADAccountRequest: An agent that creates AD accounts for new employees through an external API.
ServiceNowAccountRequest: An agent that creates ServiceNow accounts for new employees through an external API.
RemedyRequestAgent: An agent that creates Remedy requests for new employees through an external API.
LaptopRequest: An agent that assigns laptops to new employees through an external API.
CreateIncident: An agent that creates incident requests through an external API.
Here is an initial fact sheet to consider:
### 1. GIVEN OR VERIFIED FACTS
- Name: Harshavardhan Chikkala
- Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com
- Department: IT
- Location: Bengaluru
### 2. FACTS TO LOOK UP
- Company-specific onboarding process details (e.g., documentation, tools, or software used in the employee setup process). These could be found in internal policy documents or through HR systems.
- Specific IT Department requirements or prerequisites for new employees (e.g., hardware, software, login credentials).
- Standard IT infrastructure at the Bengaluru location (e.g., office layout, tech support contacts).
### 3. FACTS TO DERIVE
- Necessary accounts or platforms Harshavardhan might need access to, based on his role in the IT department (e.g., system admin tools, email, project management tools, internal portals).
- Whether Harshavardhan is a remote or on-site employee, based on the provided location (Bengaluru).
### 4. EDUCATED GUESSES
- Harshavardhan will likely need standard IT equipment such as a laptop, company email setup, and access to collaboration tools (e.g., Teams, Zoom, or Slack).
- The onboarding process may involve a mix of virtual and in-person tasks, assuming the Bengaluru location is an office hub.
- The email domain suggests the company may be using Microsoft Office 365 products for communication and productivity.
Here is the plan to follow as best as possible:
### Plan for Addressing the Request to Onboard Harshavardhan Chikkala
- **Step 1: Fetch Onboarding Steps**
- Involve **FetchOnboardingSteps** to retrieve the company-specific sequence of tasks required to onboard a new IT employee in Bengaluru.
- **Step 2: Create Active Directory Account**
- Use **ADAccountRequest** to create Harshavardhan's Active Directory account with the provided email.
- **Step 3: Provision ServiceNow Account**
- Use **ServiceNowAccountRequest** to set up Harshavardhan's ServiceNow account for IT ticketing and workflow purposes.
- **Step 4: Create Remedy Account**
- Engage **RemedyRequestAgent** to create a Remedy account for accessing IT processes, if Remedy is used by the IT department.
- **Step 5: Allocate Laptop**
- Assign a laptop to Harshavardhan using **LaptopRequest**, ensuring it meets IT department's specifications and is configured for Bengaluru location.
- **Step 6: Check Weather (Optional)**
- Use **WeatherAgent** to check Bengaluru's current weather for office logistics or remote work considerations (optional and not critical to onboarding).
- **Step 7: Log Incidents (If Issues Arise)**
- If any issues occur during the onboarding process, leverage **CreateIncident** to create an incident and escalate it for resolution.
- **Step 8: Final Confirmation**
- Have **FetchOnboardingSteps** check and confirm that all onboarding steps are completed for successful integration.
No immediate need to involve **Coder** unless scripting or debugging assistance is required during the process.
{
"timestamp": "2025-02-07T19:31:17.334992",
"prompt_tokens": 958,
"completion_tokens": 342,
"type": "LLMCallEvent"
}
{
"timestamp": "2025-02-07T19:31:17.338581",
"source": "Orchestrator (thought)",
"message": "Initial plan:\n\nWe are working to address the following user request:\n\nonboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru\n\n\nTo answer this request we have assembled the following team:\n\nUserProxy: The current user interacting with you.\nCoder: A helpful and general-purpose AI assistant that has strong language skills, Python skills, and Linux command line skills.\nWeatherAgent: A weather agent that fetches summarized weather details for a location using an external API.\nFetchOnboardingSteps: An agent that provides onboarding steps for new employees and follows the steps to onboard the employee\nADAccountRequest: An agent that creates AD accounts for new employees through an external API.\nServiceNowAccountRequest: An agent that creates ServiceNow accounts for new employees through an external API.\nRemedyRequestAgent: An agent that creates Remedy requests for new employees through an external API.\nLaptopRequest: An agent that assigns laptops to new employees through an external API.\nCreateIncident: An agent that creates incident requests through an external API.\n\n\n\nHere is an initial fact sheet to consider:\n\n### 1. GIVEN OR VERIFIED FACTS\n- Name: Harshavardhan Chikkala \n- Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com \n- Department: IT \n- Location: Bengaluru \n\n### 2. FACTS TO LOOK UP\n- Company-specific onboarding process details (e.g., documentation, tools, or software used in the employee setup process). These could be found in internal policy documents or through HR systems. \n- Specific IT Department requirements or prerequisites for new employees (e.g., hardware, software, login credentials). \n- Standard IT infrastructure at the Bengaluru location (e.g., office layout, tech support contacts). \n\n### 3. FACTS TO DERIVE\n- Necessary accounts or platforms Harshavardhan might need access to, based on his role in the IT department (e.g., system admin tools, email, project management tools, internal portals). \n- Whether Harshavardhan is a remote or on-site employee, based on the provided location (Bengaluru). \n\n### 4. EDUCATED GUESSES\n- Harshavardhan will likely need standard IT equipment such as a laptop, company email setup, and access to collaboration tools (e.g., Teams, Zoom, or Slack). \n- The onboarding process may involve a mix of virtual and in-person tasks, assuming the Bengaluru location is an office hub. \n- The email domain suggests the company may be using Microsoft Office 365 products for communication and productivity. \n\n\nHere is the plan to follow as best as possible:\n\n### Plan for Addressing the Request to Onboard Harshavardhan Chikkala\n\n- **Step 1: Fetch Onboarding Steps**\n - Involve **FetchOnboardingSteps** to retrieve the company-specific sequence of tasks required to onboard a new IT employee in Bengaluru.\n\n- **Step 2: Create Active Directory Account**\n - Use **ADAccountRequest** to create Harshavardhan's Active Directory account with the provided email.\n\n- **Step 3: Provision ServiceNow Account**\n - Use **ServiceNowAccountRequest** to set up Harshavardhan's ServiceNow account for IT ticketing and workflow purposes.\n\n- **Step 4: Create Remedy Account**\n - Engage **RemedyRequestAgent** to create a Remedy account for accessing IT processes, if Remedy is used by the IT department.\n\n- **Step 5: Allocate Laptop**\n - Assign a laptop to Harshavardhan using **LaptopRequest**, ensuring it meets IT department's specifications and is configured for Bengaluru location.\n\n- **Step 6: Check Weather (Optional)**\n - Use **WeatherAgent** to check Bengaluru's current weather for office logistics or remote work considerations (optional and not critical to onboarding).\n\n- **Step 7: Log Incidents (If Issues Arise)**\n - If any issues occur during the onboarding process, leverage **CreateIncident** to create an incident and escalate it for resolution.\n\n- **Step 8: Final Confirmation**\n - Have **FetchOnboardingSteps** check and confirm that all onboarding steps are completed for successful integration.\n\nNo immediate need to involve **Coder** unless scripting or debugging assistance is required during the process.\n",
"type": "OrchestrationEvent"
}
C:\Karun\Documents\LUCA\AgenticAI\AG 04\autogen\python\packages\autogen-magentic-one\src\autogen_magentic_one\agents\orchestrator.py:216: UserWarning: Resolved model mismatch: gpt-4o-2024-08-06 != gpt-4o-2024-11-20. Model mapping may be incorrect.
ledger_response = await self._model_client.create(
---------------------------------------------------------------------------
[2025-02-07T19:31:21.904449], Orchestrator (thought):
Updated Ledger:
{
"is_request_satisfied": {
"reason": "The onboarding process for Harshavardhan Chikkala has not yet been fully executed or confirmed as completed. Steps like creating accounts, laptop allocation, and other necessary onboarding tasks remain pending.",
"answer": false
},
"is_in_loop": {
"reason": "This is the first step in the process, and there is no evidence of repeated actions or responses.",
"answer": false
},
"is_progress_being_made": {
"reason": "We are starting the onboarding process by engaging the relevant team members to fetch the appropriate onboarding steps.",
"answer": true
},
"next_speaker": {
"reason": "FetchOnboardingSteps needs to provide the detailed onboarding steps specific to the company in order to proceed with the subsequent tasks.",
"answer": "FetchOnboardingSteps"
},
"instruction_or_question": {
"reason": "To ensure the onboarding process is aligned with company policies and covers all necessary tasks, detailed steps for onboarding an IT employee in Bengaluru are needed.",
"answer": "Please retrieve the detailed company-specific onboarding steps for onboarding a new IT employee at the Bengaluru location."
}
}
---------------------------------------------------------------------------
[2025-02-07T19:31:21.909871], Orchestrator (-> FetchOnboardingSteps):
Please retrieve the detailed company-specific onboarding steps for onboarding a new IT employee at the Bengaluru location.
---------------------------------------------------------------------------
[2025-02-07T19:31:21.914419], Orchestrator (thought):
Next speaker FetchOnboardingSteps
---------------------------------------------------------------------------
[2025-02-07T19:31:21.929780], FetchOnboardingSteps:
Here are the onboarding steps:
Follow below steps to onboard a new employee.
1) Request for user approval for creating AD account
2) On user approval Create AD account or if user denies skip creating AD account and proceed with other steps
3) Create Remedy Account
4) Assign a Laptop
Proceeding with execution of these steps.
{
"timestamp": "2025-02-07T19:31:21.900520",
"prompt_tokens": 1649,
"completion_tokens": 258,
"type": "LLMCallEvent"
}
{
"timestamp": "2025-02-07T19:31:21.904449",
"source": "Orchestrator (thought)",
"message": "Updated Ledger:\n{\n \"is_request_satisfied\": {\n \"reason\": \"The onboarding process for Harshavardhan Chikkala has not yet been fully executed or confirmed as completed. Steps like creating accounts, laptop allocation, and other necessary onboarding tasks remain pending.\",\n \"answer\": false\n },\n \"is_in_loop\": {\n \"reason\": \"This is the first step in the process, and there is no evidence of repeated actions or responses.\",\n \"answer\": false\n },\n \"is_progress_being_made\": {\n \"reason\": \"We are starting the onboarding process by engaging the relevant team members to fetch the appropriate onboarding steps.\",\n \"answer\": true\n },\n \"next_speaker\": {\n \"reason\": \"FetchOnboardingSteps needs to provide the detailed onboarding steps specific to the company in order to proceed with the subsequent tasks.\",\n \"answer\": \"FetchOnboardingSteps\"\n },\n \"instruction_or_question\": {\n \"reason\": \"To ensure the onboarding process is aligned with company policies and covers all necessary tasks, detailed steps for onboarding an IT employee in Bengaluru are needed.\",\n \"answer\": \"Please retrieve the detailed company-specific onboarding steps for onboarding a new IT employee at the Bengaluru location.\"\n }\n}",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:31:21.909871",
"source": "Orchestrator (-> FetchOnboardingSteps)",
"message": "Please retrieve the detailed company-specific onboarding steps for onboarding a new IT employee at the Bengaluru location.",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:31:21.914419",
"source": "Orchestrator (thought)",
"message": "Next speaker FetchOnboardingSteps",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:31:21.929780",
"source": "FetchOnboardingSteps",
"message": "Here are the onboarding steps:\nFollow below steps to onboard a new employee.\n1) Request for user approval for creating AD account\n2) On user approval Create AD account or if user denies skip creating AD account and proceed with other steps\n3) Create Remedy Account\n4) Assign a Laptop\nProceeding with execution of these steps.",
"type": "OrchestrationEvent"
}
---------------------------------------------------------------------------
[2025-02-07T19:31:25.689915], Orchestrator (thought):
Updated Ledger:
{
"is_request_satisfied": {
"reason": "The onboarding process has not yet been fully completed, as only the onboarding steps have been retrieved and execution has just begun.",
"answer": false
},
"is_in_loop": {
"reason": "The process is moving forward with new actions being identified and steps being executed. There is no evidence of repetitive interactions.",
"answer": false
},
"is_progress_being_made": {
"reason": "The onboarding steps have been successfully retrieved and execution of those steps is beginning, which indicates forward progress.",
"answer": true
},
"next_speaker": {
"reason": "We need to begin the execution of the first step, which is requesting user approval for creating the AD account.",
"answer": "UserProxy"
},
"instruction_or_question": {
"reason": "The first step in the onboarding process is to seek user approval for creating the AD account.",
"answer": "Please confirm if we should proceed with creating Harshavardhan Chikkala's Active Directory account."
}
}
---------------------------------------------------------------------------
[2025-02-07T19:31:25.694888], Orchestrator (-> UserProxy):
Please confirm if we should proceed with creating Harshavardhan Chikkala's Active Directory account.
---------------------------------------------------------------------------
[2025-02-07T19:31:25.698181], Orchestrator (thought):
Next speaker UserProxy
User input ('exit' to quit): {
"timestamp": "2025-02-07T19:31:25.687954",
"prompt_tokens": 1753,
"completion_tokens": 235,
"type": "LLMCallEvent"
}
{
"timestamp": "2025-02-07T19:31:25.689915",
"source": "Orchestrator (thought)",
"message": "Updated Ledger:\n{\n \"is_request_satisfied\": {\n \"reason\": \"The onboarding process has not yet been fully completed, as only the onboarding steps have been retrieved and execution has just begun.\",\n \"answer\": false\n },\n \"is_in_loop\": {\n \"reason\": \"The process is moving forward with new actions being identified and steps being executed. There is no evidence of repetitive interactions.\",\n \"answer\": false\n },\n \"is_progress_being_made\": {\n \"reason\": \"The onboarding steps have been successfully retrieved and execution of those steps is beginning, which indicates forward progress.\",\n \"answer\": true\n },\n \"next_speaker\": {\n \"reason\": \"We need to begin the execution of the first step, which is requesting user approval for creating the AD account.\",\n \"answer\": \"UserProxy\"\n },\n \"instruction_or_question\": {\n \"reason\": \"The first step in the onboarding process is to seek user approval for creating the AD account.\",\n \"answer\": \"Please confirm if we should proceed with creating Harshavardhan Chikkala's Active Directory account.\"\n }\n}",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:31:25.694888",
"source": "Orchestrator (-> UserProxy)",
"message": "Please confirm if we should proceed with creating Harshavardhan Chikkala's Active Directory account.",
"type": "OrchestrationEvent"
}
UserProxy asked: Please confirm if we should proceed with creating Harshavardhan Chikkala's Active Directory account. in topic None
INFO 127.0.0.1:59238 - "POST /conversation HTTP/1.1" 200
MagenticOne initialized. user_input='yes' user_email='karunakaran.gn@kyncomdigiwasusdev.onmicrosoft.com' first_msg='no'
target_topic_id:: 12345/default
Sending response to UserProxy: yes
---------------------------------------------------------------------------
[2025-02-07T19:31:50.366056], UserProxy:
yes
{
"timestamp": "2025-02-07T19:31:50.366056",
"source": "UserProxy",
"message": "yes",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:31:54.788700",
"prompt_tokens": 310,
"completion_tokens": 139,
"type": "LLMCallEvent"
}
---------------------------------------------------------------------------
[2025-02-07T19:31:58.125385], Orchestrator (thought):
Initial plan:
We are working to address the following user request:
yes
To answer this request we have assembled the following team:
UserProxy: The current user interacting with you.
Coder: A helpful and general-purpose AI assistant that has strong language skills, Python skills, and Linux command line skills.
WeatherAgent: A weather agent that fetches summarized weather details for a location using an external API.
FetchOnboardingSteps: An agent that provides onboarding steps for new employees and follows the steps to onboard the employee
ADAccountRequest: An agent that creates AD accounts for new employees through an external API.
ServiceNowAccountRequest: An agent that creates ServiceNow accounts for new employees through an external API.
RemedyRequestAgent: An agent that creates Remedy requests for new employees through an external API.
LaptopRequest: An agent that assigns laptops to new employees through an external API.
CreateIncident: An agent that creates incident requests through an external API.
Here is an initial fact sheet to consider:
1. GIVEN OR VERIFIED FACTS
- "Yes" is the only given word in the request, and it provides no specific facts, figures, or context.
2. FACTS TO LOOK UP
- None explicitly mentioned in the request at this stage, as there is no additional context or sources referenced.
3. FACTS TO DERIVE
- The meaning or intent behind the singular affirmative word "yes" may need to be derived through contextual deduction, depending on subsequent elaboration or clarification.
4. EDUCATED GUESSES
- The user may be affirming readiness or agreement, or it could be a placeholder response indicating that further clarification or interaction is expected.
Here is the plan to follow as best as possible:
- Clarify the intent behind the original request ("yes") by prompting UserProxy for more context or details.
- Based on the clarification, determine which team members, if any, need to be activated to address the request.
- Proceed with the appropriate agent(s) based on the clarified purpose and ensure proper coordination.
- Monitor for further input or adjustments from UserProxy to refine the approach as necessary.
{
"timestamp": "2025-02-07T19:31:58.123184",
"prompt_tokens": 693,
"completion_tokens": 83,
"type": "LLMCallEvent"
}
{
"timestamp": "2025-02-07T19:31:58.125385",
"source": "Orchestrator (thought)",
"message": "Initial plan:\n\nWe are working to address the following user request:\n\nyes\n\n\nTo answer this request we have assembled the following team:\n\nUserProxy: The current user interacting with you.\nCoder: A helpful and general-purpose AI assistant that has strong language skills, Python skills, and Linux command line skills.\nWeatherAgent: A weather agent that fetches summarized weather details for a location using an external API.\nFetchOnboardingSteps: An agent that provides onboarding steps for new employees and follows the steps to onboard the employee\nADAccountRequest: An agent that creates AD accounts for new employees through an external API.\nServiceNowAccountRequest: An agent that creates ServiceNow accounts for new employees through an external API.\nRemedyRequestAgent: An agent that creates Remedy requests for new employees through an external API.\nLaptopRequest: An agent that assigns laptops to new employees through an external API.\nCreateIncident: An agent that creates incident requests through an external API.\n\n\n\nHere is an initial fact sheet to consider:\n\n1. GIVEN OR VERIFIED FACTS \n- \"Yes\" is the only given word in the request, and it provides no specific facts, figures, or context. \n\n2. FACTS TO LOOK UP \n- None explicitly mentioned in the request at this stage, as there is no additional context or sources referenced. \n\n3. FACTS TO DERIVE \n- The meaning or intent behind the singular affirmative word \"yes\" may need to be derived through contextual deduction, depending on subsequent elaboration or clarification. \n\n4. EDUCATED GUESSES \n- The user may be affirming readiness or agreement, or it could be a placeholder response indicating that further clarification or interaction is expected. \n\n\nHere is the plan to follow as best as possible:\n\n- Clarify the intent behind the original request (\"yes\") by prompting UserProxy for more context or details. \n\n- Based on the clarification, determine which team members, if any, need to be activated to address the request. \n\n- Proceed with the appropriate agent(s) based on the clarified purpose and ensure proper coordination. \n\n- Monitor for further input or adjustments from UserProxy to refine the approach as necessary.\n",
"type": "OrchestrationEvent"
}
---------------------------------------------------------------------------
[2025-02-07T19:32:01.640699], Orchestrator (thought):
Updated Ledger:
{
"is_request_satisfied": {
"reason": "The original request ('yes') provides no explicit context or detail to determine if any task has been completed or addressed.",
"answer": false
},
"is_in_loop": {
"reason": "There is no indication of repeated requests or responses yet; this is the initial interaction based on the current context.",
"answer": false
},
"is_progress_being_made": {
"reason": "Since the intent of 'yes' has not been clarified, no progress has been made yet.",
"answer": false
},
"next_speaker": {
"reason": "Additional context from UserProxy is necessary to understand the intent of their request.",
"answer": "UserProxy"
},
"instruction_or_question": {
"reason": "Clarifying the user's intent is essential to proceed and involve appropriate agents if necessary.",
"answer": "Could you please provide more details or clarify what you would like assistance with?"
}
}
---------------------------------------------------------------------------
[2025-02-07T19:32:01.645720], Orchestrator (-> UserProxy):
Could you please provide more details or clarify what you would like assistance with?
---------------------------------------------------------------------------
[2025-02-07T19:32:01.648145], Orchestrator (thought):
Next speaker UserProxy
{
"timestamp": "2025-02-07T19:32:01.637402",
"prompt_tokens": 1081,
"completion_tokens": 217,
"type": "LLMCallEvent"
}
{
"timestamp": "2025-02-07T19:32:01.640699",
"source": "Orchestrator (thought)",
"message": "Updated Ledger:\n{\n \"is_request_satisfied\": {\n \"reason\": \"The original request ('yes') provides no explicit context or detail to determine if any task has been completed or addressed.\",\n \"answer\": false\n },\n \"is_in_loop\": {\n \"reason\": \"There is no indication of repeated requests or responses yet; this is the initial interaction based on the current context.\",\n \"answer\": false\n },\n \"is_progress_being_made\": {\n \"reason\": \"Since the intent of 'yes' has not been clarified, no progress has been made yet.\",\n \"answer\": false\n },\n \"next_speaker\": {\n \"reason\": \"Additional context from UserProxy is necessary to understand the intent of their request.\",\n \"answer\": \"UserProxy\"\n },\n \"instruction_or_question\": {\n \"reason\": \"Clarifying the user's intent is essential to proceed and involve appropriate agents if necessary.\",\n \"answer\": \"Could you please provide more details or clarify what you would like assistance with?\"\n }\n}",
"type": "OrchestrationEvent"
}
{
"timestamp": "2025-02-07T19:32:01.645720",
"source": "Orchestrator (-> UserProxy)",
"message": "Could you please provide more details or clarify what you would like assistance with?",
"type": "OrchestrationEvent"
}
UserProxy asked: Could you please provide more details or clarify what you would like assistance with? in topic None
INFO 127.0.0.1:59260 - "POST /conversation HTTP/1.1" 200```
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have developed and deployed a multi-agent workflow as an API, which is integrated with a chatbot interface (Copilot Studio).
As part of the workflow, the service requires user approval before executing certain actions. I am successfully intercepting logs and passing UserProxy questions to the chatbot.
✅ Current Progress:
❌ Issue:
🔹 Expected Behavior:
🔹 Request:
kva_rest.py
joiner.py
Payload to initiate the flow,
{"user_input":"onboard a new employee Name: Harshavardhan Chikkala, Email: harshavardhan.chikkala@kyncomdigiwasusdev.onmicrosoft.com , Department: IT, Location: Bengaluru", "user_email":"karunakaran.gn@kyncomdigiwasusdev.onmicrosoft.com", "first_msg": "yes"}
payload to send response to the userProxy question
{"user_input":"yes", "user_email":"karunakaran.gn@kyncomdigiwasusdev.onmicrosoft.com", "first_msg": "no"}
Console logs on both payloads in sequesnce,
Beta Was this translation helpful? Give feedback.
All reactions