#Question about MultiAgent Setups and access State

1 messages · Page 1 of 1 (latest)

noble spindle
#

Currently reading the docs.

In multiagent setups , since there is a router mode and a lock mode

Question 1 :

I was wondering how / if accessing the agent state works in router mode for example since different agents can be chosen

So lets say i have 3 agents can I still acces the state with the given hooks in this example ?

https://docs.copilotkit.ai/coagents/generative-ui/agentic?language=TypeScript

( useCoAgentStateRender , useCoAgent )

Question 2 :

Would sequential flows also work with a router setup ?

Lets say I have a prompt 1. fetch some info 2. calculate something

which would require a sequential flow of first calling agent 1 and then agent 2... would this work if I have multiple Co-Agents added in my backend ?

or will it only pick 1 agent ?

My goal is basically to have a mult agent setup with sequential flows that can
call like
0. Supervisor decide what agent to call

  1. AgentA --> calll some tools
    1.1 Supervisor check result
  2. AgentB --> call some more tools
    2.1 Supervisor check result
  3. End

is this pattern achievable through router mode ?

or would it be stuck like this

  1. AgentA --> calll some tools
  2. End ( Agent B never called because only ever 1 agent is selected and run)

In that case would I need to create a hirarchial aproach with a single agent ( through lock) mode
that achieves sequential agent flows ? In that case iam even less sure if I cann still acces the agents output / state at runtime . Any pointers appriciated .. looking for the correct high level aproach here

Currently Iam only familiar with langgraph abit .

Greetings 🙂

near portal
#

You can access any agent’s state in Router Mode using useCoAgent and useCoAgentStateRender, and you can use copilotkitExit in your agent logic to let the router pick the next agent.

Use the same hooks (useCoAgent, useCoAgentStateRender) in Router Mode as in single-agent setups to access agent state.
To let the router move to another agent after one finishes, call copilotkitExit in your agent logic ( exit-agent.mdx).

For sequential flows:

By default, CopilotKit’s router selects the most suitable agent for each user query; it does not automatically chain AgentA to AgentB in sequence. Therefore, you can think of the CopilotKit agent as the supervisor, to which you can provide all your agents. The CopilotKit agent will then determine the appropriate agent to call and will respond accordingly.

If you want a custom supervisor-agent workflow, you should implement that logic inside a single “supervisor” agent and register only that agent with CopilotKit.

noble spindle
#

Awesome Tony thanks . Just what i needed to know

noble spindle