Skip to content

Conversation

@luiarthur
Copy link
Collaborator

No description provided.

@luiarthur
Copy link
Collaborator Author

@mikegros This draft demonstrates how to include the planning and execution agents in a supervisor agent (that I call Ursa).

Changes:

  • src/agents/excution_agent.py
    • minor change to aid type checking
  • src/experimental/agents/multiagent.py contains
    • a system prompt for the supervisor
    • tool wrapped execution and planning agents
    • an additional tool that handles splitting plan steps into different execution agent calls
  • tests/agents/test_multiagent/test_multiagent.py
    • a test/demo

A good way to start reviewing the changes would be to pull the branch and then try to run test_multiagent.py by running from the root directory

pytest -s tests/agents/test_multiagent

@mikegros mikegros self-assigned this Dec 19, 2025
@mikegros mikegros self-requested a review December 19, 2025 01:53
@mikegros
Copy link
Collaborator

I think this looks great overall. A couple things:

  • I like having a main agent names Ursa
  • I think the type checking in the execute agent may be a little strict. I saw that you needed extra_tools to be a list of BaseTools - I assume that a StructuredTool counts as a BaseTool, but the add_tools capability also can take just plain functions, which is part of why the typing was originally a Callable. I think that was wrong (that we wanted it to be a Callable or some sort of tool object), but I think requiring just a BaseAgent might not be ideal (that said, extra_tools might be a weird thing to have anyway since we have the add tools method.

llm: BaseChatModel,
agent_memory: Optional[Any | AgentMemory] = None,
log_state: bool = False,
extra_tools: Optional[list[Callable[..., Any]]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in the PR

@luiarthur
Copy link
Collaborator Author

@mikegros Thanks for reviewing! My main hesitation with this PR is I don't know if the memory is being properly handled. In this implementation, the Ursa agent retains memory; no other agents retain memory. Since the outputs of subagents are returned to the Ursa agent, I would assume there's no need to pass around the history to other agents. Does that make sense?

@mikegros
Copy link
Collaborator

mikegros commented Jan 5, 2026

@mikegros Thanks for reviewing! My main hesitation with this PR is I don't know if the memory is being properly handled. In this implementation, the Ursa agent retains memory; no other agents retain memory. Since the outputs of subagents are returned to the Ursa agent, I would assume there's no need to pass around the history to other agents. Does that make sense?

I will look at that closer, but as a quick response, you could give all the tool agents the same checkpointer database, as long as they all have their own thread_id (which is the way the CLI handles checkpointing). Then they could all keep a message history.

luiarthur and others added 9 commits January 5, 2026 16:46
Alex's recent refactor got rid of the _action method and made invoke a method of each agent directly.
Removed _action and this should pass the other CI tests.
Co-authored-by: lui-arthur
There was one I missed on the planning agent.
Co-authored-by: lui-arthur
- Passing checkpointer to the subagents so that they can keep a history.
- Fixed a JSON Decode Error that could happen on the LLM output.
    - Removed some potential bad character passing to json.loads
@luiarthur luiarthur marked this pull request as ready for review January 21, 2026 19:25
Copy link
Collaborator

@mikegros mikegros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt realize I had filled out this review but not submitted it. I think this is mostly good to merge. Especially since it is listed as "experimental" so if memory aspects aren't being handled ideally, that can be part of the iteration that happens between now and when we would make it no-longer-experimental.

return call_agent


class Ursa:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this inherit BaseAgent for usage metrics or anything else?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about this, so I dont think we need to make any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants