Skip to content

Lab 09 – Agent integration with Foundry IQ: Deprecated agent property error and MCP approval prompt not appearing #108

@madhanshiva

Description

@madhanshiva

Issue Description

While completing Lab 09: Integrate an AI agent with Foundry IQ (Python), I encountered two issues that appear to be caused by recent SDK/API updates.

Issue 1 – Deprecated agent property causes 400 error
Problem

When running:

python agent_client.py

The following error occurs on the first query:

Error: Error code: 400 - {
"error": {
"code": "invalid_payload",
"message": "The 'agent' property is deprecated. Use 'agent_reference' instead.",
"param": "agent",
"type": "invalid_request_error"
}
}
Cause

The lab instructions use this code:

response = openai_client.responses.create(
conversation=conversation.id,
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
input=""
)

Image

However, the current Foundry API no longer accepts the agent property. It now requires agent_reference at the top level of extra_body.

Workaround / Fix

Replace:

extra_body={"agent": {"name": agent.name, "type": "agent_reference"}}

With:

extra_body={
"agent_reference": {
"type": "agent_reference",
"name": agent.name
}
}

This change must be applied to both responses.create() calls in agent_client.py (initial response and post-approval response).

After this update, the application runs successfully.

Issue 2 – MCP approval prompt not appearing
Lab Instruction

The lab states:

When prompted for approval, type yes to allow the agent to search the knowledge base.

Observed Behavior

No MCP approval prompt appears. The agent directly retrieves information from the knowledge base and returns grounded responses with citations.

Example output includes citation markers such as:

Image

This confirms that Foundry IQ search is being executed successfully.

Likely Cause

It appears that:

Tool usage may now be auto-approved by default in the current Foundry environment

Or MCP approval behavior has changed since the lab was authored

As a result, the mcp_approval_request flow does not trigger, and users are never prompted to approve the search action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions