MS Foundry: Workflow failing to invoke agent when the agent is created with the Python SDK: "The requested operation requires an element of type 'Object', but the target element has type 'Array'."
Hi,
I created a workflow in MS Foundry that uses an agent that I created with the Python SDK. I used sample code on https://learn.microsoft.com/en-us/azure/ai-foundry/agents/quickstart?view=foundry-classic&viewFallbackFrom=foundry&context=%2Fazure%2Fai-foundry%2Fcontext%2Fcontext&pivots=programming-language-python-azure as a model. However, I get the error "The requested operation requires an element of type 'Object', but the target element has type 'Array'." in the workflow where the only thing the workflow does is call that agent.
How do I resolve this error? I suspect I have to set an additional property on PromptAgentDefinition when creating the agent since I do not have this problem with an agent created in Portal, but I'm not sure which parameter. Here's my code.
mcp_kb_tool = MCPTool(
server_label = "knowledge-base",
server_url = mcp_endpoint,
require_approval = "never",
allowed_tools = ["knowledge_base_retrieve"],
project_connection_id = project_connection_name
)
agent = project_client.agents.create_version(
agent_name = agent_name,
definition = PromptAgentDefinition(
model = agent_model,
instructions = instructions,
tools = [mcp_kb_tool]
)
)
Thanks in advance!