-
Notifications
You must be signed in to change notification settings - Fork 508
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
self-imporving agent description with example code #1013
Draft
qingyun-wu
wants to merge
3
commits into
main
Choose a base branch
from
self-improving-agent
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Self-Improving Agent | ||
This code describes a scenario where an agent (SIAgent) is designed to be able to interact with a user and self-improve. | ||
|
||
The code is divided into two modes: User mode and Dev mode. The user mode provides a basic interaction between the SIAgent and the user agent, while the Dev mode involves an expert agent for verifying the correctness of the answers provided by a SIAgent. | ||
|
||
## User mode | ||
In User mode, the SIAgent use `receive` the function call to receive questions from users and answer the questions. It attempts to answer the question with existing apis and will try to add new apis if the question cannot be answered by existing ones properly. | ||
|
||
```python | ||
# An SIAgent that performs self-improvement by default | ||
api_agent =SIAgent("api_agent", self_improve=True, context="api.json") | ||
|
||
# User mode | ||
user = HumanAgent("human user") | ||
# Question from the user | ||
question = "What if we must go from node 1 to node 2?" | ||
# the api_agent will communicate with the user | ||
api_agent.receive(question, user) | ||
# the api_agent will either answer the question (with the existing api or newly created api), or ask for more information from the user (e.g., to clarify the question) | ||
``` | ||
|
||
## Dev mode | ||
In Dev mode, the expert agent verifies the correctness of the answer provided by the SIAgent. The process continues until the expert agent is satisfied with the answer (the verification returns "correct") or an interaction number upper limit is reached. Once the expert agent is satisfied, the SIAgent has successfully answered the question. | ||
|
||
```python | ||
# Dev mode with an expert agent (could be an LLM or human) | ||
expert = ExpertAgent("expert") | ||
# The SIAgent shall communicate with the expert | ||
api_agent.receive(question, expert) | ||
``` | ||
|
||
## User experience after the receive function call | ||
To answer the question | ||
"Describe what happens after the receive call | ||
To be more specific, do we want to assume what experience happens after receive()? For example, like ChatGPT, like AutoGPT, or neither, or both." | ||
|
||
Option 1: ChatGPT | ||
Conversation between the user and an SiAgent similar to the conversation between the user and ChatGPT. | ||
|
||
Option 2: autoGPT | ||
An SIAgent show the progress of the task execution and have pre-defined messages to ask for more information (or permission to continue) from the user | ||
|
||
Option 3: branching conversation model | ||
|
||
The SIAgent initiates multiple conversation sessions or threads, allowing for diverse paths to be considered simultaneously. Agent B then has the option to selectively engage with one or more of these threads, leading to a potentially rich and varied conversation. As the conversation progresses, it can continue to branch out as new responses or subthreads are introduced, creating a dynamic and non-linear dialogue structure. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe what happens after the
receive
call.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more specific, do we want to assume what experience happens after
receive()
? For example, like ChatGPT, like AutoGPT, or neither, or both.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated accordingly.