Skip to content

Add RemoteAgent and Receiver#1289

Closed
jackgerrits wants to merge 5 commits into
microsoft:mainfrom
jackgerrits:remote_agents
Closed

Add RemoteAgent and Receiver#1289
jackgerrits wants to merge 5 commits into
microsoft:mainfrom
jackgerrits:remote_agents

Conversation

@jackgerrits

@jackgerrits jackgerrits commented Jan 16, 2024

Copy link
Copy Markdown
Contributor

This is a proof of concept of one way agents could communicate remotely. In the current design, the app must know the host and port of each remote agent it must be able to communicate with. This could in time be replaced with some kind of distributed directory (or just DNS).

Since I only implemented the Agent interface, there were a few issues found where the Agent type is used, but there are more requirements than just this type. Such as the following methods being required reset_consecutive_auto_reply_counter, reply_at_receive, clear_history

It also currently uses HTTP calls to send messages and uses Python's http.server module which definitely should not be used in production. It should be replaced with either a different server, or a different technology entirely. ZMQ, GPRC etc

Known issues:

  • Termination does not work correctly
  • RequestReply is hardcoded to true by the receiver (hacky support for "TERMINATE" added)

TODO:

  • Separate sample out into separate example
receiver = Receiver(port=45553)

rajans_cal = ConversableAgent(
    "rajans_cal",
    llm_config={"config_list": config_list},
    system_message="..."
)
jacks_cal = RemoteAgent("jacks_cal", host="localhost", port=45554)

receiver.register_agent(rajans_cal)
receiver.start()

rajans_cal.initiate_chat(jacks_cal, message="...", clear_history=False)

Example of two remote agents coordinating to determine a common meeting time for two users:
Screenshot 2024-01-16 at 2 54 06 PM

Screen.Recording.2024-01-18.at.10.11.05.AM.mov

First two turns:
image

@codecov-commenter

codecov-commenter commented Jan 16, 2024

Copy link
Copy Markdown

Codecov Report

Attention: 55 lines in your changes are missing coverage. Please review.

Comparison is base (563b1bb) 32.08% compared to head (7ac7186) 41.82%.
Report is 9 commits behind head on main.

Files Patch % Lines
autogen/agentchat/receiver.py 30.76% 36 Missing ⚠️
autogen/agentchat/remote_agent.py 47.22% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1289      +/-   ##
==========================================
+ Coverage   32.08%   41.82%   +9.73%     
==========================================
  Files          32       35       +3     
  Lines        4394     4512     +118     
  Branches     1025     1090      +65     
==========================================
+ Hits         1410     1887     +477     
+ Misses       2867     2476     -391     
- Partials      117      149      +32     
Flag Coverage Δ
unittests 41.75% <38.88%> (+9.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ekzhu ekzhu mentioned this pull request Jan 16, 2024
3 tasks
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.

2 participants