I implemented a multi agent architecture and put them on a graph.
Each agent has a goal on the graph, and once the goal is met, it makes transition.
The transition is a method from the agent, which checks if there is an edge from the current agent to a target agent. If so, it transfers to the next agent. Otherwise, it hang up the call.
The context isolation solved by injecting only instructions that each agent needs. And the chat history is copied between agents, conditionally, during a transition.