Skip to content

Python: Bug: Azure AI Search samples missing required source_id parameter #3945

Closed

Description

@pamelafox

Description

The Azure AI Search sample files don't pass the required source_id positional argument to AzureAISearchContextProvider.__init__(), causing a TypeError at runtime.

Steps to reproduce

Run either of the sample files:

  • python/samples/02-agents/context_providers/azure_ai_search/azure_ai_with_search_context_agentic.py
  • python/samples/02-agents/context_providers/azure_ai_search/azure_ai_with_search_context_semantic.py

Error

TypeError: AzureAISearchContextProvider.__init__() missing 1 required positional argument: 'source_id'

Root cause

AzureAISearchContextProvider inherits from BaseContextProvider, which requires source_id as the first positional argument.

The constructor signature is:

def __init__(self, source_id: str, endpoint: str | None = None, ...)

But the samples construct it without source_id:

search_provider = AzureAISearchContextProvider(
    endpoint=search_endpoint,
    ...
)

Fix

Either:

  1. Add source_id to the sample calls, e.g. AzureAISearchContextProvider(source_id="azure-ai-search", endpoint=..., ...)
  2. Or give source_id a default value in AzureAISearchContextProvider.__init__() (e.g. source_id: str = "azure-ai-search")

Option 2 would be more user-friendly since the other built-in providers don't require callers to invent an ID.

Activity

  1. changed the title [-]Bug: Azure AI Search samples missing required `source_id` parameter[/-] [+]Python: Bug: Azure AI Search samples missing required `source_id` parameter[/+] on Feb 16, 2026
  2. added
    agentsUsage: [Issues, PRs], Target: Single agent
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Feb 16, 2026
  3. moved this from In Review to Done in Agent Frameworkon Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions