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 agent server management functions #239

Merged
merged 42 commits into from
Jul 17, 2024

Conversation

pan-x-c
Copy link
Collaborator

@pan-x-c pan-x-c commented May 21, 2024

Description

In the old version, the rpc agent server only has a call_func method, and all agents' own methods and agent server management related methods need to be implemented through the call_func, making this method bloated.

This PR adds a series of agent server management functions (used to support agent server management modules), and extracts management related methods from the original call_func interface.

All agent server management functions are listed below:

  • is_alive: whether the server is alive
  • stop: stop the server
  • create_agent: create a new agent on the server
  • delete_agent: delete agents from the server
  • clone_agent: clone an agent with specific agent_id
  • delete_all_agent: delete all agents on the server
  • get_agent_list: get a list of all agents' summary information
  • get_server_info: get the resource utilization information of the server
  • set_model_configs: update the model configs of the server
  • get_agent_memory: get the memory of a specific agent on the server
  • download_file: download a file from the server

Each method above is implemented independently and doesn't use the original call_func method.

The original call_func is renamed to call_agent_func, and only handle method calls of the agent itself.
The placeholder update method is also extracted from the original call_func method as a separate update_placeholder method.

This PR makes the rpc messages used by each method more compact. Tests show that it can reduce the running time of large-scale simulation example by 5 - 10%.

Unittests and tutorials have been updated accordingly.

A preliminary version of the server manager page has been added to AgentScope Studio.

server_manager

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@pan-x-c pan-x-c changed the title Add agent server management functions [WIP] Add agent server management functions May 21, 2024
@pan-x-c pan-x-c changed the title [WIP] Add agent server management functions Add agent server management functions May 21, 2024
@pan-x-c pan-x-c self-assigned this May 21, 2024
@pan-x-c pan-x-c added enhancement New feature or request ready for review labels May 21, 2024
Copy link
Collaborator

@DavdGao DavdGao left a comment

Choose a reason for hiding this comment

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

Plz see inline comments

docs/sphinx_doc/zh_CN/source/tutorial/208-distribute.md Outdated Show resolved Hide resolved
src/agentscope/agents/agent.py Outdated Show resolved Hide resolved
src/agentscope/exception.py Show resolved Hide resolved
src/agentscope/message.py Outdated Show resolved Hide resolved
src/agentscope/server/launcher.py Show resolved Hide resolved
src/agentscope/server/servicer.py Show resolved Hide resolved
src/agentscope/server/servicer.py Outdated Show resolved Hide resolved
src/agentscope/server/servicer.py Outdated Show resolved Hide resolved
src/agentscope/studio/_app.py Show resolved Hide resolved
Copy link
Collaborator

@DavdGao DavdGao left a comment

Choose a reason for hiding this comment

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

lgtm

@DavdGao DavdGao merged commit b7f2dc1 into modelscope:main Jul 17, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants