agentscope package
Subpackages
- agentscope.agents package
- Submodules
- Module contents
- agentscope.manager package
- Module contents
FileManager
FileManager.__init__()
FileManager.initialize()
FileManager.embedding_cache_dir
FileManager.file_dir
FileManager.code_dir
FileManager.invoke_dir
FileManager.get_instance()
FileManager.save_api_invocation()
FileManager.save_python_code()
FileManager.save_image()
FileManager.save_file()
FileManager.save_runtime_information()
FileManager.cache_text_embedding()
FileManager.fetch_cached_text_embedding()
FileManager.state_dict()
FileManager.load_dict()
FileManager.is_initialized()
FileManager.flush()
ModelManager
ModelManager.get_instance()
ModelManager.__init__()
ModelManager.model_configs
ModelManager.initialize()
ModelManager.clear_model_configs()
ModelManager.load_model_configs()
ModelManager.get_model_by_config_name()
ModelManager.get_config_by_name()
ModelManager.state_dict()
ModelManager.load_dict()
ModelManager.flush()
MonitorManager
MonitorManager.path_db
MonitorManager.__init__()
MonitorManager.initialize()
MonitorManager.get_instance()
MonitorManager.update_image_tokens()
MonitorManager.update_text_and_embedding_tokens()
MonitorManager.print_llm_usage()
MonitorManager.show_image_tokens()
MonitorManager.show_text_and_embedding_tokens()
MonitorManager.rm_database()
MonitorManager.state_dict()
MonitorManager.load_dict()
MonitorManager.flush()
ASManager
- Module contents
- agentscope.memory package
- agentscope.message package
- Submodules
- Module contents
Msg
PlaceholderMessage
PlaceholderMessage.__init__()
PlaceholderMessage.id
PlaceholderMessage.name
PlaceholderMessage.content
PlaceholderMessage.role
PlaceholderMessage.url
PlaceholderMessage.metadata
PlaceholderMessage.timestamp
PlaceholderMessage.update_value()
PlaceholderMessage.to_dict()
PlaceholderMessage.from_dict()
- agentscope.models package
- Submodules
- agentscope.models.dashscope_model module
- agentscope.models.gemini_model module
- agentscope.models.litellm_model module
- agentscope.models.model module
- agentscope.models.ollama_model module
- agentscope.models.openai_model module
- agentscope.models.post_model module
- agentscope.models.response module
- agentscope.models.yi_model module
- agentscope.models.zhipu_model module
- Module contents
ModelWrapperBase
ModelResponse
PostAPIModelWrapperBase
PostAPIChatWrapper
OpenAIWrapperBase
OpenAIChatWrapper
OpenAIDALLEWrapper
OpenAIEmbeddingWrapper
DashScopeChatWrapper
DashScopeImageSynthesisWrapper
DashScopeTextEmbeddingWrapper
DashScopeMultiModalWrapper
OllamaChatWrapper
OllamaEmbeddingWrapper
OllamaGenerationWrapper
GeminiChatWrapper
GeminiEmbeddingWrapper
ZhipuAIChatWrapper
ZhipuAIEmbeddingWrapper
LiteLLMChatWrapper
YiChatWrapper
- Submodules
- agentscope.parsers package
- Submodules
- Module contents
- agentscope.pipelines package
- agentscope.prompt package
- agentscope.rag package
- agentscope.rpc package
- Submodules
- Module contents
RpcAgentClient
RpcAgentClient.__init__()
RpcAgentClient.call_agent_func()
RpcAgentClient.is_alive()
RpcAgentClient.stop()
RpcAgentClient.create_agent()
RpcAgentClient.delete_agent()
RpcAgentClient.delete_all_agent()
RpcAgentClient.clone_agent()
RpcAgentClient.update_placeholder()
RpcAgentClient.get_agent_list()
RpcAgentClient.get_server_info()
RpcAgentClient.set_model_configs()
RpcAgentClient.get_agent_memory()
RpcAgentClient.download_file()
ResponseStub
RpcMsg
RpcAgentServicer
RpcAgentServicer.is_alive()
RpcAgentServicer.stop()
RpcAgentServicer.create_agent()
RpcAgentServicer.delete_agent()
RpcAgentServicer.delete_all_agents()
RpcAgentServicer.clone_agent()
RpcAgentServicer.get_agent_list()
RpcAgentServicer.get_server_info()
RpcAgentServicer.set_model_configs()
RpcAgentServicer.get_agent_memory()
RpcAgentServicer.call_agent_func()
RpcAgentServicer.update_placeholder()
RpcAgentServicer.download_file()
RpcAgentStub
call_in_thread()
add_RpcAgentServicer_to_server()
- agentscope.server package
- Submodules
- Module contents
RpcAgentServerLauncher
AgentServerServicer
AgentServerServicer.__init__()
AgentServerServicer.get_task_id()
AgentServerServicer.agent_exists()
AgentServerServicer.get_agent()
AgentServerServicer.is_alive()
AgentServerServicer.stop()
AgentServerServicer.create_agent()
AgentServerServicer.delete_agent()
AgentServerServicer.clone_agent()
AgentServerServicer.delete_all_agents()
AgentServerServicer.call_agent_func()
AgentServerServicer.update_placeholder()
AgentServerServicer.get_agent_list()
AgentServerServicer.get_server_info()
AgentServerServicer.set_model_configs()
AgentServerServicer.get_agent_memory()
AgentServerServicer.download_file()
as_server()
- agentscope.service package
- Subpackages
- Submodules
- Module contents
ServiceResponse
ServiceExecStatus
ServiceToolkit
get_help()
execute_python_code()
execute_shell_command()
create_file()
delete_file()
move_file()
create_directory()
delete_directory()
move_directory()
list_directory_content()
get_current_directory()
read_text_file()
write_text_file()
read_json_file()
write_json_file()
bing_search()
google_search()
arxiv_search()
wikipedia_search()
wikipedia_search_categories()
query_mysql()
query_sqlite()
query_mongodb()
cos_sim()
summarization()
retrieve_from_list()
digest_webpage()
load_web()
parse_html_to_text()
download_from_url()
dblp_search_publications()
dblp_search_authors()
dblp_search_venues()
NoteBookExecutor
dashscope_image_to_text()
dashscope_text_to_image()
dashscope_text_to_audio()
openai_audio_to_text()
openai_text_to_audio()
openai_text_to_image()
openai_image_to_text()
openai_edit_image()
openai_create_image_variation()
tripadvisor_search()
tripadvisor_search_location_photos()
tripadvisor_search_location_details()
WebBrowser
WebBrowser.__init__()
WebBrowser.url
WebBrowser.page_html
WebBrowser.page_title
WebBrowser.page_markdown
WebBrowser.page_screenshot
WebBrowser.action_click()
WebBrowser.action_type()
WebBrowser.action_scroll_up()
WebBrowser.action_scroll_down()
WebBrowser.action_press_key()
WebBrowser.action_visit_url()
WebBrowser.get_action_functions()
WebBrowser.set_interactive_marks()
WebBrowser.remove_interactive_marks()
WebBrowser.close()
WebElementInfo
WebElementInfo.html
WebElementInfo.tag_name
WebElementInfo.node_name
WebElementInfo.node_value
WebElementInfo.type
WebElementInfo.aria_label
WebElementInfo.is_clickable
WebElementInfo.meta_data
WebElementInfo.inner_text
WebElementInfo.origin_x
WebElementInfo.origin_y
WebElementInfo.width
WebElementInfo.height
WebElementInfo.model_computed_fields
WebElementInfo.model_config
WebElementInfo.model_fields
ServiceFactory
- agentscope.strategy package
- agentscope.studio package
- agentscope.utils package
- agentscope.web package
Submodules
- agentscope.constants module
- agentscope.exception module
ResponseParsingError
JsonParsingError
JsonDictValidationError
JsonTypeError
RequiredFieldNotFoundError
TagNotFoundError
FunctionCallError
FunctionCallFormatError
FunctionNotFoundError
ArgumentNotFoundError
ArgumentTypeError
StudioError
StudioRegisterError
AgentServerError
AgentServerNotAliveError
AgentCreationError
AgentCallError
QuotaExceededError
- agentscope.logging module
- agentscope.msghub module
- agentscope.serialize module
Module contents
Import all modules in the package.
- agentscope.init(model_configs: dict | str | list | None = None, project: str | None = None, name: str | None = None, disable_saving: bool = False, save_dir: str = './runs', save_log: bool = True, save_code: bool = True, save_api_invoke: bool = False, cache_dir: str = '/home/runner/.cache/agentscope', use_monitor: bool = True, logger_level: Literal['TRACE', 'DEBUG', 'INFO', 'SUCCESS', 'WARNING', 'ERROR', 'CRITICAL'] = 'INFO', runtime_id: str | None = None, agent_configs: dict | str | list | None = None, studio_url: str | None = None) Sequence[AgentBase] [source]
A unified entry to initialize the package, including model configs, runtime names, saving directories and logging settings.
- Parameters:
model_configs (Optional[Union[dict, str, list]], defaults to None) – A dict, a list of dicts, or a path to a json file containing model configs.
project (Optional[str], defaults to None) – The project name, which is used to identify the project.
name (Optional[str], defaults to None) – The name for runtime, which is used to identify this runtime.
disable_saving (bool, defaults to False) – Whether to disable saving files. If True, this will override the save_log, save_code, and save_api_invoke parameters.
runtime_id (Optional[str], defaults to None) – The id for runtime, which is used to identify this runtime. Use None will generate a random id.
save_dir (str, defaults to ./runs) – The directory to save logs, files, codes, and api invocations. If dir is None, when saving logs, files, codes, and api invocations, the default directory ./runs will be created.
save_log (bool, defaults to False) – Whether to save logs locally.
save_code (bool, defaults to False) – Whether to save codes locally.
save_api_invoke (bool, defaults to False) – Whether to save api invocations locally, including model and web search invocation.
cache_dir (str) – The directory to cache files. In Linux/Mac, the dir defaults to
Windows ( In)
to (the dir defaults)
`C –
users<username>.cacheagentscope`.
use_monitor (bool, defaults to True) – Whether to activate the monitor.
logger_level (LOG_LEVEL, defaults to “INFO”) – The logging level of logger.
agent_configs (Optional[Union[str, list, dict]], defaults to None) – The config dict(s) of agents or the path to the config file, which can be loaded by json.loads(). One agent config should cover the required arguments to initialize a specific agent object, otherwise the default values will be used.
studio_url (Optional[str], defaults to None) – The url of the agentscope studio.
- agentscope.msghub(participants: Sequence[AgentBase], announcement: Sequence[Msg] | Msg | None = None) MsgHubManager [source]
msghub is used to share messages among a group of agents.
- Parameters:
participants (Sequence[AgentBase]) – A Sequence of participated agents in the msghub.
announcement (Optional[Union[list[Msg], Msg]], defaults to None) – The message that will be broadcast to all participants at the very beginning without requiring response.
Example
In the following code, we create a msghub with three agents, and each message output by agent1, agent2, agent3 will be passed to all other agents, that’s what we mean msghub.
with msghub(participant=[agent1, agent2, agent3]): agent1() agent2()
Actually, it has the same effect as the following code, but much more easy and elegant!
x1 = agent1() agent2.observe(x1) agent3.observe(x1) x2 = agent2() agent1.observe(x2) agent3.observe(x2)