Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add structured planning agent #13149

Merged
merged 6 commits into from Apr 30, 2024
Merged

add structured planning agent #13149

merged 6 commits into from Apr 30, 2024

Conversation

logan-markewich
Copy link
Collaborator

This PR adds a new AgentRunner that works with any agent worker to

  • create an initial plan to accomplish a given task
  • can run steps concurrently when they share no dependencies
  • refines the plan after each step

There is also a very comprehensive notebook added that details how it works for both high-level and low-level APIs.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Apr 29, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@logan-markewich
Copy link
Collaborator Author

TODO: add some unit tests for sanity

Copy link
Collaborator

@jerryjliu jerryjliu left a comment

Choose a reason for hiding this comment

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

This is cool. I like that structured planning on the agent runner allows us to do orchestration optimizations. Some high-level comments:

  • [future] Would be good to communicate in the docs when developers should use a structured planning agent runner vs. a regular agent runner. I see two situations:

    • they're deciding what agent runner to use with a prepackaged agent worker, like ReAct. maybe they don't know/don't care and just want something to work
    • they're trying to build a custom agent. what logic should they put in the agent worker, and how does using structured planning vs. regular agent runner affect that. i'm assuming they're not meant to customize the agent runner?
  • you prob already know this, but implementing LATS doesn't really fit into this structured planning abstraction. any plan generated in the structured runner is a deterministic DAG. but in LATS it's really about planning out an entire distribution of possible futures from the given state (instead of just one in the deterministic case), and figuring out which future we should rollout each stage. wonder if an MCTS agent runner would eventually make sense

llama-index-core/llama_index/core/agent/runner/planner.py Outdated Show resolved Hide resolved
@logan-markewich
Copy link
Collaborator Author

I think in general, users could definitely customize the agent runner. In particular, the create_tasks and refine_plan functions could be overridden to implement custom planning logic.

That might make a fun "from scratch" notebook later, something that plans a simple list of tasks (would be easier for open-source LLMs to do)

@logan-markewich logan-markewich merged commit af8c8eb into main Apr 30, 2024
8 checks passed
@logan-markewich logan-markewich deleted the logan/agent_planning branch April 30, 2024 15:33
JuHyung-Son pushed a commit to UpstageAI/llama_index that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants