@langwatch/scenario
    Preparing search index...

    Function resolveAgentName

    • The name a run reports for an agent adapter.

      The adapter's own name comes first, without the space around it. A blank name counts as no name, so the class name of the adapter is used instead. An adapter written as a plain object has no class of its own, and an anonymous class carries no name either: both return undefined, and the run leaves the agent out of the list instead of reporting a name that means nothing. The Python SDK follows the same steps.

      Only a string counts as a name. A test double built by a mocking library answers every property with a function, and a JavaScript caller can set any value, so the type says less here than it does elsewhere. Reading a name raises nothing, whatever the adapter carries.

      Parameters

      • agent: AgentAdapter

        The adapter that takes part in the run. Its name may come from the class body, from the instance, or not at all.

      Returns string | undefined

      The name to report, or undefined when the adapter carries no usable name: a blank name on a plain object, or an anonymous class.

      class SupportAgent extends AgentAdapter {}
      resolveAgentName(new SupportAgent()); // "SupportAgent"
      resolveAgentName({ name: " Support ", ... }); // "Support"
      resolveAgentName({ role: AgentRole.AGENT, ... }); // undefined