Workspace/Coding labs
Loading progress

Select a compatible advertised interface

Intermediate65 min

Implement a selector for an already parsed, trusted-location **partial A2A 1.0 card**. Find exactly one requested skill. Its inputModes, when present, override defaultInputModes. Enforce any streaming requirement. Return a copy of the first interface whose (protocolBinding, protocolVersion) is in the client's supported pairs, or None. Preserve advertised preference order. This is a compatibility exercise, not complete schema, security, or protocol validation. It performs no discovery requests.

Your task

  1. Complete the starter function using the contract above.
  2. Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
  3. Run tests to record your result, then compare with the explained reference solution.

Examples

EXAMPLE 1

Inputreview + text/plain + {(JSONRPC, 1.0)}

OutputThe first matching 1.0 interface

Skill, input mode, capability, and interface must all satisfy the request.
EXAMPLE 2

InputA skill with inputModes=[] and defaultInputModes=[text/plain]

OutputNone

An explicit skill override is respected even when empty.
solution.pyPython 3.12