Test and troubleshoot delegation

Completed

A connected agent is useful only when the orchestrator sends it the right requests and keeps other requests with the primary agent. In this unit, you learn how to test delegation in Preview, review the activity trace, edit or remove a connected agent, and troubleshoot requests that reach the wrong agent.

Test delegation

Test both sides of each connection: messages that belong to the connected agent, and messages that don't.

  1. In the primary agent, select the Preview tab.
  2. Send a message that matches the connected agent's domain.
  3. Verify that the response comes from the connected agent and is appropriate.
  4. Send a message outside the connected agent's domain, and confirm that the primary agent handles it.

Repeat the test for each connected agent. Include at least one message close to the boundary between two domains. In the example, "My laptop won't connect to the VPN" belongs to the IT support agent, "When does benefits enrollment open?" belongs to the HR benefits agent, and "Where's the cafeteria menu?" stays with the help agent. A message such as "I need to update my health plan in the HR portal, but I can't sign in" touches both domains, so it shows how the orchestrator handles overlap.

Testing in Preview might consume Copilot Credits.

Review the activity trace

The activity trace shows the steps the primary agent takes to respond to each message. It appears in Preview when the End user preview toggle is off. Select a step to see its details, and use the trace to navigate to the related item on the Build tab.

When a response doesn't come from the agent you expected, use the trace to see which steps ran before the response. Then compare those steps with the routing inputs: the connected agent's description, the user's message, and the primary agent's instructions.

Edit a connected agent

After a test, you often revise a description. To edit a connected agent:

  1. On the Build tab, under Connected agents, select the connected agent. The Edit connected agent dialog opens.
  2. Update the Name or Description. The Type field shows the kind of agent.
  3. Select Save.

Rerun your Preview test messages after each change, so you confirm that the fix works and doesn't move another request type to the wrong agent.

Remove a connected agent

To stop delegating to an agent, select the X next to the agent under Connected agents, and then select Remove.

Removing a connected agent ends the delegation relationship only. It doesn't delete the connected agent itself.

Troubleshoot routing

When delegation doesn't behave as expected, match the symptom to what you check:

Symptom What to check
The primary agent answers a request that belongs to a connected agent. Make the connected agent's description clearer and more specific. Review the primary agent's instructions for guidance that conflicts with the connected agent's domain.
A request goes to the wrong connected agent. Look for overlap between the descriptions of the connected agents, and make each one name a distinct domain.
A request that the primary agent should handle is delegated. Narrow the connected agent's description so it doesn't claim general requests.
You can't connect the agent you want. Confirm that the agent is powered by the GitHub Copilot harness, is in the same environment, has Allow other agents to connect turned on, is published after that change, and is shared with you.

After each change, test again in Preview with both in-domain and out-of-domain messages.

Reflect: List three test messages for one of your connected agents: one clearly in its domain, one clearly outside it, and one near the boundary with another agent.