agentscope package
Subpackages
- agentscope.agents package
- Submodules
- Module contents
- agentscope.environment package
- agentscope.manager package
- Module contents
ASManager
FileManager
FileManager.cache_text_embedding()
FileManager.fetch_cached_text_embedding()
FileManager.flush()
FileManager.get_instance()
FileManager.initialize()
FileManager.is_initialized()
FileManager.load_dict()
FileManager.save_api_invocation()
FileManager.save_file()
FileManager.save_image()
FileManager.save_python_code()
FileManager.save_runtime_information()
FileManager.state_dict()
FileManager.code_dir
FileManager.embedding_cache_dir
FileManager.file_dir
FileManager.invoke_dir
ModelManager
ModelManager.clear_model_configs()
ModelManager.flush()
ModelManager.get_config_by_name()
ModelManager.get_instance()
ModelManager.get_model_by_config_name()
ModelManager.initialize()
ModelManager.load_dict()
ModelManager.load_model_configs()
ModelManager.register_model_wrapper_class()
ModelManager.state_dict()
ModelManager.model_configs
ModelManager.model_wrapper_mapping
MonitorManager
MonitorManager.flush()
MonitorManager.get_instance()
MonitorManager.initialize()
MonitorManager.load_dict()
MonitorManager.print_llm_usage()
MonitorManager.rm_database()
MonitorManager.show_image_tokens()
MonitorManager.show_text_and_embedding_tokens()
MonitorManager.state_dict()
MonitorManager.update_image_tokens()
MonitorManager.update_text_and_embedding_tokens()
MonitorManager.path_db
- Module contents
- agentscope.memory package
- agentscope.message package
- agentscope.models package
- Submodules
- agentscope.models.anthropic_model module
- 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
AnthropicChatWrapper
DashScopeChatWrapper
DashScopeImageSynthesisWrapper
DashScopeMultiModalWrapper
DashScopeTextEmbeddingWrapper
GeminiChatWrapper
GeminiEmbeddingWrapper
LiteLLMChatWrapper
ModelResponse
ModelWrapperBase
OllamaChatWrapper
OllamaEmbeddingWrapper
OllamaGenerationWrapper
OpenAIChatWrapper
OpenAIDALLEWrapper
OpenAIEmbeddingWrapper
OpenAIWrapperBase
PostAPIChatWrapper
PostAPIModelWrapperBase
YiChatWrapper
ZhipuAIChatWrapper
ZhipuAIEmbeddingWrapper
- Submodules
- agentscope.parsers package
- Submodules
- Module contents
- agentscope.pipelines package
- agentscope.prompt package
- agentscope.rag package
- agentscope.rpc package
- Submodules
- Module contents
AsyncResult
DistConf
RpcClient
RpcClient.call_agent_func()
RpcClient.create_agent()
RpcClient.delete_agent()
RpcClient.delete_all_agent()
RpcClient.download_file()
RpcClient.get_agent_list()
RpcClient.get_agent_memory()
RpcClient.get_server_info()
RpcClient.is_alive()
RpcClient.set_model_configs()
RpcClient.stop()
RpcClient.update_result()
RpcMeta
RpcObject
async_func()
sync_func()
- agentscope.server package
- agentscope.service package
- Subpackages
- Submodules
- Module contents
NoteBookExecutor
ServiceExecStatus
ServiceResponse
ServiceToolkit
WebBrowser
WebBrowser.action_click()
WebBrowser.action_press_key()
WebBrowser.action_scroll_down()
WebBrowser.action_scroll_up()
WebBrowser.action_type()
WebBrowser.action_visit_url()
WebBrowser.close()
WebBrowser.get_action_functions()
WebBrowser.remove_interactive_marks()
WebBrowser.set_interactive_marks()
WebBrowser.page_html
WebBrowser.page_markdown
WebBrowser.page_screenshot
WebBrowser.page_title
WebBrowser.url
WebElementInfo
WebElementInfo.aria_label
WebElementInfo.height
WebElementInfo.html
WebElementInfo.inner_text
WebElementInfo.is_clickable
WebElementInfo.meta_data
WebElementInfo.model_config
WebElementInfo.node_name
WebElementInfo.node_value
WebElementInfo.origin_x
WebElementInfo.origin_y
WebElementInfo.tag_name
WebElementInfo.type
WebElementInfo.width
arxiv_search()
bing_search()
cos_sim()
create_directory()
create_file()
dashscope_image_to_text()
dashscope_text_to_audio()
dashscope_text_to_image()
dblp_search_authors()
dblp_search_publications()
dblp_search_venues()
delete_directory()
delete_file()
digest_webpage()
download_from_url()
execute_python_code()
execute_shell_command()
get_current_directory()
get_help()
google_search()
list_directory_content()
load_web()
move_directory()
move_file()
openai_audio_to_text()
openai_create_image_variation()
openai_edit_image()
openai_image_to_text()
openai_text_to_audio()
openai_text_to_image()
parse_html_to_text()
query_mongodb()
query_mysql()
query_sqlite()
read_json_file()
read_text_file()
retrieve_from_list()
summarization()
tripadvisor_search()
tripadvisor_search_location_details()
tripadvisor_search_location_photos()
wikipedia_search()
wikipedia_search_categories()
write_json_file()
write_text_file()
- agentscope.strategy package
- agentscope.studio package
- agentscope.utils package
- agentscope.web package
Submodules
- agentscope.constants module
- agentscope.exception module
AgentCallError
AgentCreationError
AgentServerError
AgentServerNotAliveError
AgentServerUnsupportedMethodError
ArgumentNotFoundError
ArgumentTypeError
EnvAlreadyExistError
EnvError
EnvListenerError
EnvNotFoundError
EnvTypeError
EnvUnsupportedFunctionError
FunctionCallError
FunctionCallFormatError
FunctionNotFoundError
JsonDictValidationError
JsonParsingError
JsonTypeError
QuotaExceededError
RequiredFieldNotFoundError
ResponseParsingError
StudioError
StudioRegisterError
TagNotFoundError
- agentscope.logging module
- agentscope.msghub module
- agentscope.serialize module
- agentscope.tokens module
Module contents
Import all modules in the package.
- 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 ~/.cache/agentscope. In Windows, the dir defaults to 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.
- 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)
- register_model_wrapper_class(model_wrapper_class: Type[ModelWrapperBase], exist_ok: bool = False) None [source]
Register the model wrapper in AgentScope so that you can use it with model configurations.
- Parameters:
model_wrapper_class (Type[ModelWrapperBase]) – The model wrapper class to be registered, which must inherit from ModelWrapperBase.
exist_ok (bool, defaults to False) – Whether to overwrite the existing model wrapper with the same name.