ADK for TypeScript: API Reference
    Preparing search index...

    Function findMatchingFunctionCall

    • Returns the event containing the function call that the last event's function response(s) answer, by matching functionCall.id to functionResponse.id.

      Every function response in the last event is checked, not just the first one. A single event can carry responses answering calls from different agents at once -- for example two long-running operations from sibling sub-agents completing together and being resumed in one message. Resolving from only functionResponses[0] would silently attribute the rest to whichever agent's call happened to come first, which is the wrong agent for any response that isn't the first one: that response would then be processed under a resumed agent's context it was never meant for, and the agent it actually answers would never be correctly resumed at all.

      This is a pure lookup: responses with no id, or whose id matches no function call, are skipped rather than treated as an error, and when several responses resolve to calls from more than one distinct author, this does not throw -- it returns the last-resolved match by iteration order (whichever response is checked last wins). That is a change from the pre-existing behavior of resolving only functionResponses[0] (which effectively made the first response win): an external caller of findEventByLastFunctionResponseId can now get a different event, and a different id, than before this fix, even though determineAgentForResumption itself is unaffected, since it only reads .author and every distinct-author case is instead surfaced there as a thrown conflict (see getConflictingFunctionResponseAuthors) after that caller's own resumability gate, not from this function.

      Parameters

      Returns Event | undefined