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

self-imporving agent description with example code #1013

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions test/autogen/self_improve_agent.md
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)
```

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated accordingly.

## 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.