Description
Agent(client=FoundryChatClient(...)) works at runtime in hosted samples, but ty reports a type mismatch.
In our deployed sample this currently requires an inline ignore on the client=... argument.
This looks similar in spirit to prior static-type mismatches (for example #560), but this case is specifically about FoundryChatClient not satisfying the expected Agent client protocol in ty diagnostics.
Minimal repro
from agent_framework import Agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import DefaultAzureCredential
client = FoundryChatClient(
project_endpoint="https://example.services.ai.azure.com/api/projects/example",
model="gpt-5.2",
credential=DefaultAzureCredential(),
)
agent = Agent(
client=client,
instructions="You are a friendly assistant",
)
Observed ty diagnostic
error[invalid-argument-type]: Argument to bound method `__init__` is incorrect
Expected `SupportsChatGetResponse[...]`, found `FoundryChatClient[...]`
Runtime behavior
The same pattern runs successfully in hosted agent code paths; this appears to be a typing/protocol mismatch rather than a runtime incompatibility.
Environment
- OS: macOS
- Python: 3.13.13
- ty: 0.0.21
Relevant package versions
From sample agents/pyproject.toml:
agent-framework-core>=1.10.0
agent-framework-openai>=1.10.0
agent-framework-foundry>=1.10.0
agent-framework-foundry-hosting>=1.0.0a260630
agent-framework-orchestrations>=1.0.0
Request
Could you confirm whether this is an expected typing limitation with FoundryChatClient + Agent, or a bug in type annotations/protocol definitions? If it is a bug, a typing fix would help remove ignores from hosted sample code.
Description
Agent(client=FoundryChatClient(...))works at runtime in hosted samples, buttyreports a type mismatch.In our deployed sample this currently requires an inline ignore on the
client=...argument.This looks similar in spirit to prior static-type mismatches (for example #560), but this case is specifically about
FoundryChatClientnot satisfying the expectedAgentclient protocol intydiagnostics.Minimal repro
Observed
tydiagnosticRuntime behavior
The same pattern runs successfully in hosted agent code paths; this appears to be a typing/protocol mismatch rather than a runtime incompatibility.
Environment
Relevant package versions
From sample
agents/pyproject.toml:agent-framework-core>=1.10.0agent-framework-openai>=1.10.0agent-framework-foundry>=1.10.0agent-framework-foundry-hosting>=1.0.0a260630agent-framework-orchestrations>=1.0.0Request
Could you confirm whether this is an expected typing limitation with
FoundryChatClient+Agent, or a bug in type annotations/protocol definitions? If it is a bug, a typing fix would help remove ignores from hosted sample code.