Full Code of agentscope-ai/agentscope for AI

main 011c8b287bc1 cached
566 files
3.6 MB
970.3k tokens
2374 symbols
1 requests
Download .txt
Showing preview only (3,871K chars total). Download the full file or copy to clipboard to get everything.
Repository: agentscope-ai/agentscope
Branch: main
Commit: 011c8b287bc1
Files: 566
Total size: 3.6 MB

Directory structure:
gitextract_03u1mqs9/

├── .gemini/
│   └── styleguide.md
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── custom.md
│   │   └── feature_request.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── copilot-instructions.md
│   ├── scripts/
│   │   └── update_news.py
│   └── workflows/
│       ├── pr-title-check.yml
│       ├── pre-commit.yml
│       ├── publish-pypi.yml
│       ├── sphinx_docs.yml
│       ├── stale.yml
│       ├── toc.yml
│       ├── unittest.yml
│       └── update_news.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CONTRIBUTING.md
├── CONTRIBUTING_zh.md
├── LICENSE
├── README.md
├── README_zh.md
├── docs/
│   ├── NEWS.md
│   ├── NEWS_zh.md
│   ├── changelog.md
│   ├── roadmap.md
│   └── tutorial/
│       ├── _static/
│       │   ├── css/
│       │   │   └── gallery.css
│       │   └── language_switch.js
│       ├── _templates/
│       │   ├── components/
│       │   │   └── language-switch.html
│       │   ├── module.rst_t
│       │   ├── package.rst_t
│       │   ├── page.html
│       │   └── sidebar/
│       │       └── navigation.html
│       ├── en/
│       │   ├── Makefile
│       │   ├── build.sh
│       │   ├── conf.py
│       │   ├── index.rst
│       │   ├── make.bat
│       │   └── src/
│       │       ├── README.md
│       │       ├── faq.py
│       │       ├── quickstart_agent.py
│       │       ├── quickstart_installation.py
│       │       ├── quickstart_key_concept.py
│       │       ├── quickstart_message.py
│       │       ├── task_a2a.py
│       │       ├── task_agent.py
│       │       ├── task_agent_skill.py
│       │       ├── task_embedding.py
│       │       ├── task_eval.py
│       │       ├── task_eval_openjudge.py
│       │       ├── task_hook.py
│       │       ├── task_long_term_memory.py
│       │       ├── task_mcp.py
│       │       ├── task_memory.py
│       │       ├── task_middleware.py
│       │       ├── task_model.py
│       │       ├── task_pipeline.py
│       │       ├── task_plan.py
│       │       ├── task_prompt.py
│       │       ├── task_rag.py
│       │       ├── task_realtime.py
│       │       ├── task_state.py
│       │       ├── task_studio.py
│       │       ├── task_token.py
│       │       ├── task_tool.py
│       │       ├── task_tracing.py
│       │       ├── task_tts.py
│       │       ├── task_tuner.py
│       │       ├── workflow_concurrent_agents.py
│       │       ├── workflow_conversation.py
│       │       ├── workflow_handoffs.py
│       │       ├── workflow_multiagent_debate.py
│       │       └── workflow_routing.py
│       └── zh_CN/
│           ├── Makefile
│           ├── build.sh
│           ├── conf.py
│           ├── index.rst
│           ├── make.bat
│           └── src/
│               ├── README.md
│               ├── faq.py
│               ├── quickstart_agent.py
│               ├── quickstart_installation.py
│               ├── quickstart_key_concept.py
│               ├── quickstart_message.py
│               ├── task_a2a.py
│               ├── task_agent.py
│               ├── task_agent_skill.py
│               ├── task_embedding.py
│               ├── task_eval.py
│               ├── task_eval_openjudge.py
│               ├── task_hook.py
│               ├── task_long_term_memory.py
│               ├── task_mcp.py
│               ├── task_memory.py
│               ├── task_middleware.py
│               ├── task_model.py
│               ├── task_pipeline.py
│               ├── task_plan.py
│               ├── task_prompt.py
│               ├── task_rag.py
│               ├── task_realtime.py
│               ├── task_state.py
│               ├── task_studio.py
│               ├── task_token.py
│               ├── task_tool.py
│               ├── task_tracing.py
│               ├── task_tts.py
│               ├── task_tuner.py
│               ├── workflow_concurrent_agents.py
│               ├── workflow_conversation.py
│               ├── workflow_handoffs.py
│               ├── workflow_multiagent_debate.py
│               └── workflow_routing.py
├── examples/
│   ├── agent/
│   │   ├── a2a_agent/
│   │   │   ├── README.md
│   │   │   ├── agent_card.py
│   │   │   ├── main.py
│   │   │   └── setup_a2a_server.py
│   │   ├── a2ui_agent/
│   │   │   ├── README.md
│   │   │   └── samples/
│   │   │       ├── client/
│   │   │       │   ├── a2a_client.py
│   │   │       │   └── lit/
│   │   │       │       ├── contact/
│   │   │       │       │   ├── README.md
│   │   │       │       │   ├── client.ts
│   │   │       │       │   ├── contact.ts
│   │   │       │       │   ├── events/
│   │   │       │       │   │   └── events.ts
│   │   │       │       │   ├── index.html
│   │   │       │       │   ├── middleware/
│   │   │       │       │   │   ├── a2a.ts
│   │   │       │       │   │   └── index.ts
│   │   │       │       │   ├── package.json
│   │   │       │       │   ├── theme/
│   │   │       │       │   │   └── theme.ts
│   │   │       │       │   ├── tsconfig.json
│   │   │       │       │   ├── types/
│   │   │       │       │   │   └── types.ts
│   │   │       │       │   ├── ui/
│   │   │       │       │   │   ├── custom-components/
│   │   │       │       │   │   │   ├── README.md
│   │   │       │       │   │   │   ├── org-chart.ts
│   │   │       │       │   │   │   ├── premium-text-field.ts
│   │   │       │       │   │   │   ├── register-components.ts
│   │   │       │       │   │   │   └── test/
│   │   │       │       │   │   │       ├── README.md
│   │   │       │       │   │   │       ├── org-chart-test.html
│   │   │       │       │   │   │       ├── override-test.html
│   │   │       │       │   │   │       └── override-test.ts
│   │   │       │       │   │   ├── snackbar.ts
│   │   │       │       │   │   └── ui.ts
│   │   │       │       │   └── vite.config.ts
│   │   │       │       ├── package.json
│   │   │       │       └── shell/
│   │   │       │           ├── README.md
│   │   │       │           ├── THEMING.md
│   │   │       │           ├── app.ts
│   │   │       │           ├── client.ts
│   │   │       │           ├── configs/
│   │   │       │           │   ├── contacts.ts
│   │   │       │           │   ├── restaurant.ts
│   │   │       │           │   └── types.ts
│   │   │       │           ├── events/
│   │   │       │           │   └── events.ts
│   │   │       │           ├── index.html
│   │   │       │           ├── middleware/
│   │   │       │           │   ├── a2a.ts
│   │   │       │           │   └── index.ts
│   │   │       │           ├── package.json
│   │   │       │           ├── theme/
│   │   │       │           │   ├── clone-default-theme.ts
│   │   │       │           │   └── default-theme.ts
│   │   │       │           ├── tsconfig.json
│   │   │       │           ├── types/
│   │   │       │           │   └── types.ts
│   │   │       │           ├── ui/
│   │   │       │           │   ├── snackbar.ts
│   │   │       │           │   └── ui.ts
│   │   │       │           └── vite.config.ts
│   │   │       └── general_agent/
│   │   │           ├── __main__.py
│   │   │           ├── a2ui_utils.py
│   │   │           ├── agent_card.py
│   │   │           ├── prompt_builder.py
│   │   │           ├── pyproject.toml
│   │   │           ├── setup_a2ui_server.py
│   │   │           └── skills/
│   │   │               └── A2UI_response_generator/
│   │   │                   ├── SKILL.md
│   │   │                   ├── UI_templete_examples/
│   │   │                   │   ├── __init__.py
│   │   │                   │   ├── booking_form.py
│   │   │                   │   ├── contact_form.py
│   │   │                   │   ├── email_compose_form.py
│   │   │                   │   ├── error_message.py
│   │   │                   │   ├── info_message.py
│   │   │                   │   ├── item_detail_card_with_image.py
│   │   │                   │   ├── profile_view.py
│   │   │                   │   ├── search_filter_form.py
│   │   │                   │   ├── selection_card.py
│   │   │                   │   ├── simple_column_list_without_image.py
│   │   │                   │   ├── single_column_list.py
│   │   │                   │   ├── success_confirmation_with_image.py
│   │   │                   │   └── two_column_list.py
│   │   │                   ├── __init__.py
│   │   │                   ├── schema/
│   │   │                   │   ├── __init__.py
│   │   │                   │   └── base_schema.py
│   │   │                   ├── view_a2ui_examples.py
│   │   │                   └── view_a2ui_schema.py
│   │   ├── browser_agent/
│   │   │   ├── README.md
│   │   │   ├── browser_agent.py
│   │   │   ├── build_in_helper/
│   │   │   │   ├── _file_download.py
│   │   │   │   ├── _form_filling.py
│   │   │   │   ├── _image_understanding.py
│   │   │   │   └── _video_understanding.py
│   │   │   ├── build_in_prompt/
│   │   │   │   ├── browser_agent_decompose_reflection_prompt.md
│   │   │   │   ├── browser_agent_file_download_sys_prompt.md
│   │   │   │   ├── browser_agent_form_filling_sys_prompt.md
│   │   │   │   ├── browser_agent_observe_reasoning_prompt.md
│   │   │   │   ├── browser_agent_pure_reasoning_prompt.md
│   │   │   │   ├── browser_agent_subtask_revise_prompt.md
│   │   │   │   ├── browser_agent_summarize_task.md
│   │   │   │   ├── browser_agent_sys_prompt.md
│   │   │   │   └── browser_agent_task_decomposition_prompt.md
│   │   │   └── main.py
│   │   ├── deep_research_agent/
│   │   │   ├── README.md
│   │   │   ├── built_in_prompt/
│   │   │   │   ├── prompt_decompose_subtask.md
│   │   │   │   ├── prompt_deeper_expansion.md
│   │   │   │   ├── prompt_deepresearch_summary_report.md
│   │   │   │   ├── prompt_inprocess_report.md
│   │   │   │   ├── prompt_reflect_failure.md
│   │   │   │   ├── prompt_tool_usage_rules.md
│   │   │   │   ├── prompt_worker_additional_sys_prompt.md
│   │   │   │   └── promptmodule.py
│   │   │   ├── deep_research_agent.py
│   │   │   ├── main.py
│   │   │   └── utils.py
│   │   ├── meta_planner_agent/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── tool.py
│   │   ├── react_agent/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   ├── realtime_voice_agent/
│   │   │   ├── README.md
│   │   │   ├── chatbot.html
│   │   │   └── run_server.py
│   │   └── voice_agent/
│   │       ├── README.md
│   │       └── main.py
│   ├── deployment/
│   │   ├── README.md
│   │   └── planning_agent/
│   │       ├── README.md
│   │       ├── main.py
│   │       ├── test_post.py
│   │       └── tool.py
│   ├── evaluation/
│   │   └── ace_bench/
│   │       ├── README.md
│   │       └── main.py
│   ├── functionality/
│   │   ├── agent_skill/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── skill/
│   │   │       └── analyzing-agentscope-library/
│   │   │           ├── SKILL.md
│   │   │           └── view_agentscope_module.py
│   │   ├── long_term_memory/
│   │   │   ├── mem0/
│   │   │   │   ├── README.md
│   │   │   │   └── memory_example.py
│   │   │   └── reme/
│   │   │       ├── README.md
│   │   │       ├── personal_memory_example.py
│   │   │       ├── task_memory_example.py
│   │   │       └── tool_memory_example.py
│   │   ├── mcp/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   ├── mcp_add.py
│   │   │   └── mcp_multiply.py
│   │   ├── plan/
│   │   │   ├── README.md
│   │   │   ├── main_agent_managed_plan.py
│   │   │   └── main_manual_plan.py
│   │   ├── rag/
│   │   │   ├── README.md
│   │   │   ├── agentic_usage.py
│   │   │   ├── basic_usage.py
│   │   │   ├── multimodal_rag.py
│   │   │   └── react_agent_integration.py
│   │   ├── session_with_sqlite/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── sqlite_session.py
│   │   ├── short_term_memory/
│   │   │   ├── memory_compression/
│   │   │   │   ├── README.md
│   │   │   │   └── main.py
│   │   │   └── reme/
│   │   │       ├── README.md
│   │   │       ├── reme_short_term_memory.py
│   │   │       └── short_term_memory_example.py
│   │   ├── stream_printing_messages/
│   │   │   ├── README.md
│   │   │   ├── multi_agent.py
│   │   │   └── single_agent.py
│   │   ├── structured_output/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   ├── tts/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   └── vector_store/
│   │       ├── alibabacloud_mysql_vector/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       ├── milvus_lite/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       ├── mongodb/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       └── oceanbase/
│   │           ├── README.md
│   │           └── main.py
│   ├── game/
│   │   └── werewolves/
│   │       ├── README.md
│   │       ├── game.py
│   │       ├── main.py
│   │       ├── prompt.py
│   │       ├── structured_model.py
│   │       └── utils.py
│   ├── integration/
│   │   ├── alibabacloud_api_mcp/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── oauth_handler.py
│   │   └── qwen_deep_research_model/
│   │       ├── README.md
│   │       ├── main.py
│   │       └── qwen_deep_research_agent.py
│   ├── tuner/
│   │   └── react_agent/
│   │       ├── README.md
│   │       ├── config.yaml
│   │       └── main.py
│   └── workflows/
│       ├── multiagent_concurrent/
│       │   ├── README.md
│       │   └── main.py
│       ├── multiagent_conversation/
│       │   ├── README.md
│       │   └── main.py
│       ├── multiagent_debate/
│       │   ├── README.md
│       │   └── main.py
│       └── multiagent_realtime/
│           ├── README.md
│           ├── multi_agent.html
│           └── run_server.py
├── pyproject.toml
├── src/
│   └── agentscope/
│       ├── __init__.py
│       ├── _logging.py
│       ├── _run_config.py
│       ├── _utils/
│       │   ├── __init__.py
│       │   ├── _common.py
│       │   └── _mixin.py
│       ├── _version.py
│       ├── a2a/
│       │   ├── __init__.py
│       │   ├── _base.py
│       │   ├── _file_resolver.py
│       │   ├── _nacos_resolver.py
│       │   └── _well_known_resolver.py
│       ├── agent/
│       │   ├── __init__.py
│       │   ├── _a2a_agent.py
│       │   ├── _agent_base.py
│       │   ├── _agent_meta.py
│       │   ├── _react_agent.py
│       │   ├── _react_agent_base.py
│       │   ├── _realtime_agent.py
│       │   ├── _user_agent.py
│       │   ├── _user_input.py
│       │   └── _utils.py
│       ├── embedding/
│       │   ├── __init__.py
│       │   ├── _cache_base.py
│       │   ├── _dashscope_embedding.py
│       │   ├── _dashscope_multimodal_embedding.py
│       │   ├── _embedding_base.py
│       │   ├── _embedding_response.py
│       │   ├── _embedding_usage.py
│       │   ├── _file_cache.py
│       │   ├── _gemini_embedding.py
│       │   ├── _ollama_embedding.py
│       │   └── _openai_embedding.py
│       ├── evaluate/
│       │   ├── __init__.py
│       │   ├── _ace_benchmark/
│       │   │   ├── __init__.py
│       │   │   ├── _ace_benchmark.py
│       │   │   ├── _ace_metric.py
│       │   │   ├── _ace_tools_api/
│       │   │   │   ├── __init__.py
│       │   │   │   ├── _food_platform_api.py
│       │   │   │   ├── _message_api.py
│       │   │   │   ├── _reminder_api.py
│       │   │   │   ├── _shared_state.py
│       │   │   │   └── _travel_api.py
│       │   │   └── _ace_tools_zh.py
│       │   ├── _benchmark_base.py
│       │   ├── _evaluator/
│       │   │   ├── __init__.py
│       │   │   ├── _evaluator_base.py
│       │   │   ├── _general_evaluator.py
│       │   │   ├── _in_memory_exporter.py
│       │   │   └── _ray_evaluator.py
│       │   ├── _evaluator_storage/
│       │   │   ├── __init__.py
│       │   │   ├── _evaluator_storage_base.py
│       │   │   └── _file_evaluator_storage.py
│       │   ├── _metric_base.py
│       │   ├── _solution.py
│       │   └── _task.py
│       ├── exception/
│       │   ├── __init__.py
│       │   ├── _exception_base.py
│       │   └── _tool.py
│       ├── formatter/
│       │   ├── __init__.py
│       │   ├── _a2a_formatter.py
│       │   ├── _anthropic_formatter.py
│       │   ├── _dashscope_formatter.py
│       │   ├── _deepseek_formatter.py
│       │   ├── _formatter_base.py
│       │   ├── _gemini_formatter.py
│       │   ├── _ollama_formatter.py
│       │   ├── _openai_formatter.py
│       │   └── _truncated_formatter_base.py
│       ├── hooks/
│       │   ├── __init__.py
│       │   └── _studio_hooks.py
│       ├── mcp/
│       │   ├── __init__.py
│       │   ├── _client_base.py
│       │   ├── _http_stateful_client.py
│       │   ├── _http_stateless_client.py
│       │   ├── _mcp_function.py
│       │   ├── _stateful_client_base.py
│       │   └── _stdio_stateful_client.py
│       ├── memory/
│       │   ├── __init__.py
│       │   ├── _long_term_memory/
│       │   │   ├── __init__.py
│       │   │   ├── _long_term_memory_base.py
│       │   │   ├── _mem0/
│       │   │   │   ├── __init__.py
│       │   │   │   ├── _mem0_long_term_memory.py
│       │   │   │   └── _mem0_utils.py
│       │   │   └── _reme/
│       │   │       ├── __init__.py
│       │   │       ├── _reme_long_term_memory_base.py
│       │   │       ├── _reme_personal_long_term_memory.py
│       │   │       ├── _reme_task_long_term_memory.py
│       │   │       └── _reme_tool_long_term_memory.py
│       │   └── _working_memory/
│       │       ├── __init__.py
│       │       ├── _base.py
│       │       ├── _in_memory_memory.py
│       │       ├── _redis_memory.py
│       │       └── _sqlalchemy_memory.py
│       ├── message/
│       │   ├── __init__.py
│       │   ├── _message_base.py
│       │   └── _message_block.py
│       ├── model/
│       │   ├── __init__.py
│       │   ├── _anthropic_model.py
│       │   ├── _dashscope_model.py
│       │   ├── _gemini_model.py
│       │   ├── _model_base.py
│       │   ├── _model_response.py
│       │   ├── _model_usage.py
│       │   ├── _ollama_model.py
│       │   ├── _openai_model.py
│       │   └── _trinity_model.py
│       ├── module/
│       │   ├── __init__.py
│       │   └── _state_module.py
│       ├── pipeline/
│       │   ├── __init__.py
│       │   ├── _chat_room.py
│       │   ├── _class.py
│       │   ├── _functional.py
│       │   └── _msghub.py
│       ├── plan/
│       │   ├── __init__.py
│       │   ├── _in_memory_storage.py
│       │   ├── _plan_model.py
│       │   ├── _plan_notebook.py
│       │   └── _storage_base.py
│       ├── py.typed
│       ├── rag/
│       │   ├── __init__.py
│       │   ├── _document.py
│       │   ├── _knowledge_base.py
│       │   ├── _reader/
│       │   │   ├── __init__.py
│       │   │   ├── _excel_reader.py
│       │   │   ├── _image_reader.py
│       │   │   ├── _pdf_reader.py
│       │   │   ├── _ppt_reader.py
│       │   │   ├── _reader_base.py
│       │   │   ├── _text_reader.py
│       │   │   ├── _utils.py
│       │   │   └── _word_reader.py
│       │   ├── _simple_knowledge.py
│       │   └── _store/
│       │       ├── __init__.py
│       │       ├── _alibabacloud_mysql_store.py
│       │       ├── _milvuslite_store.py
│       │       ├── _mongodb_store.py
│       │       ├── _oceanbase_store.py
│       │       ├── _qdrant_store.py
│       │       └── _store_base.py
│       ├── realtime/
│       │   ├── __init__.py
│       │   ├── _base.py
│       │   ├── _dashscope_realtime_model.py
│       │   ├── _events/
│       │   │   ├── __init__.py
│       │   │   ├── _client_event.py
│       │   │   ├── _model_event.py
│       │   │   ├── _server_event.py
│       │   │   └── _utils.py
│       │   ├── _gemini_realtime_model.py
│       │   └── _openai_realtime_model.py
│       ├── session/
│       │   ├── __init__.py
│       │   ├── _json_session.py
│       │   ├── _redis_session.py
│       │   └── _session_base.py
│       ├── token/
│       │   ├── __init__.py
│       │   ├── _anthropic_token_counter.py
│       │   ├── _char_token_counter.py
│       │   ├── _gemini_token_counter.py
│       │   ├── _huggingface_token_counter.py
│       │   ├── _openai_token_counter.py
│       │   └── _token_base.py
│       ├── tool/
│       │   ├── __init__.py
│       │   ├── _async_wrapper.py
│       │   ├── _coding/
│       │   │   ├── __init__.py
│       │   │   ├── _python.py
│       │   │   └── _shell.py
│       │   ├── _multi_modality/
│       │   │   ├── __init__.py
│       │   │   ├── _dashscope_tools.py
│       │   │   └── _openai_tools.py
│       │   ├── _response.py
│       │   ├── _text_file/
│       │   │   ├── __init__.py
│       │   │   ├── _utils.py
│       │   │   ├── _view_text_file.py
│       │   │   └── _write_text_file.py
│       │   ├── _toolkit.py
│       │   └── _types.py
│       ├── tracing/
│       │   ├── __init__.py
│       │   ├── _attributes.py
│       │   ├── _converter.py
│       │   ├── _extractor.py
│       │   ├── _setup.py
│       │   ├── _trace.py
│       │   └── _utils.py
│       ├── tts/
│       │   ├── __init__.py
│       │   ├── _dashscope_cosyvoice_realtime_tts_model.py
│       │   ├── _dashscope_cosyvoice_tts_model.py
│       │   ├── _dashscope_realtime_tts_model.py
│       │   ├── _dashscope_tts_model.py
│       │   ├── _gemini_tts_model.py
│       │   ├── _openai_tts_model.py
│       │   ├── _tts_base.py
│       │   ├── _tts_response.py
│       │   └── _utils.py
│       ├── tune/
│       │   └── __init__.py
│       ├── tuner/
│       │   ├── __init__.py
│       │   ├── _algorithm.py
│       │   ├── _config.py
│       │   ├── _dataset.py
│       │   ├── _judge.py
│       │   ├── _model.py
│       │   ├── _tune.py
│       │   └── _workflow.py
│       └── types/
│           ├── __init__.py
│           ├── _hook.py
│           ├── _json.py
│           ├── _object.py
│           └── _tool.py
└── tests/
    ├── a2a_agent_test.py
    ├── a2a_resolver_test.py
    ├── config_test.py
    ├── embedding_cache_test.py
    ├── evaluation_test.py
    ├── formatter_a2a_test.py
    ├── formatter_anthropic_test.py
    ├── formatter_dashscope_test.py
    ├── formatter_deepseek_test.py
    ├── formatter_gemini_test.py
    ├── formatter_ollama_test.py
    ├── formatter_openai_test.py
    ├── hook_test.py
    ├── mcp_sse_client_test.py
    ├── mcp_streamable_http_client_test.py
    ├── mem0_utils_test.py
    ├── memory_compression_test.py
    ├── memory_reme_test.py
    ├── memory_test.py
    ├── model_anthropic_test.py
    ├── model_dashscope_test.py
    ├── model_gemini_test.py
    ├── model_ollama_test.py
    ├── model_openai_test.py
    ├── pipeline_test.py
    ├── plan_test.py
    ├── rag_knowledge_test.py
    ├── rag_reader_test.py
    ├── rag_store_test.py
    ├── react_agent_test.py
    ├── realtime_dashscope_test.py
    ├── realtime_event_test.py
    ├── realtime_gemini_test.py
    ├── realtime_openai_test.py
    ├── session_test.py
    ├── test.docx
    ├── test.pptx
    ├── test.xlsx
    ├── token_anthropic_test.py
    ├── token_char_test.py
    ├── token_openai_test.py
    ├── tool_dashscope_test.py
    ├── tool_openai_test.py
    ├── tool_test.py
    ├── toolkit_basic_test.py
    ├── toolkit_meta_tool_test.py
    ├── toolkit_middleware_test.py
    ├── tracing_converter_test.py
    ├── tracing_extractor_test.py
    ├── tracing_test.py
    ├── tracing_utils_test.py
    ├── tts_dashscope_cosyvoice_test.py
    ├── tts_dashscope_test.py
    ├── tts_gemini_test.py
    ├── tts_openai_test.py
    ├── tuner_test.py
    └── user_input_test.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gemini/styleguide.md
================================================
# AgentScope Code Review Guide

You should conduct a strict code review. Each requirement is labeled with priority:
- **[MUST]** must be satisfied or PR will be rejected
- **[SHOULD]** strongly recommended
- **[MAY]** optional suggestion

## 1. Code Quality

### [MUST] Lazy Loading
- Third-party library dependencies should be imported at the point of use, avoid centralized imports at file top
  - The `Third-party library` refers to libraries not included in the `dependencies` variable in `pyproject.toml`.
- For base class imports, use factory pattern:
```python
def get_xxx_cls() -> "MyClass":
    from xxx import BaseClass
    class MyClass(BaseClass): ...
    return MyClass
```

### [SHOULD] Code Conciseness
After understanding the code intent, check if it can be optimized:
- Avoid unnecessary temporary variables
- Merge duplicate code blocks
- Prioritize reusing existing utility functions

### [MUST] Encapsulation Standards
- All Python files under `src/agentscope` should be named with `_` prefix, and exposure controlled through `__init__.py`
- Classes and functions used internally by the framework that don't need to be exposed to users must be named with `_` prefix

## 2. [MUST] Code Security
- Prohibit hardcoding API keys/tokens/passwords
- Use environment variables or configuration files for management
- Check for debug information and temporary credentials
- Check for injection attack risks (SQL/command/code injection, etc.)

## 3. [MUST] Testing & Dependencies
- New features must include unit tests
- New dependencies need to be added to the corresponding section in `pyproject.toml`
- Dependencies for non-core scenarios should not be added to the minimal dependency list

## 4. Code Standards

### [MUST] Comment Standards
- **Use English**
- All classes/methods must have complete docstrings, strictly following the template:
```python
def func(a: str, b: int | None = None) -> str:
    """{description}

    Args:
        a (`str`):
            The argument a
        b (`int | None`, optional):
            The argument b

    Returns:
        `str`:
            The return str
    """
```
- Use reStructuredText syntax for special content:
```python
class MyClass:
    """xxx

    `Example link <https://xxx>`_

    .. note:: Example note

    .. tip:: Example tip

    .. important:: Example important info

    .. code-block:: python

        def hello_world():
            print("Hello world!")

    """
```

### [MUST] Pre-commit Checks
- **Strict review**: In most cases, code should be modified rather than skipping checks
- **File-level check skipping is prohibited**
- Only allowed skip: agent class system prompt parameters (to avoid `\n` formatting issues)

---

## 5. Git Standards

### [MUST] PR Title
- Follow Conventional Commits
- Must use prefixes: `feat/fix/docs/ci/refactor/test`, etc.
- Format: `feat(scope): description`
- Example: `feat(memory): add redis cache support`

================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug Report
about: Create a report to help us improve
title: '[Bug]:'
labels: 'bug'
assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. You code
2. How to execute
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Error messages**
Detailed error messages.

**Environment (please complete the following information):**

- AgentScope Version: [e.g. 1.0.0 via `print(agentscope.__version__)`]
- Python Version: [e.g. 3.10]
- OS: [e.g. macos, windows]

**Additional context**
Add any other context about the problem here.


================================================
FILE: .github/ISSUE_TEMPLATE/custom.md
================================================
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**





================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature Request
about: Suggest an idea for this project
title: '[Feature]: '
labels: 'enhancement'
assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**


**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
## PR Title Format

Please ensure your PR title follows the Conventional Commits format:
- Format: `<type>(<scope>): <description>`
- Example: `feat(memory): add redis cache support`
- Allowed types: `feat`, `fix`, `docs`, `ci`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `revert`
- Description should start with a lowercase letter

## AgentScope Version

[The version of AgentScope you are working on, e.g. `import agentscope; print(agentscope.__version__)`]

## Description

[Please describe the background, purpose, changes made, and how to test this PR]

## Checklist

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

- [ ]  Code has been formatted with `pre-commit run --all-files` command
- [ ]  All tests are passing
- [ ]  Docstrings are in Google style
- [ ]  Related documentation has been updated (e.g. links, examples, etc.)
- [ ]  Code is ready for review

================================================
FILE: .github/copilot-instructions.md
================================================
# AgentScope Code Review Guide

You should conduct a strict code review. Each requirement is labeled with priority:
- **[MUST]** must be satisfied or PR will be rejected
- **[SHOULD]** strongly recommended
- **[MAY]** optional suggestion

## 1. Code Quality

### [MUST] Lazy Loading
- Third-party library dependencies should be imported at the point of use, avoid centralized imports at file top
  - The `Third-party library` refers to libraries not included in the `dependencies` variable in `pyproject.toml`.
- For base class imports, use factory pattern:
```python
def get_xxx_cls() -> "MyClass":
    from xxx import BaseClass
    class MyClass(BaseClass): ...
    return MyClass
```

### [SHOULD] Code Conciseness
After understanding the code intent, check if it can be optimized:
- Avoid unnecessary temporary variables
- Merge duplicate code blocks
- Prioritize reusing existing utility functions

### [MUST] Encapsulation Standards
- All Python files under `src/agentscope` should be named with `_` prefix, and exposure controlled through `__init__.py`
- Classes and functions used internally by the framework that don't need to be exposed to users must be named with `_` prefix

## 2. [MUST] Code Security
- Prohibit hardcoding API keys/tokens/passwords
- Use environment variables or configuration files for management
- Check for debug information and temporary credentials
- Check for injection attack risks (SQL/command/code injection, etc.)

## 3. [MUST] Testing & Dependencies
- New features must include unit tests
- New dependencies need to be added to the corresponding section in `pyproject.toml`
- Dependencies for non-core scenarios should not be added to the minimal dependency list

## 4. Code Standards

### [MUST] Comment Standards
- **Use English**
- All classes/methods must have complete docstrings, strictly following the template:
```python
def func(a: str, b: int | None = None) -> str:
    """{description}

    Args:
        a (`str`):
            The argument a
        b (`int | None`, optional):
            The argument b

    Returns:
        `str`:
            The return str
    """
```
- Use reStructuredText syntax for special content:
```python
class MyClass:
    """xxx

    `Example link <https://xxx>`_

    .. note:: Example note

    .. tip:: Example tip

    .. important:: Example important info

    .. code-block:: python

        def hello_world():
            print("Hello world!")

    """
```

### [MUST] Pre-commit Checks
- **Strict review**: In most cases, code should be modified rather than skipping checks
- **File-level check skipping is prohibited**
- Only allowed skip: agent class system prompt parameters (to avoid `\n` formatting issues)

---

## 5. Git Standards

### [MUST] PR Title
- Follow Conventional Commits
- Must use prefixes: `feat/fix/docs/ci/refactor/test`, etc.
- Format: `feat(scope): description`
- Example: `feat(memory): add redis cache support`

================================================
FILE: .github/scripts/update_news.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to automatically update NEWS section in README files.
Reads the first 10 news items from docs/NEWS.md and updates README.md and
README_zh.md.
"""

from pathlib import Path


def read_news_items(news_file: Path, max_items: int = 10) -> list[str]:
    """
    Read news items from NEWS.md file.

    Args:
        news_file (`Path`):
            Path to the NEWS.md file
        max_items (`int`, optional):
            Maximum number of items to read

    Returns:
        `list[str]`:
            List of news items
    """
    with open(news_file, "r", encoding="utf-8") as f:
        content = f.read()

    # Split by lines that start with "- **["
    lines = content.strip().split("\n")
    news_items = []

    for line in lines:
        if line.strip().startswith("- **["):
            news_items.append(line)
            if len(news_items) >= max_items:
                break

    return news_items


def update_readme(
    readme_file: Path,
    news_items: list[str],
) -> None:
    """
    Update the NEWS section in README file using HTML comment markers.

    Args:
        readme_file (`Path`):
            Path to the README file
        news_items (`list[str]`):
            List of news items to insert
    """
    with open(readme_file, "r", encoding="utf-8") as f:
        content = f.read()

    # Use HTML comment markers to identify the NEWS section
    begin_marker = "<!-- BEGIN NEWS -->"
    end_marker = "<!-- END NEWS -->"

    if begin_marker not in content or end_marker not in content:
        print(f"⚠️  NEWS markers not found in {readme_file.name}")
        print(
            f"    Please add '{begin_marker}' and '{end_marker}' to mark the "
            f"NEWS section",
        )
        return

    # Find positions of markers
    begin_pos = content.find(begin_marker)
    end_pos = content.find(end_marker)

    if begin_pos == -1 or end_pos == -1 or begin_pos >= end_pos:
        print(f"❌ Invalid NEWS markers in {readme_file.name}")
        return

    # Create new NEWS content
    news_content = "\n".join(news_items)

    # Replace content between markers
    new_content = (
        content[: begin_pos + len(begin_marker)]
        + "\n"
        + news_content
        + "\n"
        + content[end_pos:]
    )

    with open(readme_file, "w", encoding="utf-8") as f:
        f.write(new_content)

    print(f"✅ Updated {readme_file.name}")


def main() -> None:
    """Main function to update NEWS in README files."""
    # Define paths
    repo_root = Path(__file__).parent.parent.parent
    news_file_en = repo_root / "docs" / "NEWS.md"
    news_file_zh = repo_root / "docs" / "NEWS_zh.md"
    readme_en = repo_root / "README.md"
    readme_zh = repo_root / "README_zh.md"

    # Update English README from NEWS.md
    if news_file_en.exists():
        print(f"📖 Reading news items from {news_file_en}")
        news_items_en = read_news_items(news_file_en, max_items=10)
        print(f"📰 Found {len(news_items_en)} English news items")

        if news_items_en and readme_en.exists():
            print(f"📝 Updating {readme_en.name}...")
            update_readme(readme_en, news_items_en)
        elif not news_items_en:
            print("⚠️  No English news items found")
        else:
            print(f"⚠️  {readme_en} not found")
    else:
        print(f"❌ NEWS.md not found at {news_file_en}")

    # Update Chinese README from NEWS_zh.md
    if news_file_zh.exists() and news_file_zh.stat().st_size > 0:
        print(f"📖 Reading news items from {news_file_zh}")
        news_items_zh = read_news_items(news_file_zh, max_items=10)
        print(f"📰 Found {len(news_items_zh)} Chinese news items")

        if news_items_zh and readme_zh.exists():
            print(f"📝 Updating {readme_zh.name}...")
            update_readme(readme_zh, news_items_zh)
        elif not news_items_zh:
            print("⚠️  No Chinese news items found")
        else:
            print(f"⚠️  {readme_zh} not found")
    else:
        print(
            f"⚠️  NEWS_zh.md not found or empty at {news_file_zh}, "
            f"using English news for Chinese README",
        )
        # Fallback: use English news for Chinese README if NEWS_zh.md
        # doesn't exist
        if news_file_en.exists() and readme_zh.exists():
            print(f"📖 Reading news items from {news_file_en} (fallback)")
            news_items = read_news_items(news_file_en, max_items=10)
            if news_items:
                print(f"📝 Updating {readme_zh.name} with English news...")
                update_readme(readme_zh, news_items)

    print("✨ All done!")


if __name__ == "__main__":
    main()


================================================
FILE: .github/workflows/pr-title-check.yml
================================================
name: PR Title Check

on:
  pull_request:
    branches:
      - main
    types: [opened, edited, synchronize, reopened]

jobs:
  check-pr-title:
    runs-on: ubuntu-latest
    steps:
      - name: Check PR Title Format
        uses: amannn/action-semantic-pull-request@v6.1.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          # Configure allowed types based on your requirements
          types: |
            feat
            fix
            docs
            ci
            refactor
            test
            chore
            perf
            style
            build
            revert
          # Require a scope (the part in parentheses)
          requireScope: false
          # Scope pattern: only lowercase letters, numbers, hyphens, and underscores allowed
          scopePattern: ^[a-z0-9_-]+$
          scopePatternError: |
            The scope (text in parentheses) must contain only lowercase letters, numbers, hyphens, and underscores.
            Example: "feat(memory): add redis cache support"
            Invalid: "feat(Memory): ..." or "feat(MEMORY): ..."
          # Subject (description) must not be empty and must be lowercase
          subjectPattern: ^(?![A-Z]).+$
          subjectPatternError: |
            The subject (description after colon) must start with a lowercase letter.
            Example: "feat(memory): add redis cache support"
          # Validate the entire PR title against the Conventional Commits spec
          validateSingleCommit: false
          # Ignore merge commits
          ignoreLabels: |
            ignore-semantic-pull-request



================================================
FILE: .github/workflows/pre-commit.yml
================================================
name: Pre-commit

on: [push, pull_request]

jobs:
  run:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: True
      matrix:
        os: [ubuntu-latest]
    env:
      OS: ${{ matrix.os }}
      PYTHON: '3.10'
    steps:
    - uses: actions/checkout@master
    - name: Setup Python
      uses: actions/setup-python@master
      with:
        python-version: '3.10'
    - name: Update setuptools
      run: |
        pip install setuptools==68.2.2 wheel==0.41.2
    - name: Install AgentScope
      run: |
        pip install -q -e .[dev]
    - name: Install pre-commit
      run: |
        pre-commit install
    - name: Pre-commit starts
      run: |
        pre-commit run --all-files > pre-commit.log 2>&1 || true
        cat pre-commit.log
        if grep -q Failed pre-commit.log; then
          echo -e "\e[41m  [**FAIL**] Please install pre-commit and format your code first. \e[0m"
          exit 1
        fi
        echo -e "\e[46m  ********************************Passed******************************** \e[0m"


================================================
FILE: .github/workflows/publish-pypi.yml
================================================
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Publish PyPi Package

on:
  workflow_dispatch:
  release:
    types: [published]

permissions:
  contents: read

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v6
    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: '3.10'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel build
    - name: Build package
      run: python -m build
    - name: Test installation
      run: |
        pip install dist/*.whl
        python -c "import agentscope; print(agentscope.__version__)"
    - name: Publish package
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        user: __token__
        password: ${{ secrets.PYPI_API_TOKEN }}

================================================
FILE: .github/workflows/sphinx_docs.yml
================================================
name: Deploy Sphinx documentation to Pages

on:
  push:
    branches:
      - main

jobs:
  build_en:
    timeout-minutes: 20
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: ['3.10']
    env:
      OS: ${{ matrix.os }}
      PYTHON: '3.10'
    steps:
      - uses: actions/checkout@v6
      - name: Setup Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.10'
      - name: Update setuptools
        run: |
          pip install setuptools==78.1.1 wheel==0.45.1
      - name: Install Dependencies
        run: |
          pip install -q -e .[dev]
      - name: Add execute permission to build.sh
        run: |
          chmod +x docs/tutorial/en/build.sh
      - name: Build English Documentation
        env:
          DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
          GAODE_API_KEY: ${{ secrets.GAODE_API_KEY }}
        run: |
          cd docs/tutorial/en/
          ./build.sh
      - name: Deploy English Documentation
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: docs/tutorial/en/build/html
          cname: doc.agentscope.io
          keep_files: true

  build_zh:
    needs: build_en
    timeout-minutes: 20
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ ubuntu-latest ]
        python-version: [ '3.10' ]
    env:
      OS: ${{ matrix.os }}
      PYTHON: '3.10'
    steps:
      - uses: actions/checkout@v6
      - name: Setup Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.10'
      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: '16'
      - name: Verify npm installation
        run: npm --version
      - name: Update setuptools
        run: |
          pip install setuptools==78.1.1 wheel==0.45.1
      - name: Install Dependencies
        run: |
          pip install -q -e .[dev]
      - name: Add execute permission to build.sh
        run: |
          chmod +x docs/tutorial/zh_CN/build.sh
      - name: Build Chinese Documentation
        env:
          DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
          GAODE_API_KEY: ${{ secrets.GAODE_API_KEY }}
        run: |
          cd docs/tutorial/zh_CN/
          ./build.sh
      - name: Deploy Chinese Documentation
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: docs/tutorial/zh_CN/build/html
          destination_dir: zh_CN
          cname: doc.agentscope.io
          keep_files: true

================================================
FILE: .github/workflows/stale.yml
================================================
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
  schedule:
  - cron: '30 9 * * *'

jobs:
  stale:

    runs-on: ubuntu-latest
    permissions:
      issues: write
      pull-requests: write

    steps:
    - uses: actions/stale@v10
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-issue-message: 'This issue is marked as stale because there has been no activity for 60 days. Remove stale label or add new comments or this issue will be closed in 90 day.'
        close-issue-message: 'Close this stale issue.'
        stale-issue-label: 'stale-issue'
        exempt-issue-labels: 'RoadMap,Roadmap'
        days-before-stale: 60
        days-before-close: 30

        stale-pr-message: 'This PR is marked as stale because there has been no activity for 60 days. Remove stale label or add new comments or this PR will be closed in 30 days.'
        close-pr-message: 'Close this stale PR.'
        stale-pr-label: 'stale-pr'
        days-before-pr-stale: 60
        days-before-pr-close: 30


================================================
FILE: .github/workflows/toc.yml
================================================
name: Generate TOC
on:
  push:
    paths:
      - 'README.md'
      - 'README_ZH.md'
    branches-ignore:
      - 'main'

# Prevent concurrent runs that modify README files
concurrency:
  group: readme-updates-${{ github.ref }}
  cancel-in-progress: false

jobs:
  generateTOC:
    name: TOC Generator
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: technote-space/toc-generator@v4
        with:
          TOC_TITLE: "## 📑 Table of Contents"
          CREATE_PR: false
          TARGET_PATHS: "README.md,README_ZH.md"
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          TOC_TITLE_MAP: |
            README.md: ## 📑 Table of Contents
            README_ZH.md: ## 📑 目录

================================================
FILE: .github/workflows/unittest.yml
================================================
name: Python Unittest Coverage

on: [push, pull_request]

jobs:
  test:
    if: false == contains(github.event.pull_request.title, 'WIP')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-15]
        python-version: ['3.10', '3.11', '3.12']
    env:
      OS: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@master
    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@master
      with:
        python-version: ${{ matrix.python-version }}
    - name: Update setuptools
      run: |
        pip install setuptools==78.1.1 wheel==0.45.1
    - name: Install Dev Dependencies
      run: |
        pip install -q -e .[dev]
        pip install coverage pytest
    - name: Run tests with coverage
      run: |
        coverage run -m pytest tests
    - name: Generate coverage report
      run: |
        coverage report -m

================================================
FILE: .github/workflows/update_news.yml
================================================
name: Update NEWS in README
on:
  push:
    paths:
      - 'docs/NEWS.md'
      - 'docs/NEWS_zh.md'
    branches-ignore:
      - 'main'

# Prevent concurrent runs that modify README files
concurrency:
  group: readme-updates-${{ github.ref }}
  cancel-in-progress: false

jobs:
  updateNews:
    name: NEWS Updater
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.10'

      - name: Update NEWS in README files
        run: python .github/scripts/update_news.py

      - name: Commit changes
        run: |
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git add README.md README_zh.md
          git diff --staged --quiet || git commit -m "docs: auto-sync NEWS section to README files"
          git push



================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.idea/

# macOS
.DS_Store

# docs
docs/tutorial/en/build/
docs/tutorial/zh_CN/build/

# Sphinx build artifacts
docs/tutorial/**/doctrees/
docs/tutorial/**/.doctrees/
*.buildinfo
*.pickle

node_modules/
package-lock.json
*.tsbuildinfo
.wireit/
.angular/
uv.lock

================================================
FILE: .pre-commit-config.yaml
================================================
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.3.0
    hooks:
      - id: check-ast
      - id: sort-simple-yaml
      - id: check-yaml
        exclude: |
          (?x)^(
              meta.yaml
          )$
      - id: check-xml
      - id: check-toml
      - id: check-docstring-first
      - id: check-json
      - id: fix-encoding-pragma
      - id: detect-private-key
      - id: trailing-whitespace
  - repo: https://github.com/asottile/add-trailing-comma
    rev: v3.1.0
    hooks:
      - id: add-trailing-comma
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.7.0
    hooks:
      - id: mypy
        exclude:
            (?x)(
                pb2\.py$
                | grpc\.py$
                | ^docs
                | \.html$
            )
        args: [ --disallow-untyped-defs,
                --disallow-incomplete-defs,
                --ignore-missing-imports,
                --disable-error-code=var-annotated,
                --disable-error-code=union-attr,
                --disable-error-code=assignment,
                --disable-error-code=attr-defined,
                --disable-error-code=import-untyped,
                --disable-error-code=truthy-function,
                --disable-error-code=typeddict-item,
                --follow-imports=skip,
                --explicit-package-bases,
                ]
  # - repo: https://github.com/numpy/numpydoc
  #   rev: v1.6.0
  #   hooks:
  #     - id: numpydoc-validation
  - repo: https://github.com/psf/black
    rev: 23.3.0
    hooks:
    - id: black
      args: [--line-length=79]
  - repo: https://github.com/PyCQA/flake8
    rev: 6.1.0
    hooks:
      - id: flake8
        args: ["--extend-ignore=E203"]
        exclude: ^docs
  - repo: https://github.com/pylint-dev/pylint
    rev: v3.0.2
    hooks:
      - id: pylint
        exclude:
            (?x)(
                ^docs
                | pb2\.py$
                | grpc\.py$
                | \.demo$
                | \.md$
                | \.html$
                | ^examples/paper_llm_based_algorithm/
          )
        args: [
          --disable=W0511,
          --disable=W0718,
          --disable=W0122,
          --disable=C0103,
          --disable=R0913,
          --disable=E0401,
          --disable=E1101,
          --disable=C0415,
          --disable=W0603,
          --disable=R1705,
          --disable=R0914,
          --disable=E0601,
          --disable=W0602,
          --disable=W0604,
          --disable=R0801,
          --disable=R0902,
          --disable=R0903,
          --disable=C0123,
          --disable=W0231,
          --disable=W1113,
          --disable=W0221,
          --disable=R0401,
          --disable=W0632,
          --disable=W0123,
          --disable=C3001,
        ]
  - repo: https://github.com/regebro/pyroma
    rev: "5.0"
    hooks:
      - id: pyroma
        args: [--min=10, .]


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to AgentScope

## Welcome! 🎉

Thank you for your interest in contributing to AgentScope! As an open-source project, we warmly welcome and encourage
contributions from the community. Whether you're fixing bugs, adding new features, improving documentation, or sharing
ideas, your contributions help make AgentScope better for everyone.

## How to Contribute

To ensure smooth collaboration and maintain the quality of the project, please follow these guidelines when contributing:

### 1. Check Existing Plans and Issues

Before starting your contribution, please review our development roadmap:

- **Check the [Projects](https://github.com/orgs/agentscope-ai/projects/2) page** and **[Issues with `roadmap` label](https://github.com/agentscope-ai/agentscope/issues?q=is%3Aissue%20state%3Aopen%20label%3ARoadmap)** to see our planned development tasks.

  - **If a related issue exists** and is marked as unassigned or open:
    - Please comment on the issue to express your interest in working on it
    - This helps avoid duplicate efforts and allows us to coordinate development

  - **If no related issue exists**:
    - Please create a new issue describing your proposed changes or feature
    - Our team will respond promptly to provide feedback and guidance
    - This helps us maintain the project roadmap and coordinate community efforts

### 2. Commit Message Format

We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This leads to more readable
commit history and enables automatic changelog generation.

**Format:**
```
<type>(<scope>): <subject>
```

**Types:**
- `feat:` A new feature
- `fix:` A bug fix
- `docs:` Documentation only changes
- `style:` Changes that do not affect the meaning of the code (white-space, formatting, etc)
- `refactor:` A code change that neither fixes a bug nor adds a feature
- `perf:` A code change that improves performance
- `ci:` Adding missing tests or correcting existing tests
- `chore:` Changes to the build process or auxiliary tools and libraries

**Examples:**
```bash
feat(models): add support for Claude-3 model
fix(agent): resolve memory leak in ReActAgent
docs(readme): update installation instructions
refactor(formatter): simplify message formatting logic
ci(models): add unit tests for OpenAI integration
```

### 3. Pull Request Title Format

Pull request titles must follow the same [Conventional Commits](https://www.conventionalcommits.org/) specification:

**Format:**
```
<type>(<scope>): <description>
```

**Requirements:**
- The title must start with one of the allowed types: `feat`, `fix`, `docs`, `ci`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `revert`
- Scope is optional but recommended
- **Scope must be lowercase** - only lowercase letters, numbers, hyphens (`-`), and underscores (`_`) are allowed
- Description should start with a lowercase letter
- Keep the title concise and descriptive

**Examples:**
```
✅ Valid:
feat(memory): add redis cache support
fix(agent): resolve memory leak in ReActAgent
docs(tutorial): update installation guide
ci(workflow): add PR title validation
refactor(my-feature): simplify logic

❌ Invalid:
feat(Memory): add cache          # Scope must be lowercase
feat(MEMORY): add cache          # Scope must be lowercase
feat(MyFeature): add feature     # Scope must be lowercase
```

**Automated Validation:**
- PR titles targeting the `main` branch are automatically validated by GitHub Actions
- PRs with invalid titles will be blocked until the title is corrected

### 4. Code Development Guidelines

#### a. Pre-commit Checks

Before submitting code, you must run pre-commit hooks to ensure code quality and consistency:

**Installation:**
```bash
pip install pre-commit
pre-commit install
```

**Running pre-commit:**
```bash
# Run on all files
pre-commit run --all-files

# Pre-commit will automatically run on git commit after installation
```

#### b. Import Statement Guidelines

AgentScope follows a **lazy import principle** to minimize resource loading:

- **DO**: Import modules only when they are actually used
  ```python
  def some_function():
      import openai
      # Use openai library here
  ```

This approach ensures that `import agentscope` remains lightweight and doesn't load unnecessary dependencies.

#### c. Unit Tests

- All new features must include appropriate unit tests
- Ensure existing tests pass before submitting your PR
- Run tests using:
  ```bash
  pytest tests
  ```

#### d. Documentation

- Update relevant documentation for new features
- Include code examples where appropriate
- Update the README.md if your changes affect user-facing functionality


## Types of Contributions

### Adding New Chat Models

AgentScope currently supports the following API providers at the chat model level: **OpenAI**, **DashScope**,
**Gemini**, **Anthropic**, and **Ollama**. These APIs are compatible with various service providers including vLLM,
DeepSeek, SGLang, and others.

**⚠️ Important Notice:**

Adding a new chat model is not merely a model-level task. It involves multiple components including:
- Message formatters
- Token counters
- Tools API integration

This is a substantial amount of work. To better focus our efforts on agent capability development and maintenance,
**the official development team currently does not plan to add support for new chat model APIs**. However, when there
is a strong need from the developer community, we will do our best to accommodate these requirements.

**If you wish to contribute a new chat model**, here are the components needed to be compatible with the
existing `ReActAgent` in the repository:

#### Required Components:

1. **Chat Model Class** (under `agentscope.model`):
   ```python
   from agentscope.model import ChatModelBase


   class YourChatModel(ChatModelBase):
       """
       The functionalities that you need to consider include:
       - Tools API integration
       - Both streaming and non-streaming modes (compatible with tools API)
       - tool_choice argument
       - reasoning models
       """
   ```

2. **Formatter Class** (under `agentscope.formatter`):
   ```python
   from agentscope.formatter import FormatterBase

   class YourModelFormatter(FormatterBase):
       """
       Convert `Msg` objects into the format required by your API provider.
       If your API doesn't support multi-agent scenarios (e.g. doesn't support the name field in messages), you need to
       implement two separate formatter classes for chatbot and multi-agent scenarios.
       """
   ```

3. **Token Counter** (under `agentscope.token`, recommended):
   ```python
   from agentscope.token import TokenCounterBase

   class YourTokenCounter(TokenCounterBase):
       """
       Implement token counting logic for your model.
       This is recommended but not strictly required.
       """
   ```

### Adding New Agents

To achieve true modularity, the `agentscope.agent` module currently aims to maintain only the **`ReActAgent`** class
as the core implementation. We ensure all functionalities in this class are **modular, detachable, and composable**.

In AgentScope, we follow an examples-first development workflow: prototype new implementations in the `examples/`
directory, then abstract and modularize the functionality, and finally integrate it into the core library.

For specialized or domain-specific agents, we recommend contributing them to the **`examples/agents`** directory:

```
examples/
└── agents/
    ├── main.py
    ├── README.md  # Explain the agent's purpose and usage
    └── ... # The other scripts
```

### Adding New Examples

We highly encourage contributions of new examples that showcase the capabilities of AgentScope! Your examples help others learn and get inspired.

**📝 About the Examples Directory:**

To maintain code quality and keep the repository accessible for everyone, we've designed the `examples/` directory in the main AgentScope repository to focus on **demonstrating AgentScope's functionalities**. Think of these as educational references and feature showcases that help developers quickly understand what AgentScope can do.

**What makes a great example here:**
- Clearly demonstrates specific AgentScope features or capabilities
- Easy to understand and follow along
- Serves as a learning material or reference implementation
- Focused and concise

**For More Complex Applications:**

Have you built something amazing with AgentScope? Perhaps a more sophisticated, production-ready application? That's fantastic! 🎉

We'd love to see your work in our **[agentscope-samples](https://github.com/agentscope-ai/agentscope-samples)** repository. This dedicated space is perfect for showcasing complete, real-world applications and sharing your AgentScope-based projects with the community. It's a great way to inspire others and demonstrate the full potential of the AgentScope ecosystem!

**Example Organization:**

Examples in the main repository are organized into subdirectories based on their type:

- `examples/agent/` for specialized agents
- `examples/functionality/` for showcasing specific functionalities of AgentScope
- `examples/game/` for game-related examples
- `examples/evaluation/` for evaluation scripts
- `examples/workflows/` for workflow demonstrations
- `examples/tuner/` for tuning-related examples

An example structure could be:

```
examples/
└── {example_type}/
    └── {example_name}/
        ├── main.py
        ├── README.md  # Explain the example's purpose and usage
        └── ... # The other scripts
```

### Adding New Memory Databases

The memory module in AgentScope currently supports:

- **In-memory storage**: For lightweight, temporary memory needs
- **Relational databases via SQLAlchemy**: For persistent, structured data storage
- **NoSQL databases**: For flexible schema requirements (e.g., Redis)

**⚠️ Important Notice:**

For **relational databases**, we use **SQLAlchemy** as a unified abstraction layer. SQLAlchemy already supports a wide
range of SQL databases including PostgreSQL, MySQL, SQLite, Oracle, Microsoft SQL Server, and many others.

**Therefore, we do not accept separate implementations for relational databases that are already supported by SQLAlchemy.**
If you need support for a specific relational database, please ensure it works through the existing SQLAlchemy integration.

**If you wish to contribute a new memory database implementation**, please consider:

1. **For relational databases**: Use the existing SQLAlchemy integration.

2. **For NoSQL databases**: If you're adding support for a new NoSQL database (e.g., MongoDB, Cassandra), please:
   - Implement a new memory class that extends the appropriate base class
   - Add comprehensive unit tests
   - Update documentation accordingly


## Do's and Don'ts

### ✅ DO:

- **Start small**: Begin with small, manageable contributions
- **Communicate early**: Discuss major changes before implementing them
- **Write tests**: Ensure your code is well-tested
- **Document your code**: Help others understand your contributions
- **Follow commit conventions**: Use conventional commit messages
- **Be respectful**: Follow our Code of Conduct
- **Ask questions**: If you're unsure about something, just ask!

### ❌ DON'T:

- **Don't surprise us with big pull requests**: Large, unexpected PRs are difficult to review and may not align with project goals. Always open an issue first to discuss major changes
- **Don't ignore CI failures**: Fix any issues flagged by continuous integration
- **Don't mix concerns**: Keep PRs focused on a single feature or fix
- **Don't forget to update tests**: Changes in functionality should be reflected in tests
- **Don't break existing APIs**: Maintain backward compatibility when possible, or clearly document breaking changes
- **Don't add unnecessary dependencies**: Keep the core library lightweight
- **Don't bypass the lazy import principle**: This keeps AgentScope fast to import

## Getting Help

If you need assistance or have questions:

- 💬 Open a [Discussion](https://github.com/agentscope-ai/agentscope/discussions)
- 🐛 Report bugs via [Issues](https://github.com/agentscope-ai/agentscope/issues)
- 📧 Contact the maintainers at DingTalk or Discord (links in the README.md)


---

Thank you for contributing to AgentScope! Your efforts help build a better tool for the entire community. 🚀


================================================
FILE: CONTRIBUTING_zh.md
================================================
# 贡献到 AgentScope

## 欢迎!🎉

感谢开源社区对 AgentScope 项目的关注和支持,作为一个开源项目,我们热烈欢迎并鼓励来自社区的贡献。无论是修复错误、添加新功能、改进文档还是
分享想法,这些贡献都能帮助 AgentScope 变得更好。

## 如何贡献

为了确保顺利协作并保持项目质量,请在贡献时遵循以下指南:

### 1. 检查现有计划和问题

在开始贡献之前,请查看我们的开发路线图:

- **查看 [Projects](https://github.com/orgs/agentscope-ai/projects/2) 页面** 和 **[带有 `roadmap` 标签的 Issues](https://github.com/agentscope-ai/agentscope/issues?q=is%3Aissue%20state%3Aopen%20label%3ARoadmap)** 以了解我们计划的开发任务。

  - **如果存在相关问题** 并且标记为未分配或开放状态:
    - 请在该问题下评论,表达您有兴趣参与该任务
    - 这有助于协调开发工作,避免重复工作

  - **如果不存在相关问题**:
    - 请创建一个新 issue 用以描述对应的更改或功能
    - 我们的团队将及时进行回复并提供反馈
    - 这有助于我们维护项目路线图并协调社区工作

### 2. 提交信息格式

AgentScope 遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范。这使得提交历史更易读,并能够自动生成更新日志。

**格式:**
```
<type>(<scope>): <subject>
```

**类型:**
- `feat:` 新功能
- `fix:` 错误修复
- `docs:` 仅文档更改
- `style:` 不影响代码含义的更改(空格、格式等)
- `refactor:` 既不修复错误也不添加功能的代码更改
- `perf:` 提高性能的代码更改
- `ci:` 添加缺失的测试或更正现有测试
- `chore:` 对构建过程或辅助工具和库的更改

**示例:**
```bash
feat(models): add support for Claude-3 model
fix(agent): resolve memory leak in ReActAgent
docs(readme): update installation instructions
refactor(formatter): simplify message formatting logic
ci(models): add unit tests for OpenAI integration
```

### 3. Pull Request 标题格式

Pull Request 标题必须遵循相同的 [Conventional Commits](https://www.conventionalcommits.org/) 规范:

**格式:**
```
<type>(<scope>): <description>
```

**要求:**
- 标题必须以允许的类型之一开头:`feat`、`fix`、`docs`、`ci`、`refactor`、`test`、`chore`、`perf`、`style`、`build`、`revert`
- Scope 是可选的但建议添加
- **Scope 必须是小写** - 只允许小写字母、数字、连字符(`-`)和下划线(`_`)
- 描述应以小写字母开头
- 保持标题简洁且具有描述性

**示例:**
```
✅ 有效:
feat(memory): add redis cache support
fix(agent): resolve memory leak in ReActAgent
docs(tutorial): update installation guide
ci(workflow): add PR title validation
refactor(my-feature): simplify logic

❌ 无效:
feat(Memory): add cache          # Scope 必须是小写
feat(MEMORY): add cache          # Scope 必须是小写
feat(MyFeature): add feature     # Scope 必须是小写
```

**自动化验证:**
- 针对 `main` 分支的 PR 标题会通过 GitHub Actions 自动验证
- 标题无效的 PR 将被阻止,直到标题被修正

### 4. 代码开发指南

#### a. 提交前检查

在提交代码之前,请运行 pre-commit 钩子以确保代码质量和一致性:


```bash
pip install pre-commit
pre-commit install
```

**运行 pre-commit:**
```bash
# 在所有文件上运行
pre-commit run --all-files

# 安装后,pre-commit 将在 git commit 时自动运行
```

#### b. 关于代码中的 Import

AgentScope 遵循**懒加载导入原则**以最小化资源加载:

- **推荐做法**:仅在实际使用时导入模块
  ```python
  def some_function():
      import openai
      # 在此处使用 openai 库
  ```

这种方法确保 `import agentscope` 是一个轻量操作,不会加载不必要的依赖项。

#### c. 单元测试

- 所有新功能都必须包含适当的单元测试
- 在提交 PR 之前确保现有测试通过
- 使用以下命令运行测试:
  ```bash
  pytest tests
  ```

#### d. 文档

- 为新功能更新相关文档
- 在适当的地方包含代码示例
- 如果更改影响面向用户的功能,请更新 README.md


## 贡献类型

### 添加新的 ChatModel

AgentScope 目前内置支持以下 API 提供商:**OpenAI**、**DashScope**、**Gemini**、**Anthropic** 和 **Ollama**。
其中 `OpenAIChatModel` 的实现还兼容不同的服务提供商,如 vLLM,DeepSeek、SGLang 等。

**⚠️ 重要:**

添加新的 ChatModel 不仅涉及模型层面的实现,还涉及到其它组件的配合,具体包括:
- 消息格式化器(formatter)
- Token 计数器(token counter)
- Tools API 集成

这意味着添加一个 ChatModel 需要大量的工作来确保其与 AgentScope 生态系统的其他部分无缝集成。
为了更好地专注于智能体能力开发和维护,**官方开发团队目前不计划添加对新 API 的支持**。
但是当开发者社区有强烈需求时,我们将尽力满足这些需求。

**对于一个 ChatModel 类的实现**,为了与仓库中 `ReActAgent` 兼容,所需要实现的组件如下:

#### 必需组件:

1. **ChatModel**(位于 `agentscope.model` 下):
   ```python
   from agentscope.model import ChatModelBase


   class YourChatModel(ChatModelBase):
       """
       需要考虑的功能包括:
       - 集成 tools API
       - 支持流式和非流式模式,并与 tools API 兼容
       - 支持 tool_choice 参数
       - 考虑支持推理模型
       """
   ```

2. **格式化器类**(位于 `agentscope.formatter` 下):
   ```python
   from agentscope.formatter import FormatterBase

   class YourModelFormatter(FormatterBase):
       """
       将 `Msg` 对象转换为对应 API 提供商所需的格式。
       如果模型 API 不支持多智能体场景(例如不支持消息中的 name 字段),需要
       为 chatbot 和多智能体场景分别实现两个格式化器类。
       """
   ```

3. **Token 计数器**(位于 `agentscope.token` 下,推荐):
   ```python
   from agentscope.token import TokenCounterBase

   class YourTokenCounter(TokenCounterBase):
       """
       为对应模型实现 token 计数逻辑(推荐实现,非严格要求)。
       """
   ```

### 添加新的智能体

为了确保 AgentScope 中所有的功能实现都是**模块化的、可拆卸的和可组合的**,`agentscope.agent` 模块目前仅维护 **`ReActAgent`** 类作为核心实现。

在 AgentScope 中,我们遵循示例优先的开发工作流程:

- 在 `examples/` 目录中初步实现新的功能
- 然后将重要功能抽象和模块化,集成到核心库中
- 修改 `examples/` 目录中的示例以使用新的核心功能

对于专门的或特定领域的智能体,我们建议按照以下组织形式将它们贡献到 **`examples/agent`** 目录:

```
examples/
└── agent/
    ├── main.py
    ├── README.md  # 解释智能体的目的和用法
    └── ... # 其他脚本
```

### 添加新的示例

欢迎开源社区贡献新的示例来展示 AgentScope 的各种功能!

**📝 关于示例目录:**

为了避免仓库变得过于臃肿,我们将 AgentScope 仓库中的 `examples/` 目录设计为专注于**展示 AgentScope 的功能性**。可以把这些示例看作是指导性的参考和功能展示,帮助开发者快速理解 AgentScope 能做什么。

**什么样的示例适合放在这里:**
- 清晰地展示 AgentScope 的特定功能或能力
- 易于理解和跟随学习
- 作为学习材料或参考实现
- 专注且简洁

**对于更复杂的应用:**

对于更加复杂,生产就绪的应用,我们非常期待在 **[agentscope-samples](https://github.com/agentscope-ai/agentscope-samples)** 仓库中看到您的作品。这个仓库专门用于展示、分享基于 AgentScope 生态搭建的完整的、真实世界的应用。

**示例组织方式:**

主仓库中的示例根据类型组织到子目录中:

- `examples/agent/` 用于专门的智能体
- `examples/functionality/` 用于展示 AgentScope 的特定功能
- `examples/game/` 用于游戏相关示例
- `examples/evaluation/` 用于评估脚本
- `examples/workflows/` 用于工作流演示
- `examples/tuner/` 用于微调相关示例

示例结构如下:

```
examples/
└── {example_type}/
    └── {example_name}/
        ├── main.py
        ├── README.md  # 解释示例的目的和用法
        └── ... # 其他脚本
```

### 添加新的记忆数据库

AgentScope 的记忆模块目前支持:

- **内存存储**:用于轻量级的临时记忆需求
- **通过 SQLAlchemy 支持关系型数据库**:用于持久化的结构化数据存储
- **NoSQL 数据库**:用于灵活的模式需求(例如 Redis)

**⚠️ 请注意:**

对于**关系型数据库**,我们使用 **SQLAlchemy** 作为统一的抽象层。SQLAlchemy 已经支持多种 SQL 数据库,包括 PostgreSQL、MySQL、SQLite、Oracle、Microsoft SQL Server 等。

**因此,为了保持 AgentScope 代码的整洁,目前不接受为 SQLAlchemy 已经支持的关系型数据库单独实现新的支持。**
如果您需要支持特定的关系型数据库,请确保通过现有的 SQLAlchemy 集成来实现。

**如果您希望贡献新的记忆数据库实现**,请考虑以下几点:

1. **对于关系型数据库**:使用现有的 SQLAlchemy 集成。

2. **对于 NoSQL 数据库**:如果您要添加对新 NoSQL 数据库的支持(例如 MongoDB、Cassandra),请:
   - 实现一个扩展适当基类的新记忆类
   - 添加全面的单元测试
   - 相应地更新文档


## Do's and Don'ts

### ✅ DO

- **从小处着手**:从小的、可管理的贡献开始
- **及早沟通**:在实现主要功能之前进行讨论
- **编写测试**:确保代码经过充分测试
- **添加代码注释**:帮助他人理解贡献内容
- **遵循提交约定**:使用约定式提交消息
- **保持尊重**:遵守我们的行为准则
- **提出问题**:如果不确定某事,请提问!

### ❌ DON'T

- **不要用大型 PR 让我们措手不及**:大型的、意外的 PR 难以审查,并且可能与项目目标不一致。在进行重大更改之前,请务必先开启一个问题进行讨论
- **不要忽略 CI 失败**:修复持续集成标记的任何问题
- **不要混合关注点**:保持 PR 专注于单一功能的实现或修复
- **不要忘记更新测试**:功能的更改应反映在测试中
- **不要破坏现有 API**:在可能的情况下保持向后兼容性,或清楚地记录破坏性更改
- **不要添加不必要的依赖项**:保持核心库轻量级
- **不要绕过懒加载导入原则**:确保 AgentScope 在导入阶段不至于臃肿

## 获取帮助

如果需要帮助或有疑问:

- 💬 开启一个 [Discussion](https://github.com/agentscope-ai/agentscope/discussions)
- 🐛 通过 [Issues](https://github.com/agentscope-ai/agentscope/issues) 报告错误
- 📧 通过钉钉交流群或 Discord 联系开发团队(链接在 README.md 中)


---

感谢为 AgentScope 做出贡献!🚀



================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2024 Alibaba

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.



--------------------------------------------------------------------------------


Some codes of tests/run.py is modified from
https://github.com/alibaba/FederatedScope/blob/master/tests/run.py, which is
also licensed under the terms of the Apache 2.0.


--------------------------------------------------------------------------------

Code in src/agentscope/web/static/js/socket.io.js is adapted from
https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.3/socket.io.js (MIT License)

Copyright (c) 2014-2021 Guillermo Rauch

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

Code in src/agentscope/web/static/js/jquery-3.3.1.min.js is adapted from
https://code.jquery.com/jquery-3.3.1.min.js (MIT License)

Copyright (c) JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

Code in src/agentscope/web/static/js/bootstrap.bundle.min.js is adapted from
https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.bundle.min.js
 (MIT License)

Copyright (c) 2011-2019 The Bootstrap Authors (https://github
.com/twbs/bootstrap/graphs/contributors)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

Code in src/agentscope/web/static/js/bootstrap-table.min.js is adapted from
https://unpkg.com/bootstrap-table@1.18.0/dist/bootstrap-table.min.js (MIT
License)

Copyright (c) wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------

Code in src/agentscope/web/static/css/bootstrap.min.css is adapted from
https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css (MIT
License)

Copyright 2011-2019 The Bootstrap Authors
Copyright 2011-2019 Twitter, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------

Fonts in src/agentscope/web/static/fonts/KRYPTON.ttf is adapted from
https://github.com/githubnext/monaspace (SIL Open Font License 1.1). These
fonts are distributed with their original license. See https://github
.com/githubnext/monaspace/blob/main/LICENSE for the full text of the license.
The following font families are included:

- Monaspace (with subfamilies: Krypton)

Copyright (c) 2023, GitHub https://github.com/githubnext/monaspace
with Reserved Font Name "Monaspace", including subfamilies: "Argon", "Neon",
"Xenon", "Radon", and "Krypton"

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

--------------------------------------------------------------------------------

Fonts in src/agentscope/web/static/fonts/OSWALD.ttf is adapted from
https://fonts.google.com/specimen/Oswald (SIL Open Font License 1.1). These
fonts are distributed with their original license. See https://github
.com/googlefonts/OswaldFont/blob/main/OFL.txt for the full text of the license.

Copyright 2016 The Oswald Project Authors (https://github
.com/googlefonts/OswaldFont)

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

--------------------------------------------------------------------------------

================================================
FILE: README.md
================================================
<p align="center">
  <img
    src="https://img.alicdn.com/imgextra/i1/O1CN01nTg6w21NqT5qFKH1u_!!6000000001621-55-tps-550-550.svg"
    alt="AgentScope Logo"
    width="200"
  />
</p>

<span align="center">

[**中文主页**](https://github.com/agentscope-ai/agentscope/blob/main/README_zh.md) | [**Tutorial**](https://doc.agentscope.io/) | [**Roadmap (Jan 2026 -)**](https://github.com/agentscope-ai/agentscope/blob/main/docs/roadmap.md) | [**FAQ**](https://doc.agentscope.io/tutorial/faq.html)

</span>

<p align="center">
    <a href="https://arxiv.org/abs/2402.14034">
        <img
            src="https://img.shields.io/badge/cs.MA-2402.14034-B31C1C?logo=arxiv&logoColor=B31C1C"
            alt="arxiv"
        />
    </a>
    <a href="https://pypi.org/project/agentscope/">
        <img
            src="https://img.shields.io/badge/python-3.10+-blue?logo=python"
            alt="pypi"
        />
    </a>
    <a href="https://pypi.org/project/agentscope/">
        <img
            src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Fagentscope%2Fjson&query=%24.info.version&prefix=v&logo=pypi&label=version"
            alt="pypi"
        />
    </a>
    <a href="https://discord.gg/eYMpfnkG8h">
        <img
            src="https://img.shields.io/discord/1194846673529213039?label=Discord&logo=discord"
            alt="discord"
        />
    </a>
    <a href="https://doc.agentscope.io/">
        <img
            src="https://img.shields.io/badge/Docs-English%7C%E4%B8%AD%E6%96%87-blue?logo=markdown"
            alt="docs"
        />
    </a>
    <a href="./LICENSE">
        <img
            src="https://img.shields.io/badge/license-Apache--2.0-black"
            alt="license"
        />
    </a>
</p>

<p align="center">
<img src="https://trendshift.io/api/badge/repositories/10079" alt="modelscope%2Fagentscope | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</p>

## What is AgentScope?

AgentScope is a production-ready, easy-to-use agent framework with essential abstractions that work with rising model capability and built-in support for finetuning.

We design for increasingly agentic LLMs.
Our approach leverages the models' reasoning and tool use abilities
rather than constraining them with strict prompts and opinionated orchestrations.

## Why use AgentScope?

- **Simple**: start building your agents in 5 minutes with built-in ReAct agent, tools, skills, human-in-the-loop steering, memory, planning, realtime voice, evaluation and model finetuning
- **Extensible**: large number of ecosystem integrations for tools, memory and observability; built-in support for MCP and A2A; message hub for flexible multi-agent orchestration and workflows
- **Production-ready**: deploy and serve your agents locally, as serverless in the cloud, or on your K8s cluster with built-in OTel support


<p align="center">
<img src="./assets/images/agentscope.png" width="90%" />
<br/>
The AgentScope Ecosystem
</p>


## News
<!-- BEGIN NEWS -->
- **[2026-02] `FEAT`:** Realtime Voice Agent support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [Multi-Agent Realtime Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime) | [Tutorial](https://doc.agentscope.io/tutorial/task_realtime.html)
- **[2026-01] `COMM`:** Biweekly Meetings launched to share ecosystem updates and development plans - join us! [Details & Schedule](https://github.com/agentscope-ai/agentscope/discussions/1126)
- **[2026-01] `FEAT`:** Database support & memory compression in memory module. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression) | [Tutorial](https://doc.agentscope.io/tutorial/task_memory.html)
- **[2025-12] `INTG`:** A2A (Agent-to-Agent) protocol support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent) | [Tutorial](https://doc.agentscope.io/tutorial/task_a2a.html)
- **[2025-12] `FEAT`:** TTS (Text-to-Speech) support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts) | [Tutorial](https://doc.agentscope.io/tutorial/task_tts.html)
- **[2025-11] `INTG`:** Anthropic Agent Skill support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill) | [Tutorial](https://doc.agentscope.io/tutorial/task_agent_skill.html)
- **[2025-11] `RELS`:** Alias-Agent for diverse real-world tasks and Data-Juicer Agent for data processing open-sourced. [Alias-Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/alias) | [Data-Juicer Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/data_juicer_agent)
- **[2025-11] `INTG`:** Agentic RL via Trinity-RFT library. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent) | [Trinity-RFT](https://github.com/agentscope-ai/Trinity-RFT)
- **[2025-11] `INTG`:** ReMe for enhanced long-term memory. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory/reme)
- **[2025-11] `RELS`:** agentscope-samples repository launched and agentscope-runtime upgraded with Docker/K8s deployment and VNC-powered GUI sandboxes. [Samples](https://github.com/agentscope-ai/agentscope-samples) | [Runtime](https://github.com/agentscope-ai/agentscope-runtime)
<!-- END NEWS -->

[More news →](./docs/NEWS.md)

## Community

Welcome to join our community on

| [Discord](https://discord.gg/eYMpfnkG8h)                                                                                         | DingTalk                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| <img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"> | <img src="./assets/images/dingtalk_qr_code.png" width="100" height="100"> |

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## 📑 Table of Contents

- [Quickstart](#quickstart)
  - [Installation](#installation)
    - [From PyPI](#from-pypi)
    - [From source](#from-source)
- [Example](#example)
  - [Hello AgentScope!](#hello-agentscope)
  - [Voice Agent](#voice-agent)
  - [Realtime Voice Agent](#realtime-voice-agent)
  - [Human-in-the-loop](#human-in-the-loop)
  - [Flexible MCP Usage](#flexible-mcp-usage)
  - [Agentic RL](#agentic-rl)
  - [Multi-Agent Workflows](#multi-agent-workflows)
- [Documentation](#documentation)
- [More Examples & Samples](#more-examples--samples)
  - [Functionality](#functionality)
  - [Agent](#agent)
  - [Game](#game)
  - [Workflow](#workflow)
  - [Evaluation](#evaluation)
  - [Tuner](#tuner)
- [Contributing](#contributing)
- [License](#license)
- [Publications](#publications)
- [Contributors](#contributors)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Quickstart

### Installation

> AgentScope requires **Python 3.10** or higher.

#### From PyPI

```bash
pip install agentscope
```

Or with uv:

```bash
uv pip install agentscope
```

#### From source

```bash
# Pull the source code from GitHub
git clone -b main https://github.com/agentscope-ai/agentscope.git

# Install the package in editable mode
cd agentscope

pip install -e .
# or with uv:
# uv pip install -e .
```


## Example

### Hello AgentScope!

Start with a conversation between user and a ReAct agent 🤖 named "Friday"!

```python
from agentscope.agent import ReActAgent, UserAgent
from agentscope.model import DashScopeChatModel
from agentscope.formatter import DashScopeChatFormatter
from agentscope.memory import InMemoryMemory
from agentscope.tool import Toolkit, execute_python_code, execute_shell_command
import os, asyncio


async def main():
    toolkit = Toolkit()
    toolkit.register_tool_function(execute_python_code)
    toolkit.register_tool_function(execute_shell_command)

    agent = ReActAgent(
        name="Friday",
        sys_prompt="You're a helpful assistant named Friday.",
        model=DashScopeChatModel(
            model_name="qwen-max",
            api_key=os.environ["DASHSCOPE_API_KEY"],
            stream=True,
        ),
        memory=InMemoryMemory(),
        formatter=DashScopeChatFormatter(),
        toolkit=toolkit,
    )

    user = UserAgent(name="user")

    msg = None
    while True:
        msg = await agent(msg)
        msg = await user(msg)
        if msg.get_text_content() == "exit":
            break

asyncio.run(main())
```

### Voice Agent

Create a voice-enabled ReAct agent that can understand and respond with speech, even playing a multi-agent werewolf game with voice interactions.


https://github.com/user-attachments/assets/c5f05254-aff6-4375-90df-85e8da95d5da


### Realtime Voice Agent

Build a realtime voice agent with web interface that can interact with users via voice input and output.

[Realtime chatbot](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [Realtime Multi-Agent Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime)

https://github.com/user-attachments/assets/1b7b114b-e995-4586-9b3f-d3bb9fcd2558



### Human-in-the-loop

Support realtime interruption in ReActAgent: conversation can be interrupted via cancellation in realtime and resumed
seamlessly via robust memory preservation.

<img src="./assets/images/realtime_steering_en.gif" alt="Realtime Steering" width="60%"/>

### Flexible MCP Usage

Use individual MCP tools as **local callable functions** to compose toolkits or wrap into a more complex tool.

```python
from agentscope.mcp import HttpStatelessClient
from agentscope.tool import Toolkit
import os

async def fine_grained_mcp_control():
    # Initialize the MCP client
    client = HttpStatelessClient(
        name="gaode_mcp",
        transport="streamable_http",
        url=f"https://mcp.amap.com/mcp?key={os.environ['GAODE_API_KEY']}",
    )

    # Obtain the MCP tool as a **local callable function**, and use it anywhere
    func = await client.get_callable_function(func_name="maps_geo")

    # Option 1: Call directly
    await func(address="Tiananmen Square", city="Beijing")

    # Option 2: Pass to agent as a tool
    toolkit = Toolkit()
    toolkit.register_tool_function(func)
    # ...

    # Option 3: Wrap into a more complex tool
    # ...
```

### Agentic RL

Train your agentic application seamlessly with Reinforcement Learning integration. We also prepare multiple sample projects covering various scenarios:

| Example                                                                                          | Description                                                 | Model                  | Training Result             |
|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------|------------------------|-----------------------------|
| [Math Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/math_agent)     | Tune a math-solving agent with multi-step reasoning.        | Qwen3-0.6B             | Accuracy: 75% → 85%         |
| [Frozen Lake](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/frozen_lake)   | Train an agent to navigate the Frozen Lake environment.     | Qwen2.5-3B-Instruct    | Success rate: 15% → 86%     |
| [Learn to Ask](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/learn_to_ask) | Tune agents using LLM-as-a-judge for automated feedback.    | Qwen2.5-7B-Instruct    | Accuracy: 47% → 92%         |
| [Email Search](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/email_search) | Improve tool-use capabilities without labeled ground truth. | Qwen3-4B-Instruct-2507 | Accuracy: 60%               |
| [Werewolf Game](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/werewolves)  | Train agents for strategic multi-agent game interactions.   | Qwen2.5-7B-Instruct    | Werewolf win rate: 50% → 80% |
| [Data Augment](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/data_augment) | Generate synthetic training data to enhance tuning results. | Qwen3-0.6B             | AIME-24 accuracy: 20% → 60% |

### Multi-Agent Workflows

AgentScope provides ``MsgHub`` and pipelines to streamline multi-agent conversations, offering efficient message routing and seamless information sharing

```python
from agentscope.pipeline import MsgHub, sequential_pipeline
from agentscope.message import Msg
import asyncio

async def multi_agent_conversation():
    # Create agents
    agent1 = ...
    agent2 = ...
    agent3 = ...
    agent4 = ...

    # Create a message hub to manage multi-agent conversation
    async with MsgHub(
        participants=[agent1, agent2, agent3],
        announcement=Msg("Host", "Introduce yourselves.", "assistant")
    ) as hub:
        # Speak in a sequential manner
        await sequential_pipeline([agent1, agent2, agent3])
        # Dynamic manage the participants
        hub.add(agent4)
        hub.delete(agent3)
        await hub.broadcast(Msg("Host", "Goodbye!", "assistant"))

asyncio.run(multi_agent_conversation())
```


## Documentation

- [Tutorial](https://doc.agentscope.io/tutorial/)
- [FAQ](https://doc.agentscope.io/tutorial/faq.html)
- [API Docs](https://doc.agentscope.io/api/agentscope.html)

## More Examples & Samples

### Functionality

- [MCP](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/mcp)
- [Anthropic Agent Skill](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill)
- [Plan](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/plan)
- [Structured Output](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/structured_output)
- [RAG](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/rag)
- [Long-Term Memory](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory)
- [Session with SQLite](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/session_with_sqlite)
- [Stream Printing Messages](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/stream_printing_messages)
- [TTS](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts)
- [Code-first Deployment](https://github.com/agentscope-ai/agentscope/tree/main/examples/deployment/planning_agent)
- [Memory Compression](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression)

### Agent

- [ReAct Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/react_agent)
- [Voice Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/voice_agent)
- [Deep Research Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/deep_research_agent)
- [Browser-use Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/browser_agent)
- [Meta Planner Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/meta_planner_agent)
- [A2A Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent)
- [Realtime Voice Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent)

### Game

- [Nine-player Werewolves](https://github.com/agentscope-ai/agentscope/tree/main/examples/game/werewolves)

### Workflow

- [Multi-agent Debate](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_debate)
- [Multi-agent Conversation](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_conversation)
- [Multi-agent Concurrent](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_concurrent)
- [Multi-agent Realtime Conversation](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime)

### Evaluation

- [ACEBench](https://github.com/agentscope-ai/agentscope/tree/main/examples/evaluation/ace_bench)

### Tuner

- [Tune ReAct Agent](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent)


## Contributing

We welcome contributions from the community! Please refer to our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines
on how to contribute.

## License

AgentScope is released under Apache License 2.0.

## Publications

If you find our work helpful for your research or application, please cite our papers.

- [AgentScope 1.0: A Developer-Centric Framework for Building Agentic Applications](https://arxiv.org/abs/2508.16279)

- [AgentScope: A Flexible yet Robust Multi-Agent Platform](https://arxiv.org/abs/2402.14034)

```
@article{agentscope_v1,
    author  = {Dawei Gao, Zitao Li, Yuexiang Xie, Weirui Kuang, Liuyi Yao, Bingchen Qian, Zhijian Ma, Yue Cui, Haohao Luo, Shen Li, Lu Yi, Yi Yu, Shiqi He, Zhiling Luo, Wenmeng Zhou, Zhicheng Zhang, Xuguang He, Ziqian Chen, Weikai Liao, Farruh Isakulovich Kushnazarov, Yaliang Li, Bolin Ding, Jingren Zhou}
    title   = {AgentScope 1.0: A Developer-Centric Framework for Building Agentic Applications},
    journal = {CoRR},
    volume  = {abs/2508.16279},
    year    = {2025},
}

@article{agentscope,
    author  = {Dawei Gao, Zitao Li, Xuchen Pan, Weirui Kuang, Zhijian Ma, Bingchen Qian, Fei Wei, Wenhao Zhang, Yuexiang Xie, Daoyuan Chen, Liuyi Yao, Hongyi Peng, Zeyu Zhang, Lin Zhu, Chen Cheng, Hongzhu Shi, Yaliang Li, Bolin Ding, Jingren Zhou}
    title   = {AgentScope: A Flexible yet Robust Multi-Agent Platform},
    journal = {CoRR},
    volume  = {abs/2402.14034},
    year    = {2024},
}
```

## Contributors

All thanks to our contributors:

<a href="https://github.com/agentscope-ai/agentscope/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=agentscope-ai/agentscope&max=999&columns=12&anon=1" />
</a>


================================================
FILE: README_zh.md
================================================
<p align="center">
  <img
    src="https://img.alicdn.com/imgextra/i1/O1CN01nTg6w21NqT5qFKH1u_!!6000000001621-55-tps-550-550.svg"
    alt="AgentScope Logo"
    width="200"
  />
</p>

<span align="center">

[**English Homepage**](https://github.com/agentscope-ai/agentscope/blob/main/README.md) | [**Tutorial**](https://doc.agentscope.io/zh_CN/) | [**Roadmap (Jan 2026 -)**](https://github.com/agentscope-ai/agentscope/blob/main/docs/roadmap.md) | [**FAQ**](https://doc.agentscope.io/zh_CN/tutorial/faq.html)

</span>

<p align="center">
    <a href="https://arxiv.org/abs/2402.14034">
        <img
            src="https://img.shields.io/badge/cs.MA-2402.14034-B31C1C?logo=arxiv&logoColor=B31C1C"
            alt="arxiv"
        />
    </a>
    <a href="https://pypi.org/project/agentscope/">
        <img
            src="https://img.shields.io/badge/python-3.10+-blue?logo=python"
            alt="pypi"
        />
    </a>
    <a href="https://pypi.org/project/agentscope/">
        <img
            src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Fagentscope%2Fjson&query=%24.info.version&prefix=v&logo=pypi&label=version"
            alt="pypi"
        />
    </a>
    <a href="https://discord.gg/eYMpfnkG8h">
        <img
            src="https://img.shields.io/discord/1194846673529213039?label=Discord&logo=discord"
            alt="discord"
        />
    </a>
    <a href="https://doc.agentscope.io/">
        <img
            src="https://img.shields.io/badge/Docs-English%7C%E4%B8%AD%E6%96%87-blue?logo=markdown"
            alt="docs"
        />
    </a>
    <a href="./LICENSE">
        <img
            src="https://img.shields.io/badge/license-Apache--2.0-black"
            alt="license"
        />
    </a>
</p>

<p align="center">
<img src="https://trendshift.io/api/badge/repositories/10079" alt="modelscope%2Fagentscope | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</p>

## What is AgentScope?

AgentScope 是一款企业级开箱即用的智能体框架,提供灵活的核心抽象以适配不断进化的模型能力,并原生支持模型微调。

我们为新一代自主智能的大语言模型而生。 我们的理念是释放模型的推理与工具调用潜能,而不是用僵化的提示工程和预设流程束缚它们的手脚。

## Why use AgentScope?

- **简单**: 使用内置的 ReAct 智能体、工具、技能、人机协作、记忆、计划、实时语音、评估和模型微调轻松构建智能体应用
- **可扩展**: 大量生态系统集成,包括工具、记忆和可观察性;内置 MCP 和 A2A 支持;消息中心(MsgHub)提供灵活的多智能体编排能力
- **生产就绪**: 在本地、云端 Serverless 或 K8s 集群上轻松部署智能体应用,并内置 OTel 可观察性支持


<p align="center">
<img src="./assets/images/agentscope.png" width="90%" alt="AgentScope 生态系统" />
<br/>
AgentScope 生态
</p>


## 📢 新闻
<!-- BEGIN NEWS -->
- **[2026-02] `功能`:** 支持实时语音交互。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [多智能体实时交互](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime) | [文档](https://doc.agentscope.io/tutorial/task_realtime.html)
- **[2026-01] `社区`:** AgentScope 双周会议启动,分享生态更新和开发计划 - 欢迎加入![详情与安排](https://github.com/agentscope-ai/agentscope/discussions/1126)
- **[2026-01] `功能`:** 记忆模块新增数据库支持和记忆压缩。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression) | [教程](https://doc.agentscope.io/tutorial/task_memory.html)
- **[2025-12] `集成`:** A2A(智能体间通信)协议支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_a2a.html)
- **[2025-12] `功能`:** TTS(文本转语音)支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_tts.html)
- **[2025-11] `集成`:** Anthropic Agent Skill 支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_agent_skill.html)
- **[2025-11] `发布`:** 面向多样化真实任务的 Alias-Agent 和数据处理的 Data-Juicer Agent 开源。[Alias-Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/alias) | [Data-Juicer Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/data_juicer_agent)
- **[2025-11] `集成`:** 通过 Trinity-RFT 库实现智能体强化学习。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent) | [Trinity-RFT](https://github.com/agentscope-ai/Trinity-RFT)
- **[2025-11] `集成`:** ReMe 增强长期记忆。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory/reme)
- **[2025-11] `发布`:** agentscope-samples 样例库上线,agentscope-runtime 升级支持 Docker/K8s 部署和 VNC 图形沙盒。[样例库](https://github.com/agentscope-ai/agentscope-samples) | [Runtime](https://github.com/agentscope-ai/agentscope-runtime)
<!-- END NEWS -->

[更多新闻 →](./docs/NEWS_zh.md)

## 联系我们

欢迎加入我们的社区!

| [Discord](https://discord.gg/eYMpfnkG8h)                                                                                         | 钉钉                                                                        |
|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| <img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"> | <img src="./assets/images/dingtalk_qr_code.png" width="100" height="100"> |

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## 📑 Table of Contents

- [快速开始](#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)
  - [安装](#%E5%AE%89%E8%A3%85)
    - [从 PyPI 安装](#%E4%BB%8E-pypi-%E5%AE%89%E8%A3%85)
    - [从源码安装](#%E4%BB%8E%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85)
- [样例](#%E6%A0%B7%E4%BE%8B)
  - [Hello AgentScope!](#hello-agentscope)
  - [语音智能体](#%E8%AF%AD%E9%9F%B3%E6%99%BA%E8%83%BD%E4%BD%93)
  - [实时语音智能体](#%E5%AE%9E%E6%97%B6%E8%AF%AD%E9%9F%B3%E6%99%BA%E8%83%BD%E4%BD%93)
  - [人机协作](#%E4%BA%BA%E6%9C%BA%E5%8D%8F%E4%BD%9C)
  - [灵活的 MCP 控制](#%E7%81%B5%E6%B4%BB%E7%9A%84-mcp-%E6%8E%A7%E5%88%B6)
  - [智能体强化学习](#%E6%99%BA%E8%83%BD%E4%BD%93%E5%BC%BA%E5%8C%96%E5%AD%A6%E4%B9%A0)
  - [多智能体工作流](#%E5%A4%9A%E6%99%BA%E8%83%BD%E4%BD%93%E5%B7%A5%E4%BD%9C%E6%B5%81)
- [文档](#%E6%96%87%E6%A1%A3)
- [更多样例](#%E6%9B%B4%E5%A4%9A%E6%A0%B7%E4%BE%8B)
  - [功能](#%E5%8A%9F%E8%83%BD)
  - [智能体](#%E6%99%BA%E8%83%BD%E4%BD%93)
  - [游戏](#%E6%B8%B8%E6%88%8F)
  - [工作流](#%E5%B7%A5%E4%BD%9C%E6%B5%81)
  - [评估](#%E8%AF%84%E4%BC%B0)
  - [微调](#%E5%BE%AE%E8%B0%83)
- [贡献](#%E8%B4%A1%E7%8C%AE)
- [许可](#%E8%AE%B8%E5%8F%AF)
- [论文](#%E8%AE%BA%E6%96%87)
- [贡献者](#%E8%B4%A1%E7%8C%AE%E8%80%85)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 快速开始

### 安装

> AgentScope 需要 **Python 3.10** 或更高版本。

#### 从 PyPI 安装

```bash
pip install agentscope
```

或使用 uv:

```bash
uv pip install agentscope
```

#### 从源码安装

```bash
# 从 GitHub 拉取源码
git clone -b main https://github.com/agentscope-ai/agentscope.git

# 以可编辑模式安装包
cd agentscope

pip install -e .
# 或使用 uv:
# uv pip install -e .
```

## 样例

### Hello AgentScope!

开始与名为"Friday"的 ReAct 智能体 🤖 进行对话!

```python
from agentscope.agent import ReActAgent, UserAgent
from agentscope.model import DashScopeChatModel
from agentscope.formatter import DashScopeChatFormatter
from agentscope.memory import InMemoryMemory
from agentscope.tool import Toolkit, execute_python_code, execute_shell_command
import os, asyncio


async def main():
    toolkit = Toolkit()
    toolkit.register_tool_function(execute_python_code)
    toolkit.register_tool_function(execute_shell_command)

    agent = ReActAgent(
        name="Friday",
        sys_prompt="You're a helpful assistant named Friday.",
        model=DashScopeChatModel(
            model_name="qwen-max",
            api_key=os.environ["DASHSCOPE_API_KEY"],
            stream=True,
        ),
        memory=InMemoryMemory(),
        formatter=DashScopeChatFormatter(),
        toolkit=toolkit,
    )

    user = UserAgent(name="user")

    msg = None
    while True:
        msg = await agent(msg)
        msg = await user(msg)
        if msg.get_text_content() == "exit":
            break

asyncio.run(main())
```

### 语音智能体

创建支持语音的 ReAct 智能体,能够理解语音并进行语音回复,还可以使用语音交互玩多智能体狼人杀游戏。

https://github.com/user-attachments/assets/559af387-fd6f-4f0c-b882-cd4778214801


### 实时语音智能体

使用 AgentScope 轻松构建实时交互的智能体应用,提供统一的事件接口和工具调用支持。

[实时语音智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [多智能体实时交互](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime)

https://github.com/user-attachments/assets/d9674ad5-f71d-43d5-a341-5bada318aee0



### 人机协作

在 ReActAgent 中支持实时打断:可以通过取消操作实时中断对话,并通过强大的记忆保留机制无缝恢复。

<img src="./assets/images/realtime_steering_zh.gif" alt="Realtime Steering" width="60%"/>

### 灵活的 MCP 控制

AgentScope 支持将单个 MCP 工具作为**本地可调用函数**使用,装备给智能体或封装为更复杂的工具。

```python
from agentscope.mcp import HttpStatelessClient
from agentscope.tool import Toolkit
import os

async def fine_grained_mcp_control():
    # 以高德MCP为例,初始化MCP客户端
    client = HttpStatelessClient(
        name="gaode_mcp",
        transport="streamable_http",
        url=f"https://mcp.amap.com/mcp?key={os.environ['GAODE_API_KEY']}",
    )

    # 将 MCP 工具获取为**本地可调用函数**,并在任何地方使用
    func = await client.get_callable_function(func_name="maps_geo")

    # 选项 1:直接调用
    await func(address="天安门广场", city="北京")

    # 选项 2:作为工具传递给智能体
    toolkit = Toolkit()
    toolkit.register_tool_function(func)
    # ...

    # 选项 3:包装为更复杂的工具
    # ...
```

### 智能体强化学习

通过强化学习集成无缝训练智能体应用。我们还准备了涵盖各种场景的样例项目:

| 样例                                                                                               | 描述                         | 模型                     | 训练结果                        |
|--------------------------------------------------------------------------------------------------|----------------------------|------------------------|-----------------------------|
| [Math Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/math_agent)     | 通过多步推理调优数学求解智能体。           | Qwen3-0.6B             | Accuracy: 75% → 85%         |
| [Frozen Lake](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/frozen_lake)   | 训练智能体进行冰湖游戏。               | Qwen2.5-3B-Instruct    | Success rate: 15% → 86%     |
| [Learn to Ask](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/learn_to_ask) | 使用 LLM 作为评判获得自动反馈,从而调优智能体。 | Qwen2.5-7B-Instruct    | Accuracy: 47% → 92%         |
| [Email Search](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/email_search) | 在训练数据没有标注真值的情况下提升工具使用能力。   | Qwen3-4B-Instruct-2507 | Accuracy: 60%               |
| [Werewolf Game](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/werewolves)  | 训练智能体进行战略性多智能体游戏互动。        | Qwen2.5-7B-Instruct    | 狼人胜率:50% → 80%              |
| [Data Augment](https://github.com/agentscope-ai/agentscope-samples/tree/main/tuner/data_augment) | 生成合成训练数据以增强调优结果。           | Qwen3-0.6B             | AIME-24 accuracy: 20% → 60% |

### 多智能体工作流

AgentScope 提供 ``MsgHub`` 和 pipeline 来简化多智能体对话,提供高效的消息路由和无缝信息共享

```python
from agentscope.pipeline import MsgHub, sequential_pipeline
from agentscope.message import Msg
import asyncio

async def multi_agent_conversation():
    # 创建智能体
    agent1 = ...
    agent2 = ...
    agent3 = ...
    agent4 = ...

    # 创建消息中心来管理多智能体对话
    async with MsgHub(
        participants=[agent1, agent2, agent3],
        announcement=Msg("Host", "请介绍一下自己。", "assistant")
    ) as hub:
        # 按顺序发言
        await sequential_pipeline([agent1, agent2, agent3])
        # 动态管理参与者
        hub.add(agent4)
        hub.delete(agent3)
        await hub.broadcast(Msg("Host", "再见!", "assistant"))

asyncio.run(multi_agent_conversation())
```


## 文档

- [教程](https://doc.agentscope.io/zh_CN/tutorial/)
- [常见问题](https://doc.agentscope.io/zh_CN/tutorial/faq.html)
- [API 文档](https://doc.agentscope.io/zh_CN/api/agentscope.html)

## 更多样例

### 功能

- [MCP](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/mcp)
- [Anthropic 智能体技能](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill)
- [计划](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/plan)
- [结构化输出](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/structured_output)
- [RAG](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/rag)
- [长期记忆](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory)
- [基于 SQLite 的会话管理](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/session_with_sqlite)
- [流式打印消息](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/stream_printing_messages)
- [TTS](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts)
- [高代码部署](https://github.com/agentscope-ai/agentscope/tree/main/examples/deployment/planning_agent)
- [记忆压缩](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression)

### 智能体

- [ReAct 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/react_agent)
- [语音智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/voice_agent)
- [Deep Research 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/deep_research_agent)
- [Browser-use 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/browser_agent)
- [Meta Planner 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/meta_planner_agent)
- [A2A 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent)
- [实时语音交互智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent)

### 游戏

- [九人制狼人杀](https://github.com/agentscope-ai/agentscope/tree/main/examples/game/werewolves)

### 工作流

- [多智能体辩论](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_debate)
- [多智能体对话](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_conversation)
- [多智能体并发](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_concurrent)
- [多智能体实时语音交互](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime)

### 评估

- [ACEBench](https://github.com/agentscope-ai/agentscope/tree/main/examples/evaluation/ace_bench)

### 微调

- [调优 ReAct 智能体](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent)


## 贡献

我们欢迎社区的贡献!请参阅我们的 [贡献指南](./CONTRIBUTING_zh.md) 了解如何贡献到 AgentScope。

## 许可

AgentScope 基于 Apache License 2.0 发布。

## 论文

如果我们的工作对您的研究或应用有帮助,请引用我们的论文。

- [AgentScope 1.0: A Developer-Centric Framework for Building Agentic Applications](https://arxiv.org/abs/2508.16279)

- [AgentScope: A Flexible yet Robust Multi-Agent Platform](https://arxiv.org/abs/2402.14034)

```
@article{agentscope_v1,
    author  = {Dawei Gao, Zitao Li, Yuexiang Xie, Weirui Kuang, Liuyi Yao, Bingchen Qian, Zhijian Ma, Yue Cui, Haohao Luo, Shen Li, Lu Yi, Yi Yu, Shiqi He, Zhiling Luo, Wenmeng Zhou, Zhicheng Zhang, Xuguang He, Ziqian Chen, Weikai Liao, Farruh Isakulovich Kushnazarov, Yaliang Li, Bolin Ding, Jingren Zhou},
    title   = {AgentScope 1.0: A Developer-Centric Framework for Building Agentic Applications},
    journal = {CoRR},
    volume  = {abs/2508.16279},
    year    = {2025},
}

@article{agentscope,
    author  = {Dawei Gao, Zitao Li, Xuchen Pan, Weirui Kuang, Zhijian Ma, Bingchen Qian, Fei Wei, Wenhao Zhang, Yuexiang Xie, Daoyuan Chen, Liuyi Yao, Hongyi Peng, Zeyu Zhang, Lin Zhu, Chen Cheng, Hongzhu Shi, Yaliang Li, Bolin Ding, Jingren Zhou},
    title   = {AgentScope: A Flexible yet Robust Multi-Agent Platform},
    journal = {CoRR},
    volume  = {abs/2402.14034},
    year    = {2024},
}
```

## 贡献者

感谢所有贡献者:

<a href="https://github.com/agentscope-ai/agentscope/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=agentscope-ai/agentscope&max=999&columns=12&anon=1" alt="贡献者" />
</a>


================================================
FILE: docs/NEWS.md
================================================
<!-- This is the source of truth for all NEWS items. -->
<!-- The first 10 items are automatically synced to README.md and README_zh.md via GitHub Actions. -->
<!-- To update news in READMEs, modify this file and push to trigger the workflow. -->

- **[2026-02] `FEAT`:** Realtime Voice Agent support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [Multi-Agent Realtime Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime) | [Tutorial](https://doc.agentscope.io/tutorial/task_realtime.html)
- **[2026-01] `COMM`:** Biweekly Meetings launched to share ecosystem updates and development plans - join us! [Details & Schedule](https://github.com/agentscope-ai/agentscope/discussions/1126)
- **[2026-01] `FEAT`:** Database support & memory compression in memory module. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression) | [Tutorial](https://doc.agentscope.io/tutorial/task_memory.html)
- **[2025-12] `INTG`:** A2A (Agent-to-Agent) protocol support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent) | [Tutorial](https://doc.agentscope.io/tutorial/task_a2a.html)
- **[2025-12] `FEAT`:** TTS (Text-to-Speech) support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts) | [Tutorial](https://doc.agentscope.io/tutorial/task_tts.html)
- **[2025-11] `INTG`:** Anthropic Agent Skill support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill) | [Tutorial](https://doc.agentscope.io/tutorial/task_agent_skill.html)
- **[2025-11] `RELS`:** Alias-Agent for diverse real-world tasks and Data-Juicer Agent for data processing open-sourced. [Alias-Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/alias) | [Data-Juicer Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/data_juicer_agent)
- **[2025-11] `INTG`:** Agentic RL via Trinity-RFT library. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent) | [Trinity-RFT](https://github.com/agentscope-ai/Trinity-RFT)
- **[2025-11] `INTG`:** ReMe for enhanced long-term memory. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory/reme)
- **[2025-11] `RELS`:** agentscope-samples repository launched and agentscope-runtime upgraded with Docker/K8s deployment and VNC-powered GUI sandboxes. [Samples](https://github.com/agentscope-ai/agentscope-samples) | [Runtime](https://github.com/agentscope-ai/agentscope-runtime)
- **[2025-11] `DOCS`:** Contributing Guide is online - welcome to contribute! [Guide](./CONTRIBUTING.md)
- **[2025-09] `FEAT`:** RAG module released. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/rag) | [Tutorial](https://doc.agentscope.io/tutorial/task_rag.html)
- **[2025-09] `FEAT`:** Voice agent support - ReActAgent now supports Qwen-Omni and GPT-Audio natively. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/voice_agent) | [Roadmap](https://github.com/agentscope-ai/agentscope/issues/773)
- **[2025-09] `FEAT`:** Plan module released. [Tutorial](https://doc.agentscope.io/tutorial/task_plan.html)
- **[2025-09] `RELS`:** AgentScope Runtime open-sourced - enabling effective agent deployment with sandboxed tool execution. [GitHub](https://github.com/agentscope-ai/agentscope-runtime)
- **[2025-09] `RELS`:** AgentScope Studio open-sourced. [GitHub](https://github.com/agentscope-ai/agentscope-studio)
- **[2025-08] `DOCS`:** Tutorial v1 is online. [Tutorial](https://doc.agentscope.io)
- **[2025-08] `RELS`:** AgentScope v1 released - fully embracing asynchronous execution with many new features and improvements. [Changelog](https://github.com/agentscope-ai/agentscope/blob/main/docs/changelog.md)



================================================
FILE: docs/NEWS_zh.md
================================================
<!-- This is the source of truth for all NEWS items. -->
<!-- The first 10 items are automatically synced to README.md and README_zh.md via GitHub Actions. -->
<!-- To update news in READMEs, modify this file and push to trigger the workflow. -->

- **[2026-02] `功能`:** 支持实时语音交互。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/realtime_voice_agent) | [多智能体实时交互](https://github.com/agentscope-ai/agentscope/tree/main/examples/workflows/multiagent_realtime) | [文档](https://doc.agentscope.io/tutorial/task_realtime.html)
- **[2026-01] `社区`:** AgentScope 双周会议启动,分享生态更新和开发计划 - 欢迎加入![详情与安排](https://github.com/agentscope-ai/agentscope/discussions/1126)
- **[2026-01] `功能`:** 记忆模块新增数据库支持和记忆压缩。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/short_term_memory/memory_compression) | [教程](https://doc.agentscope.io/tutorial/task_memory.html)
- **[2025-12] `集成`:** A2A(智能体间通信)协议支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/a2a_agent) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_a2a.html)
- **[2025-12] `功能`:** TTS(文本转语音)支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/tts) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_tts.html)
- **[2025-11] `集成`:** Anthropic Agent Skill 支持。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/agent_skill) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_agent_skill.html)
- **[2025-11] `发布`:** 面向多样化真实任务的 Alias-Agent 和数据处理的 Data-Juicer Agent 开源。[Alias-Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/alias) | [Data-Juicer Agent](https://github.com/agentscope-ai/agentscope-samples/tree/main/data_juicer_agent)
- **[2025-11] `集成`:** 通过 Trinity-RFT 库实现智能体强化学习。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/tuner/react_agent) | [Trinity-RFT](https://github.com/agentscope-ai/Trinity-RFT)
- **[2025-11] `集成`:** ReMe 增强长期记忆。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/long_term_memory/reme)
- **[2025-11] `发布`:** agentscope-samples 样例库上线,agentscope-runtime 升级支持 Docker/K8s 部署和 VNC 图形沙盒。[样例库](https://github.com/agentscope-ai/agentscope-samples) | [Runtime](https://github.com/agentscope-ai/agentscope-runtime)
- **[2025-11] `文档`:** 贡献指南上线 - 欢迎参与贡献![指南](./CONTRIBUTING_zh.md)
- **[2025-09] `功能`:** RAG 模块发布。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/functionality/rag) | [教程](https://doc.agentscope.io/zh_CN/tutorial/task_rag.html)
- **[2025-09] `功能`:** 语音智能体支持 - ReActAgent 原生支持 Qwen-Omni 和 GPT-Audio。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent/voice_agent) | [Roadmap](https://github.com/agentscope-ai/agentscope/issues/773)
- **[2025-09] `功能`:** Plan 模块发布。[教程](https://doc.agentscope.io/zh_CN/tutorial/task_plan.html)
- **[2025-09] `发布`:** AgentScope Runtime 开源 - 支持沙盒化工具执行的高效智能体部署。[GitHub](https://github.com/agentscope-ai/agentscope-runtime)
- **[2025-09] `发布`:** AgentScope Studio 开源。[GitHub](https://github.com/agentscope-ai/agentscope-studio)
- **[2025-08] `文档`:** v1 版本教程上线。[教程](https://doc.agentscope.io/zh_CN/)
- **[2025-08] `发布`:** AgentScope v1 发布 - 全面拥抱异步执行,诸多新功能和改进。[变更日志](https://github.com/agentscope-ai/agentscope/blob/main/docs/changelog.md)

================================================
FILE: docs/changelog.md
================================================
# CHANGELOG of v1.0.0

> ➡️ change; ✅ new feature; ❌ deprecate

The overall changes from v0.x.x to v1.0.0 are summarized below.

## Overview
- ✅ Support asynchronous execution throughout the library
- ✅ Support tools API thoroughly


## ✨Session
- ✅ Support automatic state management
- ✅ Support session/application-level state management


## ✨Tracing
- ✅ Support OpenTelemetry-based tracing
- ✅ Support third-party tracing platforms, e.g. Arize-Phoenix, Langfuse, etc.


## ✨MCP
- ✅ Support both client- and function-level control over MCP by a new MCP module
- ✅ Support both "pay-as-you-go" and persistent session management
- ✅ Support streamable HTTP, SSE and StdIO transport protocols


## ✨Memory
- ✅ Support long-term memory by providing a `LongTermMemoryBase` class
- ✅ Provide a Mem0-based long-term memory implementation
- ✅ Support both static- and agent-controlled long-term memory modes


## Formatter
- ✅ Support prompt construction/formatting with token count estimation
- ✅ Support tools API in multi-agent prompt formatting


## Model
- ❌ Deprecate model configuration, use explicit object instantiation instead
- ✅ Provide a new `ModelResponse` class for structured model responses
- ✅ Support asynchronous model invocation
- ✅ Support reasoning models
- ✅ Support any combination of streaming/non-streaming, reasoning/non-reasoning and tools API


## Agent
- ❌ Deprecate `DialogAgent`, `DictDialogAgent` and prompt-based ReAct agent class
- ➡️ Expose memory, formatter interfaces to the agent's constructor in ReActAgent
- ➡️ Unify the signature of pre- and post- agent hooks
- ✅ Support pre-/post-reasoning and pre-/post-acting hooks in ReActAgent class
- ✅ Support asynchronous agent execution
- ✅ Support interrupting agent's replying and customized interruption handling
- ✅ Support automatic state management
- ✅ Support parallel tool calls
- ✅ Support two-modes long-term memory in ReActAgent class


## Tool
- ✅ Provide a more powerful `Toolkit` class for tools management
- ✅ Provide a new `ToolResponse` class for structured and multimodal tool responses
- ✅ Support group-wise tool management
- ✅ Support agent to manage tools by itself
- ✅ Support post-processing of tool responses
- Tool function
  - ✅ Support both async and sync functions
  - ✅ Support both streaming and non-streaming return


## Evaluation
- ✅ Support ReAct agent-oriented evaluation
- ✅ Support Ray-based distributed and concurrent evaluation
- ✅ Support statistical analysis over evaluation results


## AgentScope Studio
- ✅ Support runtime tracing
- ✅ Provide a built-in copilot agent named Friday


## Logging
- ❌ Deprecate `loguru` and use Python native `logging` module instead


## Distribution
- ❌ Deprecate distribution functionality momentarily, a new distribution module is coming soon


## RAG
- ❌ Deprecate RAG functionality momentarily, a new RAG module is coming soon


## Parsers
- ❌ Deprecate parsers module


## WebBrowser
- ❌ Deprecate the `WebBrowser` class and shift to MCP-based web browsing


================================================
FILE: docs/roadmap.md
================================================
# Roadmap

## Long-term Goals

Offering **agent-oriented programming (AOP)** as a new programming paradigm to organize the design and implementation of next-generation LLM-empowered applications.

## Current Focus (January 2026 - )

### 🎙️ Voice Agent

**Voice agents** are a domain we are highly focused on, and AgentScope will continue to invest in this direction.

AgentScope aims to build **production-ready** voice agents rather than demonstration prototypes. This means our voice agents will:

- Support **production-grade** deployment, including seamless frontend integration
- Support **tool invocation**, not just voice conversations
- Support **multi-agent** voice interactions

#### Development Roadmap

Our development strategy for voice agents consists of **three progressive milestones**:

1. **TTS Models** → 2. **Multimodal Models** → 3. **Real-time Multimodal Models**

---

#### Phase 1: TTS (Text-to-Speech) Models

- **Build TTS model base class infrastructure**
  - Design and implement a unified TTS model base class
  - Establish standardized interfaces for TTS model integration

- **Horizontal API expansion**
  - Support mainstream TTS APIs (e.g., OpenAI TTS, Google TTS, Azure TTS, ElevenLabs, etc.)
  - Ensure consistent behavior across different TTS providers

---

#### Phase 2: Multimodal Models (Non-Realtime)

- **Enable ReAct agents with multimodal support**
  - Integrate multimodal models (e.g., qwen3-omni, gpt-audio) into existing ReAct agent framework
  - Support audio input/output in non-realtime mode

- **Advanced multimodal agent capabilities**
  - Enable tool invocation within multimodal conversations
  - Support multi-agent workflows with multimodal communication

---

#### Phase 3: Real-time Multimodal Models


- **Beyond request-response**: Explore streaming, interrupt handling, and concurrent multimodal processing
- **New programming paradigms**: Design agent programming models specifically tailored for real-time interactions
- **Production readiness**: Ensure low-latency performance, stability, and scalability for production deployment

### 🛠️ Agent Skill

Provide **production-ready** agent skill integration solutions.

### 🌐 Ecosystem Expansion

- **A2UI (Agent-to-UI)**: Enable seamless agent-to-user interface interactions
- **A2A (Agent-to-Agent)**: Enhance agent-to-agent communication capabilities

### 🚀 Agentic RL

- Support using [Tinker](https://tinker-docs.thinkingmachines.ai/) backend to tune agent applications on devices without GPU.
- Support tuning agent applications based on their run history.
- Integrate with AgentScope Runtime to provide better environment abstraction.
- Add more tutorials and examples on how to build complex judge functions with the help of evaluation module.
- Add more tutorials and examples on data selection and augmentation.

### 📈 Code Quality

Continuous refinement and improvement of code quality and maintainability.

# Completed Milestones

### AgentScope V1.0.0 Roadmap

We are deeply grateful for the continuous support from the open-source community that has witnessed AgentScope's
growth. Throughout our journey, we have maintained **developer-centric transparency** as our core principle,
which will continue to guide our future development.

As the AI agent ecosystem rapidly evolves, we recognize the need to adapt AgentScope to meet emerging trends and
requirements. We are excited to announce the upcoming release of AgentScope v1.0.0, which marks a significant shift
towards deployment-focused and secondary development direction. This new version will provide comprehensive support for agent developers
with enhanced deployment capabilities and practical features. Specifically, the update will include:

- ✨New Features
  - 🛠️ Tool/MCP
    - Support both sync/async tool functions
    - Support streaming tool function
    - Support parallel execution of tool functions
    - Provide more flexible support for the MCP server

  - 💾 Memory
    - Enhance the existing short-term memory
    - Support long-term memory

  - 🤖 Agent
    - Provide powerful ReAct-based out-of-the-box agents

- 👨‍💻 Development
  - Provide enhanced AgentScope Studio with visual components for developing, tracing and debugging
  - Provide a built-in copilot for developing/drafting AgentScope applications

- 🔍 Evaluation
  - Provide built-in benchmarking and evaluation toolkit for agents
  - Support result visualization

- 🏗️ Deployment
  - Support asynchronous agent execution
  - Support session/state management
  - Provide sandbox for tool execution

Stay tuned for our detailed release notes and beta version, which will be available soon. Follow our GitHub
repository and official channels for the latest updates. We look forward to your valuable feedback and continued
support in shaping the future of AgentScope.

================================================
FILE: docs/tutorial/_static/css/gallery.css
================================================
.sphx-glr-download-link-note.admonition.note {
    display: none;
}

.sphx-glr-footer {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.sphx-glr-download-zip {
    display: none;
}

.bordered-image {
    border: 1px solid #e5e5e5;
}

:root {
    --item-card-width: 200px;
    --item-card-margin: 10px;
    --item-card-title-height: 50px;

    --item-card-img-length: calc(var(--item-card-width) - 2*var(--item-card-margin));
    --item-card-title-width: calc(var(--item-card-width) - 2*var(--item-card-margin));
    --item-card-title-margin-top: var(--item-card-margin);

    --item-card-height: calc(var(--item-card-margin) * 3 + var(--item-card-img-length) + var(--item-card-title-height));
}

td .highlight-python.notranslate {
    margin-bottom: 0 !important;
}

/*cite {*/
/*    background: rgba(229, 229, 229, 0.69) !important;*/
/*    padding-left: 0.25rem !important;*/
/*    padding-right: 0.25rem !important;*/
/*    border-radius: 4px !important;*/
/*    font-style: normal !important;*/
/*    font-weight: 600 !important;*/
/*}*/

.sidebar-brand-text {
    display: flex;
    justify-content: center;
}

.sidebar-logo-container .sidebar-logo {
    max-height: 170px;
    width: auto;
    display: block;
}

.gallery-item {
    position: relative;
    display: inline-block;
    width: var(--item-card-width);
    height: var(--item-card-height);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    margin: 7px;
}

.docutils.align-default {
    white-space: normal !important;
    max-width: 100% !important;
    width: 100% !important;
    td {
        white-space: normal !important;
    }
}

.sphx-glr-script-out.highlight-none.notranslate .highlight pre{
    /*正常打印回车*/
    white-space: pre-wrap !important;
    /*white-space: normal !important;*/
    max-width: 100% !important;
    width: 100% !important;
}

.gallery-item-card {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--item-card-width);
    height: var(--item-card-height);
    display: flex;
    flex-direction: column;
    margin: var(--item-card-margin);
}

.gallery-item-card-img {
    height: var(--item-card-img-length);
    width: var(--item-card-img-length);
    min-width: var(--item-card-img-length);
    min-height: var(--item-card-img-length);
    display: block;
}

.gallery-item-card-title {
    text-align: center;
    margin-top: var(--item-card-margin);
    font-weight: bold;
    min-height: var(--item-card-title-height);
    height: var(--item-card-title-height);
    width: var(--item-card-title-width);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item-description {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    /*background-color: #1e8449;*/
    color: black;
    display: none;
    justify-content: center;
    align-items: flex-start;
}

.gallery-item:hover .gallery-item-description {
    display: flex;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.22);
}

.language-switch-button {
    background: transparent;
    display: flex;
    align-content: center;
    justify-content: center;
    font-size: 15px;
    margin-top: 0;
    margin-bottom: 4px;
    border: none;
    color: rgb(4, 4, 4);
    height: 20px;
    width: 20px;
    border-radius: 6px;
    font-weight: 325;
}

.language-switch-button:hover {
    color: #2758DA;
}

.version-select {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    font-size: 14px;
    border: 1px solid rgb(238, 235, 238);
    margin-inline: 16px;
    padding: 8px;
    height: fit-content;
    box-sizing: border-box;
    font-weight: 600;
    border-radius: 6px;
    fill: rgb(238, 235, 238);
}


================================================
FILE: docs/tutorial/_static/language_switch.js
================================================
function switchV1Language() {
    if (window.location.href.includes("zh_CN")) {
        window.location.href = "https://doc.agentscope.io";
    } else {
        window.location.href = "https://doc.agentscope.io/zh_CN";
    }
}


function navigateToV0(version) {
    if (version === "v0") {
        const suffix = window.location.href.includes("zh_CN") ? "/zh_CN" : "/en";
        window.location.href = "https://doc.agentscope.io/v0" + suffix;
    }
}


================================================
FILE: docs/tutorial/_templates/components/language-switch.html
================================================
{# _templates/components/language-switch.html #}
<button onclick="switchV1Language()" class="language-switch-button" title="Switch to Chinese">
  <script>
    document.write(window.location.href.includes("zh_CN") ? "En": "中");
  </script>
</button>

================================================
FILE: docs/tutorial/_templates/module.rst_t
================================================
{{ basename |  heading }}
.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
   :{{ option }}:
{%- endfor %}

================================================
FILE: docs/tutorial/_templates/package.rst_t
================================================
{%- macro automodule(modname, options) -%}
.. automodule:: {{ modname }}
{%- for option in options %}
   :{{ option }}:
{%- endfor %}
{%- endmacro %}

{{- pkgname | heading }}

{{ automodule(pkgname, automodule_options) }}

================================================
FILE: docs/tutorial/_templates/page.html
================================================
{% extends "base.html" %}

{% block body -%}
{{ super() }}
{% include "partials/icons.html" %}

<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation">
  <div class="visually-hidden">Hide navigation sidebar</div>
</label>
<label class="overlay toc-overlay" for="__toc">
  <div class="visually-hidden">Hide table of contents sidebar</div>
</label>

<a class="skip-to-content muted-link" href="#furo-main-content">
  {%- trans -%}
  Skip to content
  {%- endtrans -%}
</a>

{% if theme_announcement -%}
<div class="announcement">
  <aside class="announcement-content">
    {% block announcement %} {{ theme_announcement }} {% endblock announcement %}
  </aside>
</div>
{%- endif %}

<div class="page">
  <header class="mobile-header">
    <div class="header-left">
      <label class="nav-overlay-icon" for="__navigation">
        <div class="visually-hidden">Toggle site navigation sidebar</div>
        <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
      </label>
    </div>
    <div class="header-center">
      <a href="{{ pathto(master_doc) }}"><div class="brand">{{ docstitle if docstitle else project }}</div></a>
    </div>
    <div class="header-right">
      <div class="theme-toggle-container theme-toggle-header">
        <button class="theme-toggle">
          <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
          <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
          <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
          <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
          <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
        </button>
      </div>
      <label class="toc-overlay-icon toc-header-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
        <div class="visually-hidden">Toggle table of contents sidebar</div>
        <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
      </label>
    </div>
  </header>
  <aside class="sidebar-drawer">
    <div class="sidebar-container">
      {% block left_sidebar %}
      <div class="sidebar-sticky">
        {%- for sidebar_section in sidebars %}
          {%- include sidebar_section %}
        {%- endfor %}
      </div>
      {% endblock left_sidebar %}
    </div>
  </aside>
  <div class="main">
    <div class="content">
      <div class="article-container">
        <a href="#" class="back-to-top muted-link">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
          </svg>
          <span>{% trans %}Back to top{% endtrans %}</span>
        </a>
        <div class="content-icon-container">
          {% if theme_top_of_page_button != "edit" -%}
            {{ warning("Got configuration for 'top_of_page_button': this is deprecated.") }}
          {%- endif -%}

          {%- if theme_top_of_page_buttons == "" -%}
            {% if theme_top_of_page_button == None -%}
              {#- We respect the old configuration of disabling all the buttons -#}
              {%- set theme_top_of_page_buttons = [] -%}
            {% else %}
              {%- set theme_top_of_page_buttons = ["view", "edit"] -%}
            {%- endif -%}
          {% else -%}
            {% if theme_top_of_page_button != "edit" -%}
              {%- set theme_top_of_page_buttons = [] -%}
              {{ warning("Got configuration for both 'top_of_page_button' and 'top_of_page_buttons', ignoring both and removing all top of page buttons.") }}
            {%- endif -%}
          {%- endif -%}
          {%- include "components/language-switch.html" with context -%}
          {% for button in theme_top_of_page_buttons -%}
            {% if button == "view" %}
            {%- include "components/view-this-page.html" with context -%}
            {% elif button == "edit" %}
            {%- include "components/edit-this-page.html" with context -%}
            {% else %}
            {{ warning("Got an unsupported value in 'top_of_page_buttons' for theme configuration") }}
            {% endif %}
          {%- endfor -%}
          {#- Theme toggle -#}
          <div class="theme-toggle-container theme-toggle-content">
            <button class="theme-toggle">
              <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
              <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
              <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
              <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
              <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
            </button>
          </div>
          <label class="toc-overlay-icon toc-content-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
            <div class="visually-hidden">Toggle table of contents sidebar</div>
            <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
          </label>
        </div>
        <article role="main" id="furo-main-content">
          {% block content %}{{ body }}{% endblock %}
        </article>
      </div>
      <footer>
        {% block footer %}
        <div class="related-pages">
          {% if next -%}
            <a class="next-page" href="{{ next.link }}">
              <div class="page-info">
                <div class="context">
                  <span>{{ _("Next") }}</span>
                </div>
                <div class="title">{{ next.title }}</div>
              </div>
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
            </a>
          {%- endif %}
          {% if prev -%}
            <a class="prev-page" href="{{ prev.link }}">
              <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
              <div class="page-info">
                <div class="context">
                  <span>{{ _("Previous") }}</span>
                </div>
                {% if prev.link == pathto(master_doc) %}
                <div class="title">{{ _("Home") }}</div>
                {% else %}
                <div class="title">{{ prev.title }}</div>
                {% endif %}
              </div>
            </a>
          {%- endif %}
        </div>
        <div class="bottom-of-page">
          <div class="left-details">
            {%- if show_copyright %}
            <div class="copyright">
              {%- if hasdoc('copyright') %}
                {% trans path=pathto('copyright'), copyright=copyright|e -%}
                  <a href="{{ path }}">Copyright</a> &#169; {{ copyright }}
                {%- endtrans %}
              {%- else %}
                {% trans copyright=copyright|e -%}
                  Copyright &#169; {{ copyright }}
                {%- endtrans %}
              {%- endif %}
            </div>
            {%- endif %}
            {% trans %}Made with {% endtrans -%}
            {%- if show_sphinx -%}
            {% trans %}<a href="https://www.sphinx-doc.org/">Sphinx</a> and {% endtrans -%}
            <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
            {% endif -%}
            {% trans %}
            <a href="https://github.com/pradyunsg/furo">Furo</a>
            {% endtrans %}
            {%- if last_updated -%}
            <div class="last-updated">
              {% trans last_updated=last_updated|e -%}
                Last updated on {{ last_updated }}
              {%- endtrans -%}
            </div>
            {%- endif %}
          </div>
          <div class="right-details">
            {% if theme_footer_icons or READTHEDOCS -%}
            <div class="icons">
              {% if theme_footer_icons -%}
              {% for icon_dict in theme_footer_icons -%}
              <a class="muted-link {{ icon_dict.class }}" href="{{ icon_dict.url }}" aria-label="{{ icon_dict.name }}">
                {{- icon_dict.html -}}
              </a>
              {% endfor %}
              {%- else -%}
              {#- Show Read the Docs project -#}
              {%- if READTHEDOCS and slug -%}
              <a class="muted-link" href="https://readthedocs.org/projects/{{ slug }}" aria-label="On Read the Docs">
                <svg x="0px" y="0px" viewBox="-125 217 360 360" xml:space="preserve">
                  <path fill="currentColor" d="M39.2,391.3c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3 c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2 c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,391.3,40.4,391.1,39.2,391.3z M39.2,353.6c-4.2,0.6-7.1,4.4-6.5,8.5 c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4 c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,353.6,40.4,353.4,39.2,353.6z M39.2,315.9 c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8 c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6c-30.1-2.4-46.5-7.9-46.5-7.9 C41.7,315.9,40.4,315.8,39.2,315.9z M39.2,278.3c-4.2,0.6-7.1,4.4-6.5,8.5c0.4,3,2.6,5.5,5.5,6.3c0,0,18.5,6.1,50,8.7 c25.3,2.1,54-1.8,54-1.8c4.2-0.1,7.5-3.6,7.4-7.8c-0.1-4.2-3.6-7.5-7.8-7.4c-0.5,0-1,0.1-1.5,0.2c0,0-28.1,3.5-50.9,1.6 c-30.1-2.4-46.5-7.9-46.5-7.9C41.7,278.2,40.4,278.1,39.2,278.3z M-13.6,238.5c-39.6,0.3-54.3,12.5-54.3,12.5v295.7 c0,0,14.4-12.4,60.8-10.5s55.9,18.2,112.9,19.3s71.3-8.8,71.3-8.8l0.8-301.4c0,0-25.6,7.3-75.6,7.7c-49.9,0.4-61.9-12.7-107.7-14.2 C-8.2,238.6-10.9,238.5-13.6,238.5z M19.5,257.8c0,0,24,7.9,68.3,10.1c37.5,1.9,75-3.7,75-3.7v267.9c0,0-19,10-66.5,6.6 C59.5,536.1,19,522.1,19,522.1L19.5,257.8z M-3.6,264.8c4.2,0,7.7,3.4,7.7,7.7c0,4.2-3.4,7.7-7.7,7.7c0,0-12.4,0.1-20,0.8 c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,0,0,0,0c0,0,11.3-6,27-7.5 C-16,264.9-3.6,264.8-3.6,264.8z M-11,302.6c4.2-0.1,7.4,0,7.4,0c4.2,0.5,7.2,4.3,6.7,8.5c-0.4,3.5-3.2,6.3-6.7,6.7 c0,0-12.4,0.1-20,0.8c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,11.3-6,27-7.5 C-20.5,302.9-15.2,302.7-11,302.6z M-3.6,340.2c4.2,0,7.7,3.4,7.7,7.7s-3.4,7.7-7.7,7.7c0,0-12.4-0.1-20,0.7 c-12.7,1.3-21.4,5.9-21.4,5.9c-3.7,2-8.4,0.5-10.3-3.2c-2-3.7-0.5-8.4,3.2-10.3c0,0,11.3-6,27-7.5C-16,340.1-3.6,340.2-3.6,340.2z" />
                </svg>
              </a>
              {%- endif -%}
              {#- Show GitHub repository home -#}
              {%- if READTHEDOCS and display_github and github_user != "None" and github_repo != "None" -%}
              <a class="muted-link" href="https://github.com/{{ github_user }}/{{ github_repo }}" aria-label="On GitHub">
                <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
                  <path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
                </svg>
              </a>
              {%- endif -%}
              {%- endif %}
            </div>
            {%- endif %}
          </div>
        </div>
        {% endblock footer %}
      </footer>
    </div>
    <aside class="toc-drawer{% if furo_hide_toc %} no-toc{% endif %}">
      {% block right_sidebar %}
      {% if not furo_hide_toc %}
      <div class="toc-sticky toc-scroll">
        <div class="toc-title-container">
          <span class="toc-title">
            {{ _("On this page") }}
          </span>
        </div>
        <div class="toc-tree-container">
          <div class="toc-tree">
            {{ toc }}
          </div>
        </div>
      </div>
      {% endif %}
      {% endblock right_sidebar %}
    </aside>
  </div>
</div>
{%- endblock %}


================================================
FILE: docs/tutorial/_templates/sidebar/navigation.html
================================================
<div class="sidebar-tree">
    <p class="caption" role="heading">
        <span class="caption-text">
            Version
        </span>
        <ul>
            <li>
                <select class="version-select" onchange="navigateToV0(this.value)">
                    <option value="v1" selected>Stable(v1.0)</option>
                    <option value="v0">v0.1.x</option>
                </select>
            </li>
        </ul>
    </p>
    {{ furo_navigation_tree }}
</div>


================================================
FILE: docs/tutorial/en/Makefile
================================================
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS    ?=
SPHINXBUILD   ?= sphinx-build
SOURCEDIR     = source
BUILDDIR      = _build

# Put it first so that "make" without argument is like "make help".
help:
	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


================================================
FILE: docs/tutorial/en/build.sh
================================================
#!/bin/bash

set -e

# Clean old build files
rm -rf build/ doctrees/

# Build the html
sphinx-build -M html ./ build

# Remove temporary files (double insurance)
rm -rf build/html/.doctrees
rm -f build/html/.buildinfo
find build/html -name "*.pickle" -delete
find build/html -name "__pycache__" -delete
find build/html -name "*.pyc" -delete

echo "✅ English docs built successfully, temporary files cleaned"

================================================
FILE: docs/tutorial/en/conf.py
================================================
# -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "AgentScope"
copyright = "2025, Alibaba"
author = "Alibaba Tongyi Lab"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    "myst_parser",
    "sphinx_gallery.gen_gallery",
    "sphinx.ext.autodoc",
    "sphinx.ext.viewcode",
    "sphinx.ext.napoleon",
]

myst_enable_extensions = [
    "colon_fence",
]

sphinx_gallery_conf = {
    "download_all_examples": False,
    "examples_dirs": [
        "src",
    ],
    "gallery_dirs": [
        "tutorial",
    ],
    "filename_pattern": "src/.*\.py",
    "example_extensions": [".py"],
}

templates_path = ["../_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

languages = ["en", "zh_CN"]
language = "en"

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_title = (
    "<span style='font-weight: 700; color: #2196f3;'>AgentScope</span>"
)
html_logo = "../_static/images/logo.svg"
html_favicon = "../_static/images/logo.svg"
html_static_path = ["../_static"]
html_css_files = [
    "css/gallery.css",
]

html_js_files = [
    "language_switch.js",
]

html_theme_options = {
    "footer_icons": [
        {
            "name": "GitHub",
            "url": "https://github.com/agentscope-ai/agentscope",
            "html": """
                <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
                    <path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
                </svg>
            """,
            "class": "",
        },
        {
            "name": "Discord",
            "url": "https://discord.gg/eYMpfnkG8h",
            "html": """
                <svg stroke="currentColor" fill="currentColor" stroke-width="0" t="1753331148815" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5721" width="200" height="200">
                    <path d="M723.903423 359.138018c-69.65045-52.952793-136.256577-51.476757-136.256576-51.476757l-6.088649 7.564685c83.027027 25.738378 121.127207 62.085766 121.127207 62.085766a387.459459 387.459459 0 0 0-145.297297-46.956397 418.179459 418.179459 0 0 0-98.340901 1.752793 73.801802 73.801802 0 0 1-7.564684 1.476036 357.385225 357.385225 0 0 0-110.702703 30.258739 278.786306 278.786306 0 0 0-28.782703 13.653333S353.049369 339.488288 440.873514 313.657658l-4.612613-6.088649s-66.513874-1.476036-136.164324 51.476757A654.252973 654.252973 0 0 0 230.630631 642.167928s40.867748 71.126486 148.341621 73.801802c0 0 16.697658-22.694054 31.827027-40.867748-62.085766-18.45045-84.77982-57.565405-84.77982-57.565405a130.998198 130.998198 0 0 0 13.653334 7.564684s0 1.568288 1.476036 1.568289c1.476036 1.476036 3.044324 1.476036 4.52036 3.044324a238.748829 238.748829 0 0 0 34.779099 16.605405 513.199279 513.199279 0 0 0 71.218739 21.218018 350.558559 350.558559 0 0 0 125.555315 0 329.894054 329.894054 0 0 0 69.650451-21.218018A247.328288 247.328288 0 0 0 702.685405 618.09009s-24.262342 39.391712-87.824144 57.565405c13.653333 18.45045 31.827027 39.299459 31.827027 39.29946 107.473874-2.952072 148.341622-73.801802 146.773334-72.602523a654.990991 654.990991 0 0 0-69.558199-283.214414zM421.131532 596.77982a54.705586 54.705586 0 0 1 0-109.042162 54.705586 54.705586 0 0 1 0 109.042162z m177.124324 0a54.705586 54.705586 0 1 1 49.908468-54.521081 52.491532 52.491532 0 0 1-49.908468 54.521081z" p-id="5722"></path><path d="M512 1024A512 512 0 1 1 1024 512 512.645766 512.645766 0 0 1 512 1024z m0-972.892252a461.261261 461.261261 0 1 0 461.261261 461.261261 461.261261 461.261261 0 0 0-461.261261-461.261261z" p-id="5723"></path>
                </svg>
            """,
            "class": "",
        },
        {
            "name": "DingTalk",
            "url": "https://qr.dingtalk.com/action/joingroup?code=v1,k1,OmDlBXpjW+I2vWjKDsjvI9dhcXjGZi3bQiojOq3dlDw=&_dt_no_comment=1&origin=11",
            "html": """
                <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
                    <path d="M512 0C229.205333 0 0 229.205333 0 512s229.205333 512 512 512 512-229.205333 512-512S794.794667 0 512 0z m237.312 480.810667c-1.109333 4.48-3.712 11.093333-7.424 18.986666h0.128l-0.426667 0.682667c-21.504 46.037333-77.610667 136.106667-77.610666 136.106667l-0.298667-0.597334-16.384 28.501334h79.018667l-150.912 200.917333 34.304-136.533333h-62.208l21.589333-90.282667c-17.493333 4.224-38.101333 10.026667-62.592 17.92 0 0-33.109333 19.370667-95.317333-37.333333 0 0-41.984-36.992-17.578667-46.165334 10.410667-3.925333 50.304-8.917333 81.706667-13.226666 42.410667-5.674667 68.48-8.789333 68.48-8.789334s-130.773333 2.005333-161.792-2.901333c-30.976-4.906667-70.4-56.704-78.805334-102.186667 0 0-12.970667-25.002667 27.904-13.226666 40.917333 11.818667 210.005333 46.08 210.005334 46.08S321.109333 411.434667 306.517333 394.922667c-14.634667-16.469333-43.093333-89.770667-39.424-134.869334 0 0 1.621333-11.221333 13.098667-8.192 0 0 162.602667 74.282667 273.792 114.986667 111.104 40.704 207.786667 61.397333 195.328 114.005333z" opacity=".65" p-id="6077"></path>
                </svg>
            """,
            "class": "",
        },
    ],
    "light_css_variables": {
        "color-brand-primary": "#2196f3",
        "color-brand-content": "#2196f3",
        "color-admonition-background": "#f8f9fa",
    },
    "dark_css_variables": {
        "color-link": "#2196f3",
        "color-link--hover": "#2196f3",
        "color-brand-primary": "#64b5f6",
        "color-brand-content": "#64b5f6",
    },
}

source_suffix = [".md", ".rst"]


# -- Options for API documentation -------------------------------------------

autodoc_member_order = "bysource"
autodoc_typehints = "description"
autodoc_class_signature = "separated"
autodoc_default_options = {
    "special-members": "__call__",
}

add_module_names = False
python_display_short_literal_types = True


def skip_member(app, what, name, obj, skip, options):
    if name in [
        "__call__",
        "_format",
        "_format_agent_message",
        "_format_tool_sequence",
    ]:
        return False

    return skip


def setup(app):
    app.connect("autodoc-skip-member", skip_member)


================================================
FILE: docs/tutorial/en/index.rst
================================================
.. AgentScope Doc documentation master file, created by
   sphinx-quickstart on Thu Aug  8 15:07:21 2024.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to AgentScope's documentation!
==========================================

.. toctree::
   :maxdepth: 1
   :caption: Tutorial

   tutorial/quickstart_installation
   tutorial/quickstart_key_concept
   tutorial/quickstart_message
   tutorial/quickstart_agent

.. toctree::
   :maxdepth: 1
   :caption: Workflow

   tutorial/workflow_conversation
   tutorial/workflow_multiagent_debate
   tutorial/workflow_concurrent_agents
   tutorial/workflow_routing
   tutorial/workflow_handoffs

.. toctree::
   :maxdepth: 1
   :caption: FAQ

   tutorial/faq

.. toctree::
   :maxdepth: 1
   :caption: Model and Context

   tutorial/task_model
   tutorial/task_prompt
   tutorial/task_token
   tutorial/task_memory
   tutorial/task_long_term_memory

.. toctree::
   :maxdepth: 1
   :caption: Tool

   tutorial/task_tool
   tutorial/task_mcp
   tutorial/task_agent_skill

.. toctree::
   :maxdepth: 1
   :caption: Agent

   tutorial/task_agent
   tutorial/task_state
   tutorial/task_hook
   tutorial/task_middleware
   tutorial/task_a2a
   tutorial/task_realtime

.. toctree::
   :maxdepth: 1
   :caption: Features

   tutorial/task_pipeline
   tutorial/task_plan
   tutorial/task_rag
   tutorial/task_studio
   tutorial/task_tracing
   tutorial/task_eval
   tutorial/task_eval_openjudge
   tutorial/task_embedding
   tutorial/task_tts
   tutorial/task_tuner


================================================
FILE: docs/tutorial/en/make.bat
================================================
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.https://www.sphinx-doc.org/
	exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd


================================================
FILE: docs/tutorial/en/src/README.md
================================================


================================================
FILE: docs/tutorial/en/src/faq.py
================================================
# -*- coding: utf-8 -*-
"""
.. _faq:

FAQ
========================================

About AgentScope
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*What is AgentScope?*
    AgentScope is a multi-agent framework, aiming to provide a simple yet efficient way to build LLM-empowered agent applications.

*What is the difference between AgentScope v1.0 and v0.x?*
    AgentScope v1.0 is a complete refactoring of the framework, equipped with new features and improvements. Refer to for detailed changes.


About Model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*How to integrate my own model with AgentScope?*
    Create your own model by inheriting ``agentscope.model.ChatModelBase`` and implement the ``__call__`` method.

*What models are supported by AgentScope?*
    Currently, AgentScope has built-in support for DashScope, Gemini, OpenAI, Anthropic, and Ollama APIs, and the ``OpenAIChatModel`` compatible with DeepSeek and vLLMs models.

*How to monitor the token usage in AgentScope?*
    In AgentScope Studio, we provide visualization of token usage and tracing. Refer :ref:`studio` section for more details.


About Agent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*How to create my own agent?*
    You can choose to use the ``ReActAgent`` class directly, or create your own agent by inheriting from ``AgentBase`` or ``ReActAgentBase`` classes. Refer to the :ref:`agent` section for more details.


*How to forward the (streaming) output of agents to my own frontend or application?*
    Use the pre hook of the ``print`` function to forward printing messages. Refer to the :ref:`hook` section.


About Tools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*How many tools are provided by AgentScope?*
    AgentScope provides a set of built-in tools, including ``execute_python_code``, ``execute_shell_command``, ``write_text_file`` , etc. You can find them under ``agentscope.tool`` module.


About Reporting Bugs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*How can I report a bug in AgentScope?*
    If you encounter a bug while using AgentScope, please report it by opening an issue on our GitHub repository.

*How can I report a security bug in AgentScope?*
    If you discover a security issue in AgentScope, please report it to us through the `Alibaba Security Response Center (ASRC) <https://security.alibaba.com/>`_.

"""


================================================
FILE: docs/tutorial/en/src/quickstart_agent.py
================================================
# -*- coding: utf-8 -*-
"""
.. _react-agent:

Create ReAct Agent
====================

AgentScope provides out-of-the-box ReAct agent ``ReActAgent`` under ``agentscope.agent`` that can be used directly.

It supports the following features at the same time:

- ✨ Basic features
    - Support **hooks** around ``reply``, ``observe``, ``print``, ``_reasoning`` and ``_acting`` functions
    - Support structured output
- ✋ Realtime Steering
    - Support user **interrupt**
    - Support customized **interruption handling**
- 🛠️ Tools
    - Support both **sync/async** tool functions
    - Support **streaming** tool response
    - Support **stateful** tools management
    - Support **parallel** tool calls
    - Support **MCP** server
- 💾 Memory
    - Support **agent-controlled** long-term memory management
    - Support static long-term memory management

.. tip:: Refer to the :ref:`agent` section for more details about these
 features. In quickstart, we focus on how to create a ReAct agent and run it.

"""

from agentscope.agent import ReActAgent, AgentBase
from agentscope.formatter import DashScopeChatFormatter
from agentscope.memory import InMemoryMemory
from agentscope.message import Msg
from agentscope.model import DashScopeChatModel
import asyncio
import os

from agentscope.tool import Toolkit, execute_python_code


# %%
# Creating ReAct Agent
# ------------------------------
# To improve the flexibility, the ``ReActAgent`` class exposes the following parameters in its constructor:
#
# .. list-table:: Initialization parameters of ``ReActAgent`` class
#   :header-rows: 1
#
#   * - Parameter
#     - Further Reading
#     - Description
#   * - ``name`` (required)
#     -
#     - The name of the agent
#   * - ``sys_prompt`` (required)
#     -
#     - The system prompt of the agent
#   * - ``model`` (required)
#     - :ref:`model`
#     - The model used by the agent to generate responses
#   * - ``formatter`` (required)
#     - :ref:`prompt`
#     - The prompt construction strategy, should be consistent with the model
#   * - ``toolkit``
#     - :ref:`tool`
#     - The toolkit to register/call tool functions.
#   * - ``memory``
#     - :ref:`memory`
#     - The short-term memory used to store the conversation history
#   * - ``long_term_memory``
#     - :ref:`long-term-memory`
#     - The long-term memory
#   * - ``long_term_memory_mode``
#     - :ref:`long-term-memory`
#     - The mode of the long-term memory:
#
#       - ``agent_control``: allow agent to control the long-term memory by itself
#       - ``static_control``: retrieving and recording from/to long-term memory will happen in the beginning/end of each reply.
#       - ``both``: activate the above two modes at the same time
#   * - ``enable_meta_tool``
#     - :ref:`tool`
#     - Whether to enable the meta tool, which allows the agent to manage tools by itself
#   * - ``parallel_tool_calls``
#     - :ref:`agent`
#     - Whether to allow parallel tool calls
#   * - ``max_iters``
#     -
#     - The maximum number of iterations for the agent to generate a response
#   * - ``plan_notebook``
#     - :ref:`plan`
#     - The plan notebook to manage the plans
#   * - ``print_hint_msg``
#     -
#     - Whether to print the hint message generated by the plan notebook at each step
#
# Taking DashScope API as example, we create an agent object as follows:


async def creating_react_agent() -> None:
    """Create a ReAct agent and run a simple task."""
    # Prepare tools
    toolkit = Toolkit()
    toolkit.register_tool_function(execute_python_code)

    jarvis = ReActAgent(
        name="Jarvis",
        sys_prompt="You're a helpful assistant named Jarvis",
        model=DashScopeChatModel(
            model_name="qwen-max",
            api_key=os.environ["DASHSCOPE_API_KEY"],
            stream=True,
            enable_thinking=False,
        ),
        formatter=DashScopeChatFormatter(),
        toolkit=toolkit,
        memory=InMemoryMemory(),
    )

    msg = Msg(
        name="user",
        content="Hi! Jarvis, run Hello World in Python.",
        role="user",
    )

    await jarvis(msg)


asyncio.run(creating_react_agent())

# %%
# Creating From Scratch
# --------------------------------
# You may want to create an agent from scratch, AgentScope provides two base classes for you to inherit from:
#
# .. list-table::
#   :header-rows: 1
#
#   * - Class
#     - Abstract Methods
#     - Description
#   * - ``AgentBase``
#     - | ``reply``
#       | ``observe``
#       | ``handle_interrupt``
#     - - The base class for all agents, supporting pre- and post- hooks around ``reply``, ``observe`` and ``print`` functions.
#       - Implement the realtime steering within the ``__call__`` method.
#   * - ``ReActAgentBase``
#     - | ``reply``
#       | ``observe``
#       | ``handle_interrupt``
#       | ``_reasoning``
#       | ``_acting``
#     - Add two abstract functions ``_reasoning`` and ``_acting`` on the basis of ``AgentBase``, as well as their hooks.
#
# Please refer to the :ref:`agent` section for more details about the agent class.
#
# Taking the ``AgentBase`` class as an example, we can create a custom agent
# class by inheriting from it and implementing the ``reply`` method.


class MyAgent(AgentBase):
    """A custom agent class"""

    def __init__(self) -> None:
        """Initialize the agent"""
        super().__init__()

        self.name = "Friday"
        self.sys_prompt = "You're a helpful assistant named Friday."
        self.model = DashScopeChatModel(
            model_name="qwen-max",
            api_key=os.environ["DASHSCOPE_API_KEY"],
            stream=False,
        )
        self.formatter = DashScopeChatFormatter()
        self.memory = InMemoryMemory()

    async def reply(self, msg: Msg | list[Msg] | None) -> Msg:
        """Reply to the message."""
        await self.memory.add(msg)

        # Prepare the prompt
        prompt = await self.formatter.format(
            [
                Msg("system", self.sys_prompt, "system"),
                *await self.memory.get_memory(),
            ],
        )

        # Call the model
        response = await self.model(prompt)

        msg = Msg(
            name=self.name,
            content=response.content,
            role="assistant",
        )

        # Record the response in memory
        await self.memory.add(msg)

        # Print the message
        await self.print(msg)
        return msg

    async def observe(self, msg: Msg | list[Msg] | None) -> None:
        """Observe the message."""
        # Store the message in memory
        await self.memory.add(msg)

    async def handle_interrupt(self) -> Msg:
        """Postprocess the interrupt."""
        # Taking a fixed response as example
        return Msg(
            name=self.name,
            content="I noticed you interrupted me, how can I help you?",
            role="assistant",
        )


async def run_custom_agent() -> None:
    """Run the custom agent."""
    agent = MyAgent()
    msg = Msg(
        name="user",
        content="Who are you?",
        role="user",
    )
    await agent(msg)


asyncio.run(run_custom_agent())

# %%
#
# Further Reading
# ---------------------
# - :ref:`agent`
# - :ref:`model`
# - :ref:`prompt`
# - :ref:`tool`
#


================================================
FILE: docs/tutorial/en/src/quickstart_installation.py
================================================
# -*- coding: utf-8 -*-
"""
.. _installation:

Installation
============================

AgentScope requires Python 3.10 or higher. You can install from source or pypi.

From PyPI
----------------
.. code-block:: bash

    pip install agentscope

From Source
----------------
To install AgentScope from source, you need to clone the repository from
GitHub and install by the following commands

.. code-block:: bash

    git clone -b main https://github.com/agentscope-ai/agentscope
    cd agentscope
    pip install -e .

To ensure AgentScope is installed successfully, check via executing the following code:
"""

import agentscope

print(agentscope.__version__)

# %%
# Extra Dependencies
# ----------------------------
#
# To satisfy the requirements of different functionalities, AgentScope provides
# extra dependencies that can be installed based on your needs.
#
# - full: Including extra dependencies for model APIs and tool functions
# - dev: Development dependencies, including testing and documentation tools
#
# For example, when installing the full dependencies, the installation command varies depending on your operating system.
#
# For Windows users:
#
# .. code-block:: bash
#
#       pip install agentscope[full]
#
# For Mac and Linux users:
#
# .. code-block:: bash
#
#       pip install agentscope\[full\]


================================================
FILE: docs/tutorial/en/src/quickstart_key_concept.py
================================================
# -*- coding: utf-8 -*-
"""
.. key-concepts:

Key Concepts
====================================

This chapter establishes key concepts from an engineering
perspective to introduce AgentScope's design.

.. note:: The goal of introducing the key concepts in AgentScope is to claim what practical problems AgentScope addresses and how it supports developers, rather than to offer formal definitions.

State
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In AgentScope, state management is a fundamental building block that maintains snapshots of objects' runtime data.

AgentScope separates object initialization from state management, allowing
object to be restored to different states after initialization through
``load_state_dict`` and ``state_dict`` methods.

In AgentScope, agent, memory, long-term memory and toolkit are all stateful
objects. AgentScope links the state management of these objects together by supporting nested state management.

Message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In AgentScope, message is the fundamental data structure,
used to

- exchange information between agents,
- display information in the user interface,
- store information in memory,
- act as a unified medium between AgentScope and different LLM APIs.

Tool
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A tool in AgentScope refers to callable object, no matter it's a

- function,
- partial function,
- instance method,
- class method,
- static method, or
- callable instance with ``__call__`` method.

Besides, the callable object can be either

- async or sync,
- streaming or non-streaming.

So feel free to use any callable object as a tool in AgentScope.

Agent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In AgentScope, the agent behaviors are abstracted into three core functions in
``AgentBase`` class:

- ``reply``: Handle incoming message(s) and generate a response message.
- ``observe``: Receive message(s) from the environment or other agents without returning a response.
- ``print``: Display message(s) to the target terminal, web interface, etc.

To support realtime steering, an additional ``handle_interrupt`` function is
provided to handle user interrupts during the agent's reply process.

Additionally, ReAct agent is the most important agent in AgentScope, where
the agent's reply process is divided into two stages:

- reasoning: thinking and generating tool calls by calling the LLM
- acting: execute the tool functions.

Thus, we provide two additional core functions in ``ReActAgentBase`` class,
``_reasoning`` and ``_acting``.

Formatter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter is the core component for LLM compatibility in AgentScope,
responsible for converting message objects into the required format for
LLM APIs.

Besides, additional functionality such as prompt engineering, truncation,
and message validation can also be implemented in the formatter.

Within the formatter, the "multi-agent" (or "multi-identity") concept differs
from the common multi-agent orchestration concept.
It focuses on the scenario where multiple identities are involved in the
given messages, so that the common used ``role`` field (usually "role",
"assistant" or "system") in LLM APIs cannot distinguish them.

Therefore, AgentScope provides multi-agent formatter to handle
this scenario, usually used in games, multi-person chats, and social
simulations.

.. note:: Multi-agent workflow **!=** multi-agent in formatter.
 For example, even if the following code snippet may involve multiple
 agents (the ``tool_agent`` and the ``tool_function`` caller), the input query
 is wrapped into a **user** message, so the ``role`` field can still distinguish
 between them.

 .. code-block:: python

    async def tool_function(query: str) -> str:
        \"\"\"Tool function calling another agent\"\"\"
        msg = Msg("user", query, role="user")
        tool_agent = Agent(name="Programmer")
        return await tool_agent(msg)

 Understanding this distinction helps developers better grasp AgentScope's formatter design.


Long-Term Memory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although providing different base classes for short- and
long-term memory, there are no strict distinctions between them in AgentScope.

In our view, everything should be **requirement-driven**. As long as your
needs are excellently met, developers can completely use just one powerful
memory system.

For ensuring the flexibility of AgentScope, we provide a two mode long-term
memory system, allowing the agent to manage (record and retrieve) the
long-term memory by its own.
"""


================================================
FILE: docs/tutorial/en/src/quickstart_message.py
================================================
# -*- coding: utf-8 -*-
"""
.. _message:

Create Message
====================

Message is the core concept in AgentScope, used to support multimodal data, tools API, information storage/exchange and prompt construction.

A message consists of four fields:

- ``name``,
- ``role``,
- ``content``, and
- ``metadata``

The types and descriptions of these fields are as follows:

.. list-table:: The fields in a message object
    :header-rows: 1

    * - Field
      - Type
      - Description
    * - name
      - ``str``
      - The name/identity of the message sender
    * - role
      - | ``Literal[``
        |     ``"system",``
        |     ``"assistant",``
        |     ``"user"``
        | ``]``
      - The role of the message sender, which must be one of "system", "assistant", or "user".
    * - content
      - ``str | list[ContentBlock]``
      - The data of the message, which can be a string or a list of blocks.
    * - metadata
      - ``dict[str, JSONSerializableObject] | None``
      - A dict containing additional metadata about the message, usually used for structured output.

.. tip:: - In application with multiple identities, the ``name`` field is used to distinguish between different identities.
 - The ``metadata`` field is recommended for structured output, which won't be included in the prompt construction.

Next, we introduce the supported blocks in the ``content`` field by their corresponding scenarios.
"""

from agentscope.message import (
    Msg,
    Base64Source,
    TextBlock,
    ThinkingBlock,
    ImageBlock,
    AudioBlock,
    VideoBlock,
    ToolUseBlock,
    ToolResultBlock,
)
import json

# %%
# Creating Textual Message
# -----------------------------
# Creating a message object by providing the ``name``, ``role``, and ``content`` fields.
#

msg = Msg(
    name="Jarvis",
    role="assistant",
    content="Hi! How can I help you?",
)

print(f"The name of the sender: {msg.name}")
print(f"The role of the sender: {msg.role}")
print(f"The content of the message: {msg.content}")

# %%
# Creating Multimodal Message
# --------------------------------------
# The message class supports multimodal content by providing different content blocks:
#
# .. list-table:: Multimodal content blocks in AgentScope
#     :header-rows: 1
#
#     * - Class
#       - Description
#       - Example
#     * - TextBlock
#       - Pure text data
#       - .. code-block:: python
#
#             TextBlock(
#                type="text",
#                text="Hello, world!"
#             )
#     * - ImageBlock
#       - The image data
#       - .. code-block:: python
#
#             ImageBlock(
#                type="image",
#                source=URLSource(
#                    type="url",
#                    url="https://example.com/image.jpg"
#                )
#             )
#     * - AudioBlock
#       - The audio data
#       - .. code-block:: python
#
#             AudioBlock(
#                type="audio",
#                source=URLSource(
#                    type="url",
#                    url="https://example.com/audio.mp3"
#                )
#             )
#     * - VideoBlock
#       - The video data
#       - .. code-block:: python
#
#             VideoBlock(
#                type="video",
#                source=URLSource(
#                    type="url",
#                    url="https://example.com/video.mp4"
#                )
#             )
#
# For ``ImageBlock``, ``AudioBlock`` and ``VideoBlock``, you can use either a base64 encoded string as the source:
#

msg = Msg(
    name="Jarvis",
    role="assistant",
    content=[
        TextBlock(
            type="text",
            text="This is a multimodal message with base64 encoded data.",
        ),
        ImageBlock(
            type="image",
            source=Base64Source(
                type="base64",
                media_type="image/jpeg",
                data="/9j/4AAQSkZ...",
            ),
        ),
        AudioBlock(
            type="audio",
            source=Base64Source(
                type="base64",
                media_type="audio/mpeg",
                data="SUQzBAAAAA...",
            ),
        ),
        VideoBlock(
            type="video",
            source=Base64Source(
                type="base64",
                media_type="video/mp4",
                data="AAAAIGZ0eX...",
            ),
        ),
    ],
)

# %%
# Creating Thinking Message
# --------------------------------------
# The ``ThinkingBlock`` is to support reasoning models, containing the thinking process of the model.
#

msg_thinking = Msg(
    name="Jarvis",
    role="assistant",
    content=[
        ThinkingBlock(
            type="thinking",
            thinking="I'm building an example for thinking block in AgentScope.",
        ),
        TextBlock(
            type="text",
            text="This is an example for thinking block.",
        ),
    ],
)

# %%
# .. _tool-block:
#
# Creating Tool Use/Result Message
# --------------------------------------
# The ``ToolUseBlock`` and ``ToolResultBlock`` are to support tools API:
#

msg_tool_call = Msg(
    name="Jarvis",
    role="assistant",
    content=[
        ToolUseBlock(
            type="tool_use",
            id="343",
            name="get_weather",
            input={
                "location": "Beijing",
            },
        ),
    ],
)

msg_tool_res = Msg(
    name="system",
    role="system",
    content=[
        ToolResultBlock(
            type="tool_result",
            id="343",
            name="get_weather",
            output="The weather in Beijing is sunny with a temperature of 25°C.",
        ),
    ],
)


# %%
# .. tip:: Refer to the :ref:`tool` section for more information about tools API in AgentScope.
#
# Serialization and Deserialization
# ------------------------------------------------
# Message object can be serialized and deserialized by ``to_dict`` and ``from_dict`` methods, respectively.

serialized_msg = msg.to_dict()

print(type(serialized_msg))
print(json.dumps(serialized_msg, indent=4))

# %%
# Deserialize a message from a string in JSON format.

new_msg = Msg.from_dict(serialized_msg)

print(type(new_msg))
print(f'The sender of the message: "{new_msg.name}"')
print(f'The role of the sender: "{new_msg.role}"')
print(f'The content of the message: "{json.dumps(new_msg.content, indent=4)}"')

# %%
# Property Functions
# ------------------------------------------------
# To ease the use of message object, AgentScope provides these functions:
#
# .. list-table:: Functions of the message object
#   :header-rows: 1
#
#   * - Function
#     - Parameters
#     - Description
#   * - get_text_content
#     - \-
#     - Gather content from all ``TextBlock`` in to a single string (separated by "\\n").
#   * - get_content_blocks
#     - ``block_type``
#     - Return a list of content blocks of the specified type. If ``block_type`` not provided, return content in blocks format.
#   * - has_content_blocks
#     - ``block_type``
#     - Check whether the message has content blocks of the specified type. The ``str`` content is considered as a ``TextBlock`` type.


================================================
FILE: docs/tutorial/en/src/task_a2a.py
================================================
# -*- coding: utf-8 -*-
"""
.. _a2a:

A2A Agent
============================

A2A (Agent-to-Agent) is an open standard protocol for enabling interoperable communication between different AI agents.

AgentScope provides support for the A2A protocol at two levels: obtaining Agent Card information and connecting to remote agents. The related APIs are as follows:

.. list-table:: A2A Related Classes
    :header-rows: 1

    * - Class
      - Description
    * - ``A2AAgent``
      - Agent class for communicating with remote A2A agents
    * - ``A2AChatFormatter``
      - Formatter for converting between AgentScope messages and A2A message/task formats
    * - ``AgentCardResolverBase``
      - Base class for Agent Card resolvers
    * - ``FileAgentCardResolver``
      - Resolver for loading Agent Cards from local JSON files
    * - ``WellKnownAgentCardResolver``
      - Resolver for fetching Agent Cards from the well-known path of a URL
    * - ``NacosAgentCardResolver``
      - Resolver for fetching Agent Cards from the Nacos Agent Registry

This section demonstrates how to create an ``A2AAgent`` and communicate with remote A2A agents.

.. note:: Note that A2A support is an **experimental feature** and may change in future versions. Due to limitations of the A2A protocol itself, ``A2AAgent`` cannot fully align with local agents like ``ReActAgent``, including:

 - Only supports chatbot scenarios, i.e., only supports conversations between one user and one agent (does not affect handoff/router usage patterns)
 - Does not support real-time interruption during conversations
 - Does not support agentic structured output
 - In the current implementation, messages received by the ``observe`` method are stored locally and sent to the remote agent together when the ``reply`` method is called. Therefore, if several ``observe`` calls are made without a subsequent ``reply`` call, those messages will not be seen by the remote agent


"""

from a2a.types import AgentCard, AgentCapabilities
from v2.nacos import ClientConfig

from agentscope.a2a import WellKnownAgentCardResolver, NacosAgentCardResolver
from agentscope.agent import A2AAgent, UserAgent
from agentscope.message import Msg, TextBlock
from agentscope.tool import ToolResponse

# %%
# Obtaining Agent Cards
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# First, we need to obtain an Agent Card to connect to the corresponding agent. An Agent Card contains information such as the agent's name, description, capabilities, and connection details.
#
# Manually Creating Agent Card
# --------------------------------
#
# If you know all the information of an Agent Card, you can directly create an Agent Card object from `a2a.types.AgentCard`.
#

# Create an Agent Card object
agent_card = AgentCard(
    name="Friday",  # Agent name
    description="A fun chatting companion",  # Agent description
    url="http://localhost:8000",  # Agent's RPC service URL
    version="1.0.0",  # Agent version
    capabilities=AgentCapabilities(  # Agent capability configuration
        push_notifications=False,
        state_transition_history=True,
        streaming=True,
    ),
    default_input_modes=["text/plain"],  # Supported input formats
    default_output_modes=["text/plain"],  # Supported output formats
    skills=[],  # Agent skill list
)

# %%
#
# Fetching from Remote Services
# --------------------------------
# AgentScope also supports fetching from the standard path of remote services (well-known server).
# Here's an example using ``WellKnownAgentCardResolver`` to fetch an Agent Card from the standard path of a remote service:
#


async def agent_card_from_well_known_website() -> AgentCard:
    """Example of fetching an Agent Card from the well-known path of a remote service."""
    # Create an Agent Card resolver
    resolver = WellKnownAgentCardResolver(
        base_url="http://localhost:8000",
    )
    # Fetch and return the Agent Card
    return await resolver.get_agent_card()


# %%
# Loading Agent Cards from Local Files
# --------------------------------
#
# The ``FileAgentCardResolver`` class supports loading Agent Cards from local JSON files, suitable for configuration file management scenarios.
# An example of an Agent Card in JSON format is shown below:
#
# .. code-block:: json
#     :caption: Example Agent Card JSON file content
#
#     {
#         "name": "RemoteAgent",
#         "url": "http://localhost:8000",
#         "description": "Remote A2A Agent",
#         "version": "1.0.0",
#         "capabilities": {},
#         "default_input_modes": ["text/plain"],
#         "default_output_modes": ["text/plain"],
#         "skills": []
#     }
#
# You can easily load this file using ``FileAgentCardResolver``:
#


async def agent_card_from_file() -> AgentCard:
    """Example of loading an Agent Card from a local JSON file."""
    from agentscope.a2a import FileAgentCardResolver

    # Load Agent Card from JSON file
    resolver = FileAgentCardResolver(
        file_path="./agent_card.json",  # JSON file path
    )
    # Fetch and return the Agent Card
    return await resolver.get_agent_card()


# %%
# Fetching Agent Cards from Nacos Registry
# --------------------------------
#
# Nacos is an open-source dynamic service discovery, configuration management, and service management platform. In version 3.1.0, it introduced the Agent Registry feature, supporting distributed registration, discovery, and version management of A2A agents.
#
# .. important:: The prerequisite for using ``NacosAgentCardResolver`` is that the user has deployed a Nacos server version 3.1.0 or higher. For deployment and registration procedures, please refer to the `official documentation <https://nacos.io/docs/latest/quickstart/quick-start>`_.
#


async def agent_card_from_nacos() -> AgentCard:
    """Example of fetching an Agent Card from the Nacos registry."""

    # Create a Nacos Agent Card resolver
    resolver = NacosAgentCardResolver(
        remote_agent_name="my-remote-agent",  # Agent name registered in Nacos
        nacos_client_config=ClientConfig(
            server_addresses="http://localhost:8848",  # Nacos server address
            # Other optional configuration items
        ),
    )
    # Fetch and return the Agent Card
    return await resolver.get_agent_card()


# %%
# Building an A2A Agent
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# The ``A2AAgent`` class provided by AgentScope is used to communicate with remote A2A agents, and its usage is similar to regular agents.

agent = A2AAgent(agent_card=agent_card)

# %%
# Using ``A2AAgent``, developers can build chatbot scenario conversations, or encapsulate it as a tool function to build more complex application scenarios such as handoff/router.
# Currently, the format protocol conversion supported by ``A2AAgent`` is handled by ``agentscope.formatter.A2AChatFormatter``, which supports:
#
# - Converting AgentScope's ``Msg`` messages to A2A protocol's ``Message`` format
# - Converting A2A protocol responses back to AgentScope's ``Msg`` format
# - Converting A2A protocol's ``Task`` responses to AgentScope's ``Msg`` format
# - Supporting multiple content types such as text, images, audio, and video
#


async def a2a_in_chatbot() -> None:
    """Example of chatting using A2AAgent."""

    user = UserAgent("user")

    msg = None
    while True:
        msg = await user(msg)
        if msg.get_text_content() == "exit":
            break
        msg = await agent(msg)


# %%
# Or encapsulate it as a tool function for invocation:


async def create_worker(query: str) -> ToolResponse:
    """Complete a given task through a sub-agent

    Args:
        query (`str`):
            Description of the task to be completed by the sub-agent
    """
    res = await agent(
        Msg("user", query, "user"),
    )
    return ToolResponse(
        content=[
            TextBlock(
                type="text",
                text=res.get_text_content(),
            ),
        ],
    )


================================================
FILE: docs/tutorial/en/src/task_agent.py
================================================
# -*- coding: utf-8 -*-
"""
.. _agent:

Agent
=========================

In this tutorial, we first focus on introducing the ReAct agent in AgentScope,
then we briefly introduce how to customize your own agent from scratch.

ReAct Agent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In AgentScope, the ``ReActAgent`` class integrates various features into a final implementation, including

.. list-table:: Features of ``ReActAgent``
    :header-rows: 1

    * - Feature
      - Reference
    * - Support realtime steering
      -
    * - Support memory compression
      -
    * - Support parallel tool calls
      -
    * - Support structured output
      -
    * - Support fine-grained MCP control
      - :ref:`mcp`
    * - Support agent-controlled tools management (Meta tool)
      - :ref:`tool`
    * - Support self-controlled long-term memory
      - :ref:`long-term-memory`
    * - Support automatic state management
      - :ref:`state`


Due to limited space, in this tutorial we only demonstrate the first three
features of ``ReActAgent`` class, leaving the others to the corresponding sections
listed above.

"""

import asyncio
import json
import os
from datetime import datetime
import time

from pydantic import BaseModel, Field

from agentscope.agent import ReActAgent
from agentscope.formatter import DashScopeChatFormatter
from agentscope.memory import InMemoryMemory
from agentscope.message import TextBlock, Msg
from agentscope.model import DashScopeChatModel
from agentscope.tool import Toolkit, ToolResponse


# %%
# Realtime Steering
# ---------------------------------------
#
# The realtime steering allows user to interrupt the agent's reply at any time,
# which is implemented based on the asyncio cancellation mechanism.
#
# Specifically, when calling the ``interrupt`` method of the agent, it will
# cancel the current reply task, and execute the ``handle_interrupt`` method
# for postprocessing.
#
# .. hint:: With the feature of supporting streaming tool results in
#  :ref:`tool`, users can interrupt the tool execution if it takes too long or
#  deviates from user expectations by Ctrl+C in the terminal or calling the
#  ``interrupt`` method of the agent in your code.
#
# The interruption logic has been implemented in the ``AgentBase`` class as a
# basic feature, leaving a ``handle_interrupt`` method for users to customize the
# post-processing of interruption as follows:
#
# .. code-block:: python
#
#     # code snippet of AgentBase
#     class AgentBase:
#         ...
#         async def __call__(self, *args: Any, **kwargs: Any) -> Msg:
#             ...
#             reply_msg: Msg | None = None
#             try:
#                 self._reply_task = asyncio.current_task()
#                 reply_msg = await self.reply(*args, **kwargs)
#
#             except asyncio.CancelledError:
#                 # Catch the interruption and handle it by the handle_interrupt method
#                 reply_msg = await self.handle_interrupt(*args, **kwargs)
#
#             ...
#
#         @abstractmethod
#         async def handle_interrupt(self, *args: Any, **kwargs: Any) -> Msg:
#             pass
#
#
# In ``ReActAgent`` class, we return a fixed message "I noticed that you have
# interrupted me. What can I do for you?" as follows:
#
# .. figure:: ../../_static/images/interruption_en.gif
#     :width: 100%
#     :align: center
#     :class: bordered-image
#     :alt: Example of interruption
#
#     Example of interruption
#
# You can override it with your own implementation, for example, calling the LLM
# to generate a simple response to the interruption.
#
#
# Memory Compression
# ----------------------------------------
# As conversations grow longer, the token count in memory can exceed model context
# limits or slow down inference. ``ReActAgent`` provides an automatic memory compression
# feature to address this issue.
#
# **Basic Usage**
#
# To enable memory compression, provide a ``CompressionConfig`` instance when initializing
# the ``ReActAgent``:
#
# .. code-block:: python
#
#     from agentscope.agent import ReActAgent
#     from agentscope.token import CharTokenCounter
#
#     agent = ReActAgent(
#         name="Assistant",
#         sys_prompt="You are a helpful assistant.",
#         model=model,
#         formatter=formatter,
#         compression_config=ReActAgent.CompressionConfig(
#             enable=True,
#             agent_token_counter=CharTokenCounter(),  # The token counter for the agent
#             trigger_threshold=10000,  # Trigger compression when exceeding 10000 tokens
#             keep_recent=3,            # Keep the most recent 3 messages uncompressed
#         ),
#     )
#
# When memory compression is enabled, the agent monitors the token count in its memory.
# Once it exceeds the ``trigger_threshold``, the agent automatically:
#
# 1. Identifies messages that haven't been compressed yet (via ``exclude_mark``)
# 2. Keeps the most recent ``keep_recent`` messages uncompressed (to preserve recent context)
# 3. Sends older messages to an LLM to generate a structured summary
# 4. Marks the compressed messages with ``MemoryMark.COMPRESSED`` (via ``update_messages_mark``)
# 5. Stores the summary in memory (via ``update_compressed_summary``)
#
# .. important:: The compression uses a **marking mechanism** rather than replacing messages. Old messages are marked as compressed and excluded from future retrievals via ``exclude_mark=MemoryMark.COMPRESSED``, while the generated summary is stored separately and retrieved when needed. This approach preserves the original messages and allows flexible memory management. For more details about the mark functionality, please refer to :ref:`memory`.
#
# By default, the compressed summary is structured into five key fields:
#
# - **task_overview**: The user's core request and success criteria
# - **current_state**: What has been completed so far, including files and outputs
# - **important_discoveries**: Technical constraints, decisions, errors, and failed approaches
# - **next_steps**: Specific actions needed to complete the task
# - **context_to_preserve**: User preferences, domain details, and promises made
#
# **Customizing Compression**
#
# You can customize how compression works by specifying ``summary_schema``,
# ``summary_template``, and ``compression_prompt`` parameters.
#
# - **compression_prompt**: Guides the LLM on how to generate the summary
# - **summary_schema**: Defines the structure of the compressed summary using a Pydantic model
# - **summary_template**: Formats how the compressed summary is presented back to the agent
#
# Here's an example of customizing the compression:
#
# .. code-block:: python
#
#     from pydantic import BaseModel, Field
#
#     # Define a custom summary structure
#     class CustomSummary(BaseModel):
#         main_topic: str = Field(
#             max_length=200,
#             description="The main topic of the conversation"
#         )
#         key_points: str = Field(
#             max_length=400,
#             description="Important points discussed"
#         )
#         pending_tasks: str = Field(
#             max_length=200,
#             description="Tasks that remain to be done"
#         )
#
#     # Create agent with custom compression configuration
#     agent = ReActAgent(
#         name="Assistant",
#         sys_prompt="You are a helpful assistant.",
#         model=model,
#         formatter=formatter,
#         compression_config=ReActAgent.CompressionConfig(
#             enable=True,
#             agent_token_counter=CharTokenCounter(),
#             trigger_threshold=10000,
#             keep_recent=3,
#             # Custom schema for structured summary
#             summary_schema=CustomSummary,
#             # Custom prompt to guide compression
#             compression_prompt=(
#                 "<system-hint>Please summarize the above conversation "
#                 "focusing on the main topic, key discussion points, "
#                 "and any pending tasks.</system-hint>"
#             ),
#             # Custom template to format the summary
#             summary_template=(
#                 "<system-info>Conversation Summary:\n"
#                 "Main Topic: {main_topic}\n\n"
#                 "Key Points:\n{key_points}\n\n"
#                 "Pending Tasks:\n{pending_tasks}"
#                 "</system-info>"
#             ),
#         ),
#     )
#
# The ``summary_template`` uses the fields defined in ``summary_schema`` as placeholders
# (e.g., ``{main_topic}``, ``{key_points}``). After the LLM generates the structured summary,
# these placeholders will be replaced with the actual values.
#
# .. note:: The agent ensures that tool use and tool result pairs are kept together during compression to maintain the integrity of the conversation flow.
#
# .. tip:: You can use a smaller, faster model for compression by specifying a different ``compression_model`` and ``compression_formatter`` to reduce costs and latency.
#
#
#
# Parallel Tool Calls
# ----------------------------------------
# ``ReActAgent`` supports parallel tool calls by providing a ``parallel_tool_calls``
# argument in its constructor.
# When multiple tool calls are generated, and ``parallel_tool_calls`` is set to ``True``,
# they will be executed in parallel by the ``asyncio.gather`` function.
#
# .. note:: The parallel tool execution in ``ReActAgent`` is implemented based on ``asyncio.gather``. Therefore, to maximize the effect of parallel tool execution, both the tool function itself and the logic within it must be asynchronous.
#
# .. note:: When running, please ensure that parallel tool calling is supported at the model level and the corresponding parameters are set correctly (can be passed through ``generate_kwargs``). For example, for the DashScope API, you need to set ``parallel_tool_calls`` to ``True``, otherwise parallel tool calling will not be possible.


# prepare a tool function
async def example_tool_function(tag: str) -> ToolResponse:
    """A sample example tool function"""
    start_time = datetime.now().strftime("%H:%M:%S.%f")

    # Sleep for 3 seconds to simulate a long-running task
    await asyncio.sleep(3)

    end_time = datetime.now().strftime("%H:%M:%S.%f")
    return ToolResponse(
        content=[
            TextBlock(
                type="text",
                text=f"Tag {tag} started at {start_time} and ended at {end_time}. ",
            ),
        ],
    )


toolkit = Toolkit()
toolkit.register_tool_function(example_tool_function)

# Create an ReAct agent
agent = ReActAgent(
    name="Jarvis",
    sys_prompt="You're a helpful assistant named Jarvis.",
    model=DashScopeChatModel(
        model_name="qwen-max",
        api_key=os.environ["DASHSCOPE_API_KEY"],
        # Preset the generation kwargs to enable parallel tool calls
        generate_kwargs={
            "parallel_tool_calls": True,
        },
    ),
    memory=InMemoryMemory(),
    formatter=DashScopeChatFormatter(),
    toolkit=toolkit,
    parallel_tool_calls=True,
)


async def example_parallel_tool_calls() -> None:
    """Example of parallel tool calls"""
    # prompt the agent to generate two tool calls at once
    await agent(
        Msg(
            "user",
            "Generate two tool calls of the 'example_tool_function' function with tag as 'tag1' and 'tag2' AT ONCE so that they can execute in parallel.",
            "user",
        ),
    )


asyncio.run(example_parallel_tool_calls())

# %%
# Structured Output
# ----------------------------------------
# To generate a structured output, the ``ReActAgent`` instance receives a child class
# of the ``pydantic.BaseModel`` as the ``structured_model`` argument in its ``__call__`` function.
# Then we can get the structured output from the ``metadata`` field of the returned message.
#
#
# Taking introducing Einstein as an example:
#

# Create an ReAct agent
agent = ReActAgent(
    name="Jarvis",
    sys_prompt="You're a helpful assistant named Jarvis.",
    model=DashScopeChatModel(
        model_name="qwen-max",
        api_key=os.environ["DASHSCOPE_API_KEY"],
        # Preset the generation kwargs to enable parallel tool calls
        generate_kwargs={
            "parallel_tool_calls": True,
        },
    ),
    memory=InMemoryMemory(),
    formatter=DashScopeChatFormatter(),
    toolkit=Toolkit(),
    parallel_tool_calls=True,
)


# The structured model
class Model(BaseModel):
    name: str = Field(description="The name of the person")
    description: str = Field(
        description="A one-sentence description of the person",
    )
    age: int = Field(description="The age")
    honor: list[str] = Field(description="A list of honors of the person")


async def example_structured_output() -> None:
    """The example structured output"""
    res = await agent(
        Msg(
            "user",
            "Introduce Einstein",
            "user",
        ),
        structured_model=Model,
    )
    print("\nThe structured output:")
    print(json.dumps(res.metadata, indent=4))


asyncio.run(example_structured_output())

# %%
# Customizing Agent
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# AgentScope provides two base classes, ``AgentBase`` and ``ReActAgentBase``, which
# differ in the abstract methods they define and the hooks they support.
# Specifically, the ``ReActAgentBase`` extends ``AgentBase`` with additional ``_reasoning`` and ``_acting``
# abstract methods, as well as their pre- and post- hooks.
#
# Developers can choose to inherit from either of these base classes based on their needs.
# We summarize the agent under ``agentscope.agent`` module as follows:
#
# .. list-table:: Agent classes in AgentScope
#     :header-rows: 1
#
#     * - Class
#       - Abstract Method
#       - Support Hooks
#       - Description
#     * - ``AgentBase``
#       - | ``reply``
#         | ``observe``
#         | ``print``
#         | ``handle_interrupt``
#       - | pre\_/post_reply
#         | pre\_/post_observe
#         | pre\_/post_print
#       - The base class for all agents, providing the basic interface and hooks.
#     * - ``ReActAgentBase``
#       - | ``reply``
#         | ``observe``
#         | ``print``
#         | ``handle_interrupt``
#         | ``_reasoning``
#         | ``_acting``
#       - | pre\_/post_reply
#         | pre\_/post_observe
#         | pre\_/post_print
#         | pre\_/post_reasoning
#         | pre\_/post_acting
#       - The abstract class for ReAct agent, extending ``AgentBase`` with reasoning and acting abstract methods and their hooks.
#     * - ``ReActAgent``
#       - \-
#       - | pre\_/post_reply
#         | pre\_/post_observe
#         | pre\_/post_print
#         | pre\_/post_reasoning
#         | pre\_/post_acting
#       - An implementation of ``ReActAgentBase``
#     * - ``UserAgent``
#       -
#       -
#       - A special agent that represents the user, used to interact with the agent
#     * - ``A2aAgent``
#       - \-
#       - | pre\_/post_reply
#         | pre\_/post_observe
#         | pre\_/post_print
#       - Agent for communicating with remote A2A agents, see :ref:`a2a`
#
#
#
# Further Reading
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# - :ref:`tool`
# - :ref:`hook`
# - :ref:`a2a`
#


================================================
FILE: docs/tutorial/en/src/task_agent_skill.py
================================================
# -*- coding: utf-8 -*-
"""
.. _agent_skill:

Agent Skill
============================

`Agent skill <https://claude.com/blog/skills>`_ is an approach proposed by
Anthropic to improve agent capabilities on specific tasks.

AgentScope provides built-in support for Agent Skills through the ``Toolkit``
class, allowing users to easily register and manage agent skills.

The related APIs are as follows:

.. list-table:: Agent skill API in ``Toolkit`` class
    :header-rows: 1

    * - API
      - Description
    * - ``register_agent_skill``
      - Register agent skills from a given directory.
    * - ``remove_agent_skill``
      - Remove a registered agent skill by name.
    * - ``get_agent_skill_prompt``
      - Get the prompt for all registered agent skills, which can be
        attached to the system prompt for the agent.

In this section we demonstrate how to register agent skills and use them in an
ReAct agent.
"""
import os

from agentscope.agent import ReActAgent
from agentscope.formatter import DashScopeChatFormatter
from agentscope.memory import InMemoryMemory
from agentscope.model import DashScopeChatModel
from agentscope.tool import Toolkit

# %%
# Registering Agent Skills
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# First, we need to prepare an agent skill directory, which follows the
# requirements specified in the `Anthropic blog <https://claude.com/blog/skills>`_.
#
# .. note:: The skill directory must contain a ``SKILL.md`` file containing
#  YAML frontmatter and instructions.
#
# Here, we fake an example skill dire
Download .txt
gitextract_03u1mqs9/

├── .gemini/
│   └── styleguide.md
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── custom.md
│   │   └── feature_request.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── copilot-instructions.md
│   ├── scripts/
│   │   └── update_news.py
│   └── workflows/
│       ├── pr-title-check.yml
│       ├── pre-commit.yml
│       ├── publish-pypi.yml
│       ├── sphinx_docs.yml
│       ├── stale.yml
│       ├── toc.yml
│       ├── unittest.yml
│       └── update_news.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CONTRIBUTING.md
├── CONTRIBUTING_zh.md
├── LICENSE
├── README.md
├── README_zh.md
├── docs/
│   ├── NEWS.md
│   ├── NEWS_zh.md
│   ├── changelog.md
│   ├── roadmap.md
│   └── tutorial/
│       ├── _static/
│       │   ├── css/
│       │   │   └── gallery.css
│       │   └── language_switch.js
│       ├── _templates/
│       │   ├── components/
│       │   │   └── language-switch.html
│       │   ├── module.rst_t
│       │   ├── package.rst_t
│       │   ├── page.html
│       │   └── sidebar/
│       │       └── navigation.html
│       ├── en/
│       │   ├── Makefile
│       │   ├── build.sh
│       │   ├── conf.py
│       │   ├── index.rst
│       │   ├── make.bat
│       │   └── src/
│       │       ├── README.md
│       │       ├── faq.py
│       │       ├── quickstart_agent.py
│       │       ├── quickstart_installation.py
│       │       ├── quickstart_key_concept.py
│       │       ├── quickstart_message.py
│       │       ├── task_a2a.py
│       │       ├── task_agent.py
│       │       ├── task_agent_skill.py
│       │       ├── task_embedding.py
│       │       ├── task_eval.py
│       │       ├── task_eval_openjudge.py
│       │       ├── task_hook.py
│       │       ├── task_long_term_memory.py
│       │       ├── task_mcp.py
│       │       ├── task_memory.py
│       │       ├── task_middleware.py
│       │       ├── task_model.py
│       │       ├── task_pipeline.py
│       │       ├── task_plan.py
│       │       ├── task_prompt.py
│       │       ├── task_rag.py
│       │       ├── task_realtime.py
│       │       ├── task_state.py
│       │       ├── task_studio.py
│       │       ├── task_token.py
│       │       ├── task_tool.py
│       │       ├── task_tracing.py
│       │       ├── task_tts.py
│       │       ├── task_tuner.py
│       │       ├── workflow_concurrent_agents.py
│       │       ├── workflow_conversation.py
│       │       ├── workflow_handoffs.py
│       │       ├── workflow_multiagent_debate.py
│       │       └── workflow_routing.py
│       └── zh_CN/
│           ├── Makefile
│           ├── build.sh
│           ├── conf.py
│           ├── index.rst
│           ├── make.bat
│           └── src/
│               ├── README.md
│               ├── faq.py
│               ├── quickstart_agent.py
│               ├── quickstart_installation.py
│               ├── quickstart_key_concept.py
│               ├── quickstart_message.py
│               ├── task_a2a.py
│               ├── task_agent.py
│               ├── task_agent_skill.py
│               ├── task_embedding.py
│               ├── task_eval.py
│               ├── task_eval_openjudge.py
│               ├── task_hook.py
│               ├── task_long_term_memory.py
│               ├── task_mcp.py
│               ├── task_memory.py
│               ├── task_middleware.py
│               ├── task_model.py
│               ├── task_pipeline.py
│               ├── task_plan.py
│               ├── task_prompt.py
│               ├── task_rag.py
│               ├── task_realtime.py
│               ├── task_state.py
│               ├── task_studio.py
│               ├── task_token.py
│               ├── task_tool.py
│               ├── task_tracing.py
│               ├── task_tts.py
│               ├── task_tuner.py
│               ├── workflow_concurrent_agents.py
│               ├── workflow_conversation.py
│               ├── workflow_handoffs.py
│               ├── workflow_multiagent_debate.py
│               └── workflow_routing.py
├── examples/
│   ├── agent/
│   │   ├── a2a_agent/
│   │   │   ├── README.md
│   │   │   ├── agent_card.py
│   │   │   ├── main.py
│   │   │   └── setup_a2a_server.py
│   │   ├── a2ui_agent/
│   │   │   ├── README.md
│   │   │   └── samples/
│   │   │       ├── client/
│   │   │       │   ├── a2a_client.py
│   │   │       │   └── lit/
│   │   │       │       ├── contact/
│   │   │       │       │   ├── README.md
│   │   │       │       │   ├── client.ts
│   │   │       │       │   ├── contact.ts
│   │   │       │       │   ├── events/
│   │   │       │       │   │   └── events.ts
│   │   │       │       │   ├── index.html
│   │   │       │       │   ├── middleware/
│   │   │       │       │   │   ├── a2a.ts
│   │   │       │       │   │   └── index.ts
│   │   │       │       │   ├── package.json
│   │   │       │       │   ├── theme/
│   │   │       │       │   │   └── theme.ts
│   │   │       │       │   ├── tsconfig.json
│   │   │       │       │   ├── types/
│   │   │       │       │   │   └── types.ts
│   │   │       │       │   ├── ui/
│   │   │       │       │   │   ├── custom-components/
│   │   │       │       │   │   │   ├── README.md
│   │   │       │       │   │   │   ├── org-chart.ts
│   │   │       │       │   │   │   ├── premium-text-field.ts
│   │   │       │       │   │   │   ├── register-components.ts
│   │   │       │       │   │   │   └── test/
│   │   │       │       │   │   │       ├── README.md
│   │   │       │       │   │   │       ├── org-chart-test.html
│   │   │       │       │   │   │       ├── override-test.html
│   │   │       │       │   │   │       └── override-test.ts
│   │   │       │       │   │   ├── snackbar.ts
│   │   │       │       │   │   └── ui.ts
│   │   │       │       │   └── vite.config.ts
│   │   │       │       ├── package.json
│   │   │       │       └── shell/
│   │   │       │           ├── README.md
│   │   │       │           ├── THEMING.md
│   │   │       │           ├── app.ts
│   │   │       │           ├── client.ts
│   │   │       │           ├── configs/
│   │   │       │           │   ├── contacts.ts
│   │   │       │           │   ├── restaurant.ts
│   │   │       │           │   └── types.ts
│   │   │       │           ├── events/
│   │   │       │           │   └── events.ts
│   │   │       │           ├── index.html
│   │   │       │           ├── middleware/
│   │   │       │           │   ├── a2a.ts
│   │   │       │           │   └── index.ts
│   │   │       │           ├── package.json
│   │   │       │           ├── theme/
│   │   │       │           │   ├── clone-default-theme.ts
│   │   │       │           │   └── default-theme.ts
│   │   │       │           ├── tsconfig.json
│   │   │       │           ├── types/
│   │   │       │           │   └── types.ts
│   │   │       │           ├── ui/
│   │   │       │           │   ├── snackbar.ts
│   │   │       │           │   └── ui.ts
│   │   │       │           └── vite.config.ts
│   │   │       └── general_agent/
│   │   │           ├── __main__.py
│   │   │           ├── a2ui_utils.py
│   │   │           ├── agent_card.py
│   │   │           ├── prompt_builder.py
│   │   │           ├── pyproject.toml
│   │   │           ├── setup_a2ui_server.py
│   │   │           └── skills/
│   │   │               └── A2UI_response_generator/
│   │   │                   ├── SKILL.md
│   │   │                   ├── UI_templete_examples/
│   │   │                   │   ├── __init__.py
│   │   │                   │   ├── booking_form.py
│   │   │                   │   ├── contact_form.py
│   │   │                   │   ├── email_compose_form.py
│   │   │                   │   ├── error_message.py
│   │   │                   │   ├── info_message.py
│   │   │                   │   ├── item_detail_card_with_image.py
│   │   │                   │   ├── profile_view.py
│   │   │                   │   ├── search_filter_form.py
│   │   │                   │   ├── selection_card.py
│   │   │                   │   ├── simple_column_list_without_image.py
│   │   │                   │   ├── single_column_list.py
│   │   │                   │   ├── success_confirmation_with_image.py
│   │   │                   │   └── two_column_list.py
│   │   │                   ├── __init__.py
│   │   │                   ├── schema/
│   │   │                   │   ├── __init__.py
│   │   │                   │   └── base_schema.py
│   │   │                   ├── view_a2ui_examples.py
│   │   │                   └── view_a2ui_schema.py
│   │   ├── browser_agent/
│   │   │   ├── README.md
│   │   │   ├── browser_agent.py
│   │   │   ├── build_in_helper/
│   │   │   │   ├── _file_download.py
│   │   │   │   ├── _form_filling.py
│   │   │   │   ├── _image_understanding.py
│   │   │   │   └── _video_understanding.py
│   │   │   ├── build_in_prompt/
│   │   │   │   ├── browser_agent_decompose_reflection_prompt.md
│   │   │   │   ├── browser_agent_file_download_sys_prompt.md
│   │   │   │   ├── browser_agent_form_filling_sys_prompt.md
│   │   │   │   ├── browser_agent_observe_reasoning_prompt.md
│   │   │   │   ├── browser_agent_pure_reasoning_prompt.md
│   │   │   │   ├── browser_agent_subtask_revise_prompt.md
│   │   │   │   ├── browser_agent_summarize_task.md
│   │   │   │   ├── browser_agent_sys_prompt.md
│   │   │   │   └── browser_agent_task_decomposition_prompt.md
│   │   │   └── main.py
│   │   ├── deep_research_agent/
│   │   │   ├── README.md
│   │   │   ├── built_in_prompt/
│   │   │   │   ├── prompt_decompose_subtask.md
│   │   │   │   ├── prompt_deeper_expansion.md
│   │   │   │   ├── prompt_deepresearch_summary_report.md
│   │   │   │   ├── prompt_inprocess_report.md
│   │   │   │   ├── prompt_reflect_failure.md
│   │   │   │   ├── prompt_tool_usage_rules.md
│   │   │   │   ├── prompt_worker_additional_sys_prompt.md
│   │   │   │   └── promptmodule.py
│   │   │   ├── deep_research_agent.py
│   │   │   ├── main.py
│   │   │   └── utils.py
│   │   ├── meta_planner_agent/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── tool.py
│   │   ├── react_agent/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   ├── realtime_voice_agent/
│   │   │   ├── README.md
│   │   │   ├── chatbot.html
│   │   │   └── run_server.py
│   │   └── voice_agent/
│   │       ├── README.md
│   │       └── main.py
│   ├── deployment/
│   │   ├── README.md
│   │   └── planning_agent/
│   │       ├── README.md
│   │       ├── main.py
│   │       ├── test_post.py
│   │       └── tool.py
│   ├── evaluation/
│   │   └── ace_bench/
│   │       ├── README.md
│   │       └── main.py
│   ├── functionality/
│   │   ├── agent_skill/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── skill/
│   │   │       └── analyzing-agentscope-library/
│   │   │           ├── SKILL.md
│   │   │           └── view_agentscope_module.py
│   │   ├── long_term_memory/
│   │   │   ├── mem0/
│   │   │   │   ├── README.md
│   │   │   │   └── memory_example.py
│   │   │   └── reme/
│   │   │       ├── README.md
│   │   │       ├── personal_memory_example.py
│   │   │       ├── task_memory_example.py
│   │   │       └── tool_memory_example.py
│   │   ├── mcp/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   ├── mcp_add.py
│   │   │   └── mcp_multiply.py
│   │   ├── plan/
│   │   │   ├── README.md
│   │   │   ├── main_agent_managed_plan.py
│   │   │   └── main_manual_plan.py
│   │   ├── rag/
│   │   │   ├── README.md
│   │   │   ├── agentic_usage.py
│   │   │   ├── basic_usage.py
│   │   │   ├── multimodal_rag.py
│   │   │   └── react_agent_integration.py
│   │   ├── session_with_sqlite/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── sqlite_session.py
│   │   ├── short_term_memory/
│   │   │   ├── memory_compression/
│   │   │   │   ├── README.md
│   │   │   │   └── main.py
│   │   │   └── reme/
│   │   │       ├── README.md
│   │   │       ├── reme_short_term_memory.py
│   │   │       └── short_term_memory_example.py
│   │   ├── stream_printing_messages/
│   │   │   ├── README.md
│   │   │   ├── multi_agent.py
│   │   │   └── single_agent.py
│   │   ├── structured_output/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   ├── tts/
│   │   │   ├── README.md
│   │   │   └── main.py
│   │   └── vector_store/
│   │       ├── alibabacloud_mysql_vector/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       ├── milvus_lite/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       ├── mongodb/
│   │       │   ├── README.md
│   │       │   └── main.py
│   │       └── oceanbase/
│   │           ├── README.md
│   │           └── main.py
│   ├── game/
│   │   └── werewolves/
│   │       ├── README.md
│   │       ├── game.py
│   │       ├── main.py
│   │       ├── prompt.py
│   │       ├── structured_model.py
│   │       └── utils.py
│   ├── integration/
│   │   ├── alibabacloud_api_mcp/
│   │   │   ├── README.md
│   │   │   ├── main.py
│   │   │   └── oauth_handler.py
│   │   └── qwen_deep_research_model/
│   │       ├── README.md
│   │       ├── main.py
│   │       └── qwen_deep_research_agent.py
│   ├── tuner/
│   │   └── react_agent/
│   │       ├── README.md
│   │       ├── config.yaml
│   │       └── main.py
│   └── workflows/
│       ├── multiagent_concurrent/
│       │   ├── README.md
│       │   └── main.py
│       ├── multiagent_conversation/
│       │   ├── README.md
│       │   └── main.py
│       ├── multiagent_debate/
│       │   ├── README.md
│       │   └── main.py
│       └── multiagent_realtime/
│           ├── README.md
│           ├── multi_agent.html
│           └── run_server.py
├── pyproject.toml
├── src/
│   └── agentscope/
│       ├── __init__.py
│       ├── _logging.py
│       ├── _run_config.py
│       ├── _utils/
│       │   ├── __init__.py
│       │   ├── _common.py
│       │   └── _mixin.py
│       ├── _version.py
│       ├── a2a/
│       │   ├── __init__.py
│       │   ├── _base.py
│       │   ├── _file_resolver.py
│       │   ├── _nacos_resolver.py
│       │   └── _well_known_resolver.py
│       ├── agent/
│       │   ├── __init__.py
│       │   ├── _a2a_agent.py
│       │   ├── _agent_base.py
│       │   ├── _agent_meta.py
│       │   ├── _react_agent.py
│       │   ├── _react_agent_base.py
│       │   ├── _realtime_agent.py
│       │   ├── _user_agent.py
│       │   ├── _user_input.py
│       │   └── _utils.py
│       ├── embedding/
│       │   ├── __init__.py
│       │   ├── _cache_base.py
│       │   ├── _dashscope_embedding.py
│       │   ├── _dashscope_multimodal_embedding.py
│       │   ├── _embedding_base.py
│       │   ├── _embedding_response.py
│       │   ├── _embedding_usage.py
│       │   ├── _file_cache.py
│       │   ├── _gemini_embedding.py
│       │   ├── _ollama_embedding.py
│       │   └── _openai_embedding.py
│       ├── evaluate/
│       │   ├── __init__.py
│       │   ├── _ace_benchmark/
│       │   │   ├── __init__.py
│       │   │   ├── _ace_benchmark.py
│       │   │   ├── _ace_metric.py
│       │   │   ├── _ace_tools_api/
│       │   │   │   ├── __init__.py
│       │   │   │   ├── _food_platform_api.py
│       │   │   │   ├── _message_api.py
│       │   │   │   ├── _reminder_api.py
│       │   │   │   ├── _shared_state.py
│       │   │   │   └── _travel_api.py
│       │   │   └── _ace_tools_zh.py
│       │   ├── _benchmark_base.py
│       │   ├── _evaluator/
│       │   │   ├── __init__.py
│       │   │   ├── _evaluator_base.py
│       │   │   ├── _general_evaluator.py
│       │   │   ├── _in_memory_exporter.py
│       │   │   └── _ray_evaluator.py
│       │   ├── _evaluator_storage/
│       │   │   ├── __init__.py
│       │   │   ├── _evaluator_storage_base.py
│       │   │   └── _file_evaluator_storage.py
│       │   ├── _metric_base.py
│       │   ├── _solution.py
│       │   └── _task.py
│       ├── exception/
│       │   ├── __init__.py
│       │   ├── _exception_base.py
│       │   └── _tool.py
│       ├── formatter/
│       │   ├── __init__.py
│       │   ├── _a2a_formatter.py
│       │   ├── _anthropic_formatter.py
│       │   ├── _dashscope_formatter.py
│       │   ├── _deepseek_formatter.py
│       │   ├── _formatter_base.py
│       │   ├── _gemini_formatter.py
│       │   ├── _ollama_formatter.py
│       │   ├── _openai_formatter.py
│       │   └── _truncated_formatter_base.py
│       ├── hooks/
│       │   ├── __init__.py
│       │   └── _studio_hooks.py
│       ├── mcp/
│       │   ├── __init__.py
│       │   ├── _client_base.py
│       │   ├── _http_stateful_client.py
│       │   ├── _http_stateless_client.py
│       │   ├── _mcp_function.py
│       │   ├── _stateful_client_base.py
│       │   └── _stdio_stateful_client.py
│       ├── memory/
│       │   ├── __init__.py
│       │   ├── _long_term_memory/
│       │   │   ├── __init__.py
│       │   │   ├── _long_term_memory_base.py
│       │   │   ├── _mem0/
│       │   │   │   ├── __init__.py
│       │   │   │   ├── _mem0_long_term_memory.py
│       │   │   │   └── _mem0_utils.py
│       │   │   └── _reme/
│       │   │       ├── __init__.py
│       │   │       ├── _reme_long_term_memory_base.py
│       │   │       ├── _reme_personal_long_term_memory.py
│       │   │       ├── _reme_task_long_term_memory.py
│       │   │       └── _reme_tool_long_term_memory.py
│       │   └── _working_memory/
│       │       ├── __init__.py
│       │       ├── _base.py
│       │       ├── _in_memory_memory.py
│       │       ├── _redis_memory.py
│       │       └── _sqlalchemy_memory.py
│       ├── message/
│       │   ├── __init__.py
│       │   ├── _message_base.py
│       │   └── _message_block.py
│       ├── model/
│       │   ├── __init__.py
│       │   ├── _anthropic_model.py
│       │   ├── _dashscope_model.py
│       │   ├── _gemini_model.py
│       │   ├── _model_base.py
│       │   ├── _model_response.py
│       │   ├── _model_usage.py
│       │   ├── _ollama_model.py
│       │   ├── _openai_model.py
│       │   └── _trinity_model.py
│       ├── module/
│       │   ├── __init__.py
│       │   └── _state_module.py
│       ├── pipeline/
│       │   ├── __init__.py
│       │   ├── _chat_room.py
│       │   ├── _class.py
│       │   ├── _functional.py
│       │   └── _msghub.py
│       ├── plan/
│       │   ├── __init__.py
│       │   ├── _in_memory_storage.py
│       │   ├── _plan_model.py
│       │   ├── _plan_notebook.py
│       │   └── _storage_base.py
│       ├── py.typed
│       ├── rag/
│       │   ├── __init__.py
│       │   ├── _document.py
│       │   ├── _knowledge_base.py
│       │   ├── _reader/
│       │   │   ├── __init__.py
│       │   │   ├── _excel_reader.py
│       │   │   ├── _image_reader.py
│       │   │   ├── _pdf_reader.py
│       │   │   ├── _ppt_reader.py
│       │   │   ├── _reader_base.py
│       │   │   ├── _text_reader.py
│       │   │   ├── _utils.py
│       │   │   └── _word_reader.py
│       │   ├── _simple_knowledge.py
│       │   └── _store/
│       │       ├── __init__.py
│       │       ├── _alibabacloud_mysql_store.py
│       │       ├── _milvuslite_store.py
│       │       ├── _mongodb_store.py
│       │       ├── _oceanbase_store.py
│       │       ├── _qdrant_store.py
│       │       └── _store_base.py
│       ├── realtime/
│       │   ├── __init__.py
│       │   ├── _base.py
│       │   ├── _dashscope_realtime_model.py
│       │   ├── _events/
│       │   │   ├── __init__.py
│       │   │   ├── _client_event.py
│       │   │   ├── _model_event.py
│       │   │   ├── _server_event.py
│       │   │   └── _utils.py
│       │   ├── _gemini_realtime_model.py
│       │   └── _openai_realtime_model.py
│       ├── session/
│       │   ├── __init__.py
│       │   ├── _json_session.py
│       │   ├── _redis_session.py
│       │   └── _session_base.py
│       ├── token/
│       │   ├── __init__.py
│       │   ├── _anthropic_token_counter.py
│       │   ├── _char_token_counter.py
│       │   ├── _gemini_token_counter.py
│       │   ├── _huggingface_token_counter.py
│       │   ├── _openai_token_counter.py
│       │   └── _token_base.py
│       ├── tool/
│       │   ├── __init__.py
│       │   ├── _async_wrapper.py
│       │   ├── _coding/
│       │   │   ├── __init__.py
│       │   │   ├── _python.py
│       │   │   └── _shell.py
│       │   ├── _multi_modality/
│       │   │   ├── __init__.py
│       │   │   ├── _dashscope_tools.py
│       │   │   └── _openai_tools.py
│       │   ├── _response.py
│       │   ├── _text_file/
│       │   │   ├── __init__.py
│       │   │   ├── _utils.py
│       │   │   ├── _view_text_file.py
│       │   │   └── _write_text_file.py
│       │   ├── _toolkit.py
│       │   └── _types.py
│       ├── tracing/
│       │   ├── __init__.py
│       │   ├── _attributes.py
│       │   ├── _converter.py
│       │   ├── _extractor.py
│       │   ├── _setup.py
│       │   ├── _trace.py
│       │   └── _utils.py
│       ├── tts/
│       │   ├── __init__.py
│       │   ├── _dashscope_cosyvoice_realtime_tts_model.py
│       │   ├── _dashscope_cosyvoice_tts_model.py
│       │   ├── _dashscope_realtime_tts_model.py
│       │   ├── _dashscope_tts_model.py
│       │   ├── _gemini_tts_model.py
│       │   ├── _openai_tts_model.py
│       │   ├── _tts_base.py
│       │   ├── _tts_response.py
│       │   └── _utils.py
│       ├── tune/
│       │   └── __init__.py
│       ├── tuner/
│       │   ├── __init__.py
│       │   ├── _algorithm.py
│       │   ├── _config.py
│       │   ├── _dataset.py
│       │   ├── _judge.py
│       │   ├── _model.py
│       │   ├── _tune.py
│       │   └── _workflow.py
│       └── types/
│           ├── __init__.py
│           ├── _hook.py
│           ├── _json.py
│           ├── _object.py
│           └── _tool.py
└── tests/
    ├── a2a_agent_test.py
    ├── a2a_resolver_test.py
    ├── config_test.py
    ├── embedding_cache_test.py
    ├── evaluation_test.py
    ├── formatter_a2a_test.py
    ├── formatter_anthropic_test.py
    ├── formatter_dashscope_test.py
    ├── formatter_deepseek_test.py
    ├── formatter_gemini_test.py
    ├── formatter_ollama_test.py
    ├── formatter_openai_test.py
    ├── hook_test.py
    ├── mcp_sse_client_test.py
    ├── mcp_streamable_http_client_test.py
    ├── mem0_utils_test.py
    ├── memory_compression_test.py
    ├── memory_reme_test.py
    ├── memory_test.py
    ├── model_anthropic_test.py
    ├── model_dashscope_test.py
    ├── model_gemini_test.py
    ├── model_ollama_test.py
    ├── model_openai_test.py
    ├── pipeline_test.py
    ├── plan_test.py
    ├── rag_knowledge_test.py
    ├── rag_reader_test.py
    ├── rag_store_test.py
    ├── react_agent_test.py
    ├── realtime_dashscope_test.py
    ├── realtime_event_test.py
    ├── realtime_gemini_test.py
    ├── realtime_openai_test.py
    ├── session_test.py
    ├── test.docx
    ├── test.pptx
    ├── test.xlsx
    ├── token_anthropic_test.py
    ├── token_char_test.py
    ├── token_openai_test.py
    ├── tool_dashscope_test.py
    ├── tool_openai_test.py
    ├── tool_test.py
    ├── toolkit_basic_test.py
    ├── toolkit_meta_tool_test.py
    ├── toolkit_middleware_test.py
    ├── tracing_converter_test.py
    ├── tracing_extractor_test.py
    ├── tracing_test.py
    ├── tracing_utils_test.py
    ├── tts_dashscope_cosyvoice_test.py
    ├── tts_dashscope_test.py
    ├── tts_gemini_test.py
    ├── tts_openai_test.py
    ├── tuner_test.py
    └── user_input_test.py
Download .txt
Showing preview only (211K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2374 symbols across 361 files)

FILE: .github/scripts/update_news.py
  function read_news_items (line 12) | def read_news_items(news_file: Path, max_items: int = 10) -> list[str]:
  function update_readme (line 42) | def update_readme(
  function main (line 96) | def main() -> None:

FILE: docs/tutorial/_static/language_switch.js
  function switchV1Language (line 1) | function switchV1Language() {
  function navigateToV0 (line 10) | function navigateToV0(version) {

FILE: docs/tutorial/en/conf.py
  function skip_member (line 127) | def skip_member(app, what, name, obj, skip, options):
  function setup (line 139) | def setup(app):

FILE: docs/tutorial/en/src/quickstart_agent.py
  function creating_react_agent (line 102) | async def creating_react_agent() -> None:
  class MyAgent (line 164) | class MyAgent(AgentBase):
    method __init__ (line 167) | def __init__(self) -> None:
    method reply (line 181) | async def reply(self, msg: Msg | list[Msg] | None) -> Msg:
    method observe (line 209) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 214) | async def handle_interrupt(self) -> Msg:
  function run_custom_agent (line 224) | async def run_custom_agent() -> None:

FILE: docs/tutorial/en/src/task_a2a.py
  function agent_card_from_well_known_website (line 87) | async def agent_card_from_well_known_website() -> AgentCard:
  function agent_card_from_file (line 122) | async def agent_card_from_file() -> AgentCard:
  function agent_card_from_nacos (line 144) | async def agent_card_from_nacos() -> AgentCard:
  function a2a_in_chatbot (line 178) | async def a2a_in_chatbot() -> None:
  function create_worker (line 195) | async def create_worker(query: str) -> ToolResponse:

FILE: docs/tutorial/en/src/task_agent.py
  function example_tool_function (line 250) | async def example_tool_function(tag: str) -> ToolResponse:
  function example_parallel_tool_calls (line 290) | async def example_parallel_tool_calls() -> None:
  class Model (line 335) | class Model(BaseModel):
  function example_structured_output (line 344) | async def example_structured_output() -> None:

FILE: docs/tutorial/en/src/task_embedding.py
  function example_dashscope_embedding (line 42) | async def example_dashscope_embedding() -> None:
  function example_embedding_cache (line 83) | async def example_embedding_cache() -> None:

FILE: docs/tutorial/en/src/task_eval.py
  class CheckEqual (line 91) | class CheckEqual(MetricBase):
    method __init__ (line 92) | def __init__(
    method __call__ (line 104) | async def __call__(
  class ToyBenchmark (line 133) | class ToyBenchmark(BenchmarkBase):
    method __init__ (line 134) | def __init__(self):
    method _load_data (line 142) | def _load_data() -> list[Task]:
    method __iter__ (line 159) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 164) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 168) | def __len__(self) -> int:
  class ToyBenchAnswerFormat (line 203) | class ToyBenchAnswerFormat(BaseModel):
  function toy_solution_generation (line 207) | async def toy_solution_generation(
  function main (line 240) | async def main() -> None:

FILE: docs/tutorial/en/src/task_eval_openjudge.py
  class OpenJudgeMetric (line 92) | class OpenJudgeMetric(MetricBase):
    method __init__ (line 97) | def __init__(
    method __call__ (line 118) | async def __call__(self, solution: SolutionOutput) -> MetricResult:
  class QABenchmark (line 206) | class QABenchmark(BenchmarkBase):
    method __init__ (line 209) | def __init__(self):
    method _load_data (line 216) | def _load_data(self):
    method __iter__ (line 265) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 269) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 273) | def __len__(self) -> int:
  function qa_agent (line 297) | async def qa_agent(task: Task, pre_hook: Callable) -> SolutionOutput:
  function main (line 328) | async def main() -> None:

FILE: docs/tutorial/en/src/task_hook.py
  function pre_hook_template (line 104) | def pre_hook_template(
  function post_hook_template (line 142) | def post_hook_template(
  class TestAgent (line 217) | class TestAgent(AgentBase):
    method reply (line 220) | async def reply(self, msg: Msg) -> Msg:
  function instance_pre_reply_hook (line 231) | def instance_pre_reply_hook(
  function cls_pre_reply_hook (line 245) | def cls_pre_reply_hook(
  function example_test_hook (line 275) | async def example_test_hook() -> None:

FILE: docs/tutorial/en/src/task_long_term_memory.py
  function basic_usage (line 66) | async def basic_usage():
  function record_preferences (line 114) | async def record_preferences():
  function retrieve_preferences (line 132) | async def retrieve_preferences():

FILE: docs/tutorial/en/src/task_mcp.py
  function example_register_stateless_mcp (line 102) | async def example_register_stateless_mcp() -> None:
  function example_remove_mcp_tools (line 137) | async def example_remove_mcp_tools() -> None:
  function example_function_level_usage (line 172) | async def example_function_level_usage() -> None:

FILE: docs/tutorial/en/src/task_memory.py
  function in_memory_example (line 104) | async def in_memory_example():
  function sqlalchemy_example (line 157) | async def sqlalchemy_example() -> None:
  function sqlalchemy_context_example (line 202) | async def sqlalchemy_context_example() -> None:
  function redis_memory_example (line 304) | async def redis_memory_example() -> None:

FILE: docs/tutorial/en/src/task_middleware.py
  function logging_middleware (line 81) | async def logging_middleware(
  function search_tool (line 108) | async def search_tool(query: str) -> ToolResponse:
  function example_logging_middleware (line 129) | async def example_logging_middleware() -> None:
  function transform_middleware (line 165) | async def transform_middleware(
  function example_transform_middleware (line 184) | async def example_transform_middleware() -> None:
  function authorization_middleware (line 216) | async def authorization_middleware(
  function unauthorized_tool (line 246) | async def unauthorized_tool(data: str) -> ToolResponse:
  function example_authorization_middleware (line 262) | async def example_authorization_middleware() -> None:
  function middleware_1 (line 316) | async def middleware_1(
  function middleware_2 (line 335) | async def middleware_2(
  function example_multiple_middleware (line 354) | async def example_multiple_middleware() -> None:

FILE: docs/tutorial/en/src/task_model.py
  function example_model_call (line 109) | async def example_model_call() -> None:
  function example_streaming (line 142) | async def example_streaming() -> None:
  function example_reasoning (line 177) | async def example_reasoning() -> None:

FILE: docs/tutorial/en/src/task_pipeline.py
  function create_agent (line 42) | def create_agent(name: str, age: int, career: str) -> ReActAgent:
  function example_broadcast_message (line 67) | async def example_broadcast_message():
  function check_broadcast_message (line 92) | async def check_broadcast_message():
  function run_example_pipeline (line 233) | async def run_example_pipeline() -> None:

FILE: docs/tutorial/en/src/task_plan.py
  function list_tools (line 133) | async def list_tools() -> None:
  function manual_plan_specification (line 162) | async def manual_plan_specification() -> None:
  function plan_change_hook_template (line 284) | def plan_change_hook_template(self: PlanNotebook, plan: Plan) -> None:

FILE: docs/tutorial/en/src/task_prompt.py
  function run_formatter_example (line 229) | async def run_formatter_example() -> list[dict]:
  function run_token_counter (line 258) | async def run_token_counter() -> int:
  function run_truncated_formatter (line 274) | async def run_truncated_formatter() -> None:

FILE: docs/tutorial/en/src/task_rag.py
  function example_text_reader (line 96) | async def example_text_reader(print_docs: bool) -> list[Document]:
  function build_knowledge_base (line 148) | async def build_knowledge_base() -> SimpleKnowledge:
  function example_agentic_manner (line 239) | async def example_agentic_manner() -> None:
  function example_generic_manner (line 306) | async def example_generic_manner() -> None:
  function example_multimodal_rag (line 372) | async def example_multimodal_rag() -> None:

FILE: docs/tutorial/en/src/task_realtime.py
  function example_realtime_agent (line 258) | async def example_realtime_agent() -> None:
  function example_chat_room (line 433) | async def example_chat_room() -> None:

FILE: docs/tutorial/en/src/task_state.py
  class ClassA (line 63) | class ClassA(StateModule):
    method __init__ (line 64) | def __init__(self) -> None:
  class ClassB (line 71) | class ClassB(StateModule):
    method __init__ (line 72) | def __init__(self) -> None:
  function example_agent_state (line 120) | async def example_agent_state() -> None:
  function example_session (line 173) | async def example_session() -> None:
  function example_load_session (line 193) | async def example_load_session() -> None:

FILE: docs/tutorial/en/src/task_token.py
  function example_token_counting (line 49) | async def example_token_counting():

FILE: docs/tutorial/en/src/task_tool.py
  function tool_function (line 44) | def tool_function(a: int, b: str) -> ToolResponse:
  function my_search (line 78) | async def my_search(query: str, api_key: str) -> ToolResponse:
  function example_tool_execution (line 126) | async def example_tool_execution() -> None:
  function tool_function (line 161) | def tool_function(**kwargs: Any) -> ToolResponse:
  class ThinkingModel (line 174) | class ThinkingModel(BaseModel):
  function non_streaming_function (line 205) | async def non_streaming_function() -> ToolResponse:
  function example_tool_interruption (line 223) | async def example_tool_interruption() -> None:
  function streaming_function (line 253) | async def streaming_function() -> AsyncGenerator[ToolResponse, None]:
  function example_streaming_tool_interruption (line 280) | async def example_streaming_tool_interruption() -> None:
  function navigate (line 326) | def navigate(url: str) -> ToolResponse:
  function click_element (line 336) | def click_element(element_id: str) -> ToolResponse:
  function mock_agent_reset_tools (line 408) | async def mock_agent_reset_tools() -> None:

FILE: docs/tutorial/en/src/task_tts.py
  function example_non_realtime_tts (line 91) | async def example_non_realtime_tts() -> None:
  function example_non_realtime_tts_streaming (line 127) | async def example_non_realtime_tts_streaming() -> None:
  function example_agent_with_tts (line 208) | async def example_agent_with_tts() -> None:

FILE: docs/tutorial/en/src/task_tuner.py
  function example_workflow_function (line 86) | async def example_workflow_function(
  function example_judge_function (line 154) | async def example_judge_function(

FILE: docs/tutorial/en/src/workflow_concurrent_agents.py
  class ExampleAgent (line 16) | class ExampleAgent(AgentBase):
    method __init__ (line 19) | def __init__(self, name: str) -> None:
    method reply (line 24) | async def reply(self, *args: Any, **kwargs: Any) -> None:
  function run_concurrent_agents (line 33) | async def run_concurrent_agents() -> None:

FILE: docs/tutorial/en/src/workflow_conversation.py
  function example_multi_agent_prompt (line 104) | async def example_multi_agent_prompt() -> None:
  function example_msghub (line 171) | async def example_msghub() -> None:
  function example_memory (line 193) | async def example_memory() -> None:

FILE: docs/tutorial/en/src/workflow_handoffs.py
  function create_worker (line 34) | async def create_worker(
  function run_handoffs (line 66) | async def run_handoffs() -> None:

FILE: docs/tutorial/en/src/workflow_multiagent_debate.py
  function create_solver_agent (line 39) | def create_solver_agent(name: str) -> ReActAgent:
  class JudgeModel (line 78) | class JudgeModel(BaseModel):
  function run_multiagent_debate (line 90) | async def run_multiagent_debate() -> None:

FILE: docs/tutorial/en/src/workflow_routing.py
  class RoutingChoice (line 47) | class RoutingChoice(BaseModel):
  function example_router_explicit (line 62) | async def example_router_explicit() -> None:
  function generate_python (line 92) | async def generate_python(demand: str) -> ToolResponse:
  function generate_poem (line 120) | async def generate_poem(demand: str) -> ToolResponse:
  function web_search (line 130) | async def web_search(query: str) -> ToolResponse:
  function example_router_implicit (line 164) | async def example_router_implicit() -> None:

FILE: docs/tutorial/zh_CN/conf.py
  function skip_member (line 127) | def skip_member(app, what, name, obj, skip, options):
  function setup (line 139) | def setup(app):

FILE: docs/tutorial/zh_CN/src/quickstart_agent.py
  function creating_react_agent (line 101) | async def creating_react_agent() -> None:
  class MyAgent (line 162) | class MyAgent(AgentBase):
    method __init__ (line 165) | def __init__(self) -> None:
    method reply (line 179) | async def reply(self, msg: Msg | list[Msg] | None) -> Msg:
    method observe (line 207) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 212) | async def handle_interrupt(self) -> Msg:
  function run_custom_agent (line 222) | async def run_custom_agent() -> None:

FILE: docs/tutorial/zh_CN/src/task_a2a.py
  function agent_card_from_well_known_website (line 88) | async def agent_card_from_well_known_website() -> AgentCard:
  function agent_card_from_file (line 123) | async def agent_card_from_file() -> AgentCard:
  function agent_card_from_nacos (line 145) | async def agent_card_from_nacos() -> AgentCard:
  function a2a_in_chatbot (line 179) | async def a2a_in_chatbot() -> None:
  function create_worker (line 196) | async def create_worker(query: str) -> ToolResponse:

FILE: docs/tutorial/zh_CN/src/task_agent.py
  function example_tool_function (line 236) | async def example_tool_function(tag: str) -> ToolResponse:
  function example_parallel_tool_calls (line 276) | async def example_parallel_tool_calls() -> None:
  class Model (line 313) | class Model(BaseModel):
  function example_structured_output (line 320) | async def example_structured_output() -> None:

FILE: docs/tutorial/zh_CN/src/task_embedding.py
  function example_dashscope_embedding (line 42) | async def example_dashscope_embedding() -> None:
  function example_embedding_cache (line 83) | async def example_embedding_cache() -> None:

FILE: docs/tutorial/zh_CN/src/task_eval.py
  class CheckEqual (line 90) | class CheckEqual(MetricBase):
    method __init__ (line 91) | def __init__(
    method __call__ (line 103) | async def __call__(
  class ToyBenchmark (line 132) | class ToyBenchmark(BenchmarkBase):
    method __init__ (line 133) | def __init__(self):
    method _load_data (line 141) | def _load_data() -> list[Task]:
    method __iter__ (line 158) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 163) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 167) | def __len__(self) -> int:
  class ToyBenchAnswerFormat (line 201) | class ToyBenchAnswerFormat(BaseModel):
  function toy_solution_generation (line 205) | async def toy_solution_generation(
  function main (line 238) | async def main() -> None:

FILE: docs/tutorial/zh_CN/src/task_eval_openjudge.py
  class OpenJudgeMetric (line 89) | class OpenJudgeMetric(MetricBase):
    method __init__ (line 90) | def __init__(
    method __call__ (line 127) | async def __call__(self, solution: SolutionOutput) -> MetricResult:
  class QABenchmark (line 213) | class QABenchmark(BenchmarkBase):
    method __init__ (line 214) | def __init__(self):
    method _load_data (line 221) | def _load_data(self):
    method __iter__ (line 270) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 273) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 276) | def __len__(self) -> int:
  function qa_agent (line 299) | async def qa_agent(task: Task, pre_hook: Callable) -> SolutionOutput:
  function main (line 326) | async def main() -> None:

FILE: docs/tutorial/zh_CN/src/task_hook.py
  function pre_hook_template (line 101) | def pre_hook_template(
  function post_hook_template (line 137) | def post_hook_template(
  class TestAgent (line 212) | class TestAgent(AgentBase):
    method reply (line 215) | async def reply(self, msg: Msg) -> Msg:
  function instance_pre_reply_hook (line 226) | def instance_pre_reply_hook(
  function cls_pre_reply_hook (line 240) | def cls_pre_reply_hook(
  function example_test_hook (line 270) | async def example_test_hook() -> None:

FILE: docs/tutorial/zh_CN/src/task_long_term_memory.py
  function basic_usage (line 62) | async def basic_usage():
  function record_preferences (line 106) | async def record_preferences():
  function retrieve_preferences (line 120) | async def retrieve_preferences():

FILE: docs/tutorial/zh_CN/src/task_mcp.py
  function example_register_stateless_mcp (line 104) | async def example_register_stateless_mcp() -> None:
  function example_remove_mcp_tools (line 136) | async def example_remove_mcp_tools() -> None:
  function example_function_level_usage (line 168) | async def example_function_level_usage() -> None:

FILE: docs/tutorial/zh_CN/src/task_memory.py
  function in_memory_example (line 94) | async def in_memory_example():
  function sqlalchemy_example (line 146) | async def sqlalchemy_example() -> None:
  function sqlalchemy_context_example (line 190) | async def sqlalchemy_context_example() -> None:
  function redis_memory_example (line 292) | async def redis_memory_example() -> None:

FILE: docs/tutorial/zh_CN/src/task_middleware.py
  function logging_middleware (line 81) | async def logging_middleware(
  function search_tool (line 108) | async def search_tool(query: str) -> ToolResponse:
  function example_logging_middleware (line 129) | async def example_logging_middleware() -> None:
  function transform_middleware (line 165) | async def transform_middleware(
  function example_transform_middleware (line 184) | async def example_transform_middleware() -> None:
  function authorization_middleware (line 216) | async def authorization_middleware(
  function unauthorized_tool (line 246) | async def unauthorized_tool(data: str) -> ToolResponse:
  function example_authorization_middleware (line 262) | async def example_authorization_middleware() -> None:
  function middleware_1 (line 316) | async def middleware_1(
  function middleware_2 (line 335) | async def middleware_2(
  function example_multiple_middleware (line 354) | async def example_multiple_middleware() -> None:

FILE: docs/tutorial/zh_CN/src/task_model.py
  function example_model_call (line 109) | async def example_model_call() -> None:
  function example_streaming (line 142) | async def example_streaming() -> None:
  function example_reasoning (line 177) | async def example_reasoning() -> None:

FILE: docs/tutorial/zh_CN/src/task_pipeline.py
  function create_agent (line 40) | def create_agent(name: str, age: int, career: str) -> ReActAgent:
  function example_broadcast_message (line 65) | async def example_broadcast_message():
  function check_broadcast_message (line 90) | async def check_broadcast_message():
  function run_example_pipeline (line 228) | async def run_example_pipeline() -> None:

FILE: docs/tutorial/zh_CN/src/task_plan.py
  function list_tools (line 125) | async def list_tools() -> None:
  function manual_plan_specification (line 154) | async def manual_plan_specification() -> None:
  function plan_change_hook_template (line 264) | def plan_change_hook_template(self: PlanNotebook, plan: Plan) -> None:

FILE: docs/tutorial/zh_CN/src/task_prompt.py
  function run_formatter_example (line 229) | async def run_formatter_example() -> list[dict]:
  function run_token_counter (line 258) | async def run_token_counter() -> int:
  function run_truncated_formatter (line 274) | async def run_truncated_formatter() -> None:

FILE: docs/tutorial/zh_CN/src/task_rag.py
  function example_text_reader (line 94) | async def example_text_reader(print_docs: bool) -> list[Document]:
  function build_knowledge_base (line 144) | async def build_knowledge_base() -> SimpleKnowledge:
  function example_agentic_manner (line 227) | async def example_agentic_manner() -> None:
  function example_generic_manner (line 292) | async def example_generic_manner() -> None:
  function example_multimodal_rag (line 350) | async def example_multimodal_rag() -> None:

FILE: docs/tutorial/zh_CN/src/task_realtime.py
  function example_realtime_agent (line 254) | async def example_realtime_agent() -> None:
  function example_chat_room (line 426) | async def example_chat_room() -> None:

FILE: docs/tutorial/zh_CN/src/task_state.py
  class ClassA (line 63) | class ClassA(StateModule):
    method __init__ (line 64) | def __init__(self) -> None:
  class ClassB (line 71) | class ClassB(StateModule):
    method __init__ (line 72) | def __init__(self) -> None:
  function example_agent_state (line 120) | async def example_agent_state() -> None:
  function example_session (line 169) | async def example_session() -> None:
  function example_load_session (line 192) | async def example_load_session() -> None:

FILE: docs/tutorial/zh_CN/src/task_token.py
  function example_token_counting (line 55) | async def example_token_counting():

FILE: docs/tutorial/zh_CN/src/task_tool.py
  function tool_function (line 44) | def tool_function(a: int, b: str) -> ToolResponse:
  function my_search (line 78) | async def my_search(query: str, api_key: str) -> ToolResponse:
  function example_tool_execution (line 130) | async def example_tool_execution() -> None:
  function tool_function (line 165) | def tool_function(**kwargs: Any) -> ToolResponse:
  class ThinkingModel (line 178) | class ThinkingModel(BaseModel):
  function non_streaming_function (line 209) | async def non_streaming_function() -> ToolResponse:
  function example_tool_interruption (line 227) | async def example_tool_interruption() -> None:
  function streaming_function (line 257) | async def streaming_function() -> AsyncGenerator[ToolResponse, None]:
  function example_streaming_tool_interruption (line 284) | async def example_streaming_tool_interruption() -> None:
  function navigate (line 331) | def navigate(url: str) -> ToolResponse:
  function click_element (line 341) | def click_element(element_id: str) -> ToolResponse:
  function mock_agent_reset_tools (line 413) | async def mock_agent_reset_tools() -> None:

FILE: docs/tutorial/zh_CN/src/task_tts.py
  function example_non_realtime_tts (line 88) | async def example_non_realtime_tts() -> None:
  function example_non_realtime_tts_streaming (line 120) | async def example_non_realtime_tts_streaming() -> None:
  function example_agent_with_tts (line 196) | async def example_agent_with_tts() -> None:

FILE: docs/tutorial/zh_CN/src/task_tuner.py
  function example_workflow_function (line 86) | async def example_workflow_function(
  function example_judge_function (line 153) | async def example_judge_function(

FILE: docs/tutorial/zh_CN/src/workflow_concurrent_agents.py
  class ExampleAgent (line 17) | class ExampleAgent(AgentBase):
    method __init__ (line 20) | def __init__(self, name: str) -> None:
    method reply (line 25) | async def reply(self, *args: Any, **kwargs: Any) -> None:
  function run_concurrent_agents (line 34) | async def run_concurrent_agents() -> None:

FILE: docs/tutorial/zh_CN/src/workflow_conversation.py
  function example_multi_agent_prompt (line 99) | async def example_multi_agent_prompt() -> None:
  function example_msghub (line 162) | async def example_msghub() -> None:
  function example_memory (line 185) | async def example_memory() -> None:

FILE: docs/tutorial/zh_CN/src/workflow_handoffs.py
  function create_worker (line 36) | async def create_worker(
  function run_handoffs (line 68) | async def run_handoffs() -> None:

FILE: docs/tutorial/zh_CN/src/workflow_multiagent_debate.py
  function create_solver_agent (line 32) | def create_solver_agent(name: str) -> ReActAgent:
  class JudgeModel (line 69) | class JudgeModel(BaseModel):
  function run_multiagent_debate (line 79) | async def run_multiagent_debate() -> None:

FILE: docs/tutorial/zh_CN/src/workflow_routing.py
  class RoutingChoice (line 47) | class RoutingChoice(BaseModel):
  function example_router_explicit (line 62) | async def example_router_explicit() -> None:
  function generate_python (line 92) | async def generate_python(demand: str) -> ToolResponse:
  function generate_poem (line 120) | async def generate_poem(demand: str) -> ToolResponse:
  function web_search (line 130) | async def web_search(query: str) -> ToolResponse:
  function example_router_implicit (line 164) | async def example_router_implicit() -> None:

FILE: examples/agent/a2a_agent/main.py
  function main (line 10) | async def main() -> None:

FILE: examples/agent/a2a_agent/setup_a2a_server.py
  class SimpleStreamHandler (line 31) | class SimpleStreamHandler:
    method on_message_send_stream (line 35) | async def on_message_send_stream(

FILE: examples/agent/a2ui_agent/samples/client/a2a_client.py
  function main (line 22) | async def main() -> None:

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/client.ts
  type A2TextPayload (line 19) | type A2TextPayload = {
  type A2DataPayload (line 24) | type A2DataPayload = {
  type A2AServerPayload (line 29) | type A2AServerPayload =
  class A2UIClient (line 33) | class A2UIClient {
    method ready (line 35) | get ready() {
    method send (line 39) | async send(

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/contact.ts
  class A2UIContactFinder (line 49) | class A2UIContactFinder extends SignalWatcher(LitElement) {
    method render (line 182) | render() {
    method #maybeRenderError (line 190) | #maybeRenderError() {
    method #maybeRenderForm (line 196) | #maybeRenderForm() {
    method #maybeRenderData (line 234) | #maybeRenderData() {
    method #sendAndProcessMessage (line 308) | async #sendAndProcessMessage(request) {
    method #sendMessage (line 316) | async #sendMessage(
    method snackbar (line 335) | snackbar(
    method unsnackbar (line 369) | unsnackbar(id?: SnackbarUUID) {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/events/events.ts
  class SnackbarActionEvent (line 25) | class SnackbarActionEvent extends Event {
    method constructor (line 28) | constructor(

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/middleware/a2a.ts
  constant A2AUI_MIME_TYPE (line 28) | const A2AUI_MIME_TYPE = "application/json+a2aui";
  method configureServer (line 66) | configureServer(server: ViteDevServer) {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/types/types.ts
  type SnackType (line 19) | enum SnackType {
  type SnackbarUUID (line 27) | type SnackbarUUID = ReturnType<typeof globalThis.crypto.randomUUID>;
  type SnackbarAction (line 29) | type SnackbarAction = {
  type SnackbarMessage (line 36) | type SnackbarMessage = {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/org-chart.ts
  type Action (line 25) | type Action = v0_8.Types.Action;
  type OrgChartNode (line 27) | interface OrgChartNode {
  class OrgChart (line 33) | class OrgChart extends Root {
    method render (line 105) | render() {
    method handleNodeClick (line 130) | private handleNodeClick(node: OrgChartNode) {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/premium-text-field.ts
  class PremiumTextField (line 21) | class PremiumTextField extends Root {
    method render (line 88) | render() {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/register-components.ts
  function registerContactComponents (line 21) | function registerContactComponents() {

FILE: examples/agent/a2ui_agent/samples/client/lit/contact/ui/snackbar.ts
  constant DEFAULT_TIMEOUT (line 24) | const DEFAULT_TIMEOUT = 8000;
  class Snackbar (line 27) | class Snackbar extends LitElement {
    method show (line 170) | show(message: SnackbarMessage, replaceAll = false) {
    method hide (line 198) | hide(id?: SnackbarUUID) {
    method render (line 218) | render() {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/app.ts
  class A2UILayoutEditor (line 56) | class A2UILayoutEditor extends SignalWatcher(LitElement) {
    method #maybeRenderError (line 277) | #maybeRenderError() {
    method connectedCallback (line 283) | connectedCallback() {
    method render (line 306) | render() {
    method #renderThemeToggle (line 315) | #renderThemeToggle() {
    method #maybeRenderForm (line 336) | #maybeRenderForm() {
    method #startLoadingAnimation (line 383) | #startLoadingAnimation() {
    method #stopLoadingAnimation (line 397) | #stopLoadingAnimation() {
    method #sendMessage (line 404) | async #sendMessage(
    method #maybeRenderData (line 426) | #maybeRenderData() {
    method #sendAndProcessMessage (line 509) | async #sendAndProcessMessage(request) {
    method snackbar (line 519) | snackbar(
    method unsnackbar (line 553) | unsnackbar(id?: SnackbarUUID) {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/client.ts
  constant A2AUI_MIME_TYPE (line 21) | const A2AUI_MIME_TYPE = "application/json+a2aui";
  class A2UIClient (line 23) | class A2UIClient {
    method constructor (line 27) | constructor(serverUrl: string = "") {
    method ready (line 32) | get ready() {
    method #getClient (line 36) | async #getClient() {
    method send (line 55) | async send(

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/configs/types.ts
  type AppConfig (line 22) | interface AppConfig {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/events/events.ts
  class SnackbarActionEvent (line 25) | class SnackbarActionEvent extends Event {
    method constructor (line 28) | constructor(

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/middleware/a2a.ts
  constant A2AUI_MIME_TYPE (line 28) | const A2AUI_MIME_TYPE = "application/json+a2aui";
  method configureServer (line 66) | configureServer(server: ViteDevServer) {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/theme/clone-default-theme.ts
  function cloneDefaultTheme (line 20) | function cloneDefaultTheme(): v0_8.Types.Theme {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/types/types.ts
  type SnackType (line 19) | enum SnackType {
  type SnackbarUUID (line 27) | type SnackbarUUID = ReturnType<typeof globalThis.crypto.randomUUID>;
  type SnackbarAction (line 29) | type SnackbarAction = {
  type SnackbarMessage (line 36) | type SnackbarMessage = {

FILE: examples/agent/a2ui_agent/samples/client/lit/shell/ui/snackbar.ts
  constant DEFAULT_TIMEOUT (line 24) | const DEFAULT_TIMEOUT = 8000;
  class Snackbar (line 27) | class Snackbar extends LitElement {
    method show (line 170) | show(message: SnackbarMessage, replaceAll = false) {
    method hide (line 198) | hide(id?: SnackbarUUID) {
    method render (line 218) | render() {

FILE: examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.py
  class A2UIResponse (line 23) | class A2UIResponse(BaseModel):
  function check_a2ui_extension (line 31) | def check_a2ui_extension(*args: Any) -> bool:
  function transfer_ui_event_to_query (line 73) | def transfer_ui_event_to_query(ui_event_part: dict) -> str:
  function pre_process_request_with_ui_event (line 116) | def pre_process_request_with_ui_event(message: Message) -> Any:
  function _find_json_end (line 148) | def _find_json_end(json_string: str) -> int:
  function extract_ui_json_from_text (line 182) | def extract_ui_json_from_text(content_str: str) -> tuple[str, None]:
  function check_a2ui_json_in_message (line 211) | def check_a2ui_json_in_message(
  function post_process_a2a_message_for_ui (line 255) | def post_process_a2a_message_for_ui(

FILE: examples/agent/a2ui_agent/samples/general_agent/prompt_builder.py
  function get_ui_prompt (line 21) | def get_ui_prompt() -> str:

FILE: examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.py
  class SimpleStreamHandler (line 35) | class SimpleStreamHandler:
    method _prepare_final_message (line 44) | async def _prepare_final_message(
    method on_message_send (line 85) | async def on_message_send(
    method on_message_send_stream (line 147) | async def on_message_send_stream(

FILE: examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/view_a2ui_examples.py
  function view_a2ui_examples (line 49) | def view_a2ui_examples(template_name: str) -> str:

FILE: examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/view_a2ui_schema.py
  function view_a2ui_schema (line 16) | def view_a2ui_schema(schema_category: str = "BASE_SCHEMA") -> str:

FILE: examples/agent/browser_agent/browser_agent.py
  class EmptyModel (line 48) | class EmptyModel(BaseModel):
  class BrowserAgent (line 90) | class BrowserAgent(ReActAgent):
    method __init__ (line 98) | def __init__(
    method reply (line 165) | async def reply(  # pylint: disable=R0912,R0915
    method _pure_reasoning (line 283) | async def _pure_reasoning(
    method _reasoning_with_observation (line 345) | async def _reasoning_with_observation(self) -> Msg:
    method _summarize_mem (line 413) | async def _summarize_mem(self) -> None:
    method _build_observation (line 419) | async def _build_observation(self) -> Msg:
    method _update_chunk_observation_status (line 427) | async def _update_chunk_observation_status(
    method _acting (line 473) | async def _acting(self, tool_call: ToolUseBlock) -> dict | None:
    method _clean_tool_excution_content (line 516) | def _clean_tool_excution_content(self, output_msg: Msg) -> Msg:
    method _task_decomposition_and_reformat (line 527) | async def _task_decomposition_and_reformat(
    method _navigate_to_start_url (line 644) | async def _navigate_to_start_url(self) -> None:
    method _get_snapshot_in_text (line 676) | async def _get_snapshot_in_text(self) -> list[str]:
    method _memory_summarizing (line 693) | async def _memory_summarizing(self) -> None:
    method _get_screenshot (line 746) | async def _get_screenshot(self) -> Optional[str]:
    method _filter_execution_text (line 778) | def _filter_execution_text(
    method _split_snapshot_by_chunk (line 794) | def _split_snapshot_by_chunk(
    method observe_by_chunk (line 805) | def observe_by_chunk(self, image_data: str | None = "") -> Msg:
    method browser_subtask_manager (line 830) | async def browser_subtask_manager(  # pylint: disable=R0912,R0915
    method browser_generate_final_response (line 961) | async def browser_generate_final_response(
    method image_understanding (line 1056) | async def image_understanding(
    method _validate_finish_status (line 1166) | async def _validate_finish_status(self, summary: str) -> str:
    method _register_skill_tool (line 1207) | def _register_skill_tool(
    method _supports_multimodal (line 1245) | def _supports_multimodal(self) -> bool:

FILE: examples/agent/browser_agent/build_in_helper/_file_download.py
  class EmptyModel (line 34) | class EmptyModel(BaseModel):
  class FileDownloadAgent (line 40) | class FileDownloadAgent(ReActAgent):
    method __init__ (line 45) | def __init__(
    method file_download_final_response (line 78) | async def file_download_final_response(
  function _build_initial_instruction (line 143) | def _build_initial_instruction(
  function file_download (line 160) | async def file_download(

FILE: examples/agent/browser_agent/build_in_helper/_form_filling.py
  class EmptyModel (line 32) | class EmptyModel(BaseModel):
  class FormFillingAgent (line 38) | class FormFillingAgent(ReActAgent):
    method __init__ (line 43) | def __init__(
    method form_filling_final_response (line 62) | async def form_filling_final_response(
  function _build_initial_instruction (line 127) | def _build_initial_instruction(
  function form_filling (line 141) | async def form_filling(

FILE: examples/agent/browser_agent/build_in_helper/_image_understanding.py
  function image_understanding (line 23) | async def image_understanding(

FILE: examples/agent/browser_agent/build_in_helper/_video_understanding.py
  function video_understanding (line 27) | async def video_understanding(
  function audio2text (line 113) | def audio2text(audio_path: str) -> str:
  function extract_frames (line 136) | def extract_frames(
  function extract_audio (line 202) | def extract_audio(video_path: str, audio_path: str) -> str:
  function _probe_video_duration (line 240) | def _probe_video_duration(video_path: str) -> Optional[float]:
  function _build_multimodal_blocks (line 271) | def _build_multimodal_blocks(
  function _prepare_workdir (line 307) | def _prepare_workdir(browser_agent: Any) -> str:
  function _error_response (line 319) | def _error_response(message: str) -> ToolResponse:

FILE: examples/agent/browser_agent/main.py
  class FinalResult (line 19) | class FinalResult(BaseModel):
  function main (line 27) | async def main(
  function parse_arguments (line 82) | def parse_arguments() -> argparse.Namespace:

FILE: examples/agent/deep_research_agent/built_in_prompt/promptmodule.py
  class SubtasksDecomposition (line 6) | class SubtasksDecomposition(BaseModel):
  class WebExtraction (line 32) | class WebExtraction(BaseModel):
  class FollowupJudge (line 62) | class FollowupJudge(BaseModel):
  class ReflectFailure (line 77) | class ReflectFailure(BaseModel):

FILE: examples/agent/deep_research_agent/deep_research_agent.py
  class SubTaskItem (line 56) | class SubTaskItem(BaseModel):
  class DeepResearchAgent (line 64) | class DeepResearchAgent(ReActAgent):
    method __init__ (line 90) | def __init__(
    method _ensure_mcp_initialized (line 192) | async def _ensure_mcp_initialized(self) -> None:
    method reply (line 201) | async def reply(
    method _acting (line 295) | async def _acting(self, tool_call: ToolUseBlock) -> Msg | None:
    method get_model_output (line 435) | async def get_model_output(
    method call_specific_tool (line 477) | async def call_specific_tool(
    method decompose_and_expand_subtask (line 522) | async def decompose_and_expand_subtask(self) -> ToolResponse:
    method _follow_up (line 591) | async def _follow_up(
    method summarize_intermediate_results (line 739) | async def summarize_intermediate_results(self) -> ToolResponse:
    method _generate_deepresearch_report (line 868) | async def _generate_deepresearch_report(
    method _summarizing (line 954) | async def _summarizing(self) -> Msg:
    method reflect_failure (line 976) | async def reflect_failure(self) -> ToolResponse:
    method generate_response (line 1085) | async def generate_response(  #

FILE: examples/agent/deep_research_agent/main.py
  function main (line 16) | async def main(user_query: str) -> None:

FILE: examples/agent/deep_research_agent/utils.py
  function get_prompt_from_file (line 12) | def get_prompt_from_file(
  function truncate_by_words (line 25) | def truncate_by_words(
  function truncate_search_result (line 56) | def truncate_search_result(
  function generate_structure_output (line 77) | def generate_structure_output(**kwargs: Any) -> ToolResponse:
  function get_dynamic_tool_call_json (line 99) | def get_dynamic_tool_call_json(data_model_type: Type[BaseModel]) -> list...
  function get_structure_output (line 131) | def get_structure_output(blocks: list | Sequence) -> dict:
  function load_prompt_dict (line 164) | def load_prompt_dict() -> dict:

FILE: examples/agent/meta_planner_agent/main.py
  function main (line 15) | async def main() -> None:

FILE: examples/agent/meta_planner_agent/tool.py
  class ResultModel (line 26) | class ResultModel(BaseModel):
  function _convert_to_text_block (line 43) | def _convert_to_text_block(msgs: list[Msg]) -> list[TextBlock]:
  function create_worker (line 63) | async def create_worker(

FILE: examples/agent/react_agent/main.py
  function main (line 18) | async def main() -> None:

FILE: examples/agent/realtime_voice_agent/run_server.py
  function get (line 33) | async def get() -> FileResponse:
  function check_models (line 40) | async def check_models() -> dict:
  function frontend_receive (line 49) | async def frontend_receive(
  function single_agent_endpoint (line 67) | async def single_agent_endpoint(

FILE: examples/agent/voice_agent/main.py
  function main (line 15) | async def main() -> None:

FILE: examples/deployment/planning_agent/main.py
  function handle_input (line 22) | async def handle_input(
  function chat_endpoint (line 92) | async def chat_endpoint() -> Response:

FILE: examples/deployment/planning_agent/test_post.py
  function send_post (line 7) | def send_post(user_query: str) -> None:

FILE: examples/deployment/planning_agent/tool.py
  class ResultModel (line 26) | class ResultModel(BaseModel):
  function _convert_to_text_block (line 43) | def _convert_to_text_block(msgs: list[Msg]) -> list[TextBlock]:
  function create_worker (line 63) | async def create_worker(

FILE: examples/evaluation/ace_bench/main.py
  function react_agent_solution (line 23) | async def react_agent_solution(
  function main (line 86) | async def main() -> None:

FILE: examples/functionality/agent_skill/main.py
  function main (line 19) | async def main() -> None:

FILE: examples/functionality/agent_skill/skill/analyzing-agentscope-library/view_agentscope_module.py
  function get_class_signature (line 11) | def get_class_signature(cls: type) -> str:
  function get_function_signature (line 57) | def get_function_signature(func: Callable) -> str:
  class FuncOrCls (line 69) | class FuncOrCls(BaseModel):
    method __init__ (line 84) | def __init__(
  function _truncate_docstring (line 103) | def _truncate_docstring(docstring: str, max_length: int = 200) -> str:
  function get_agentscope_module_signatures (line 121) | def get_agentscope_module_signatures() -> list[FuncOrCls]:
  function view_agentscope_library (line 201) | def view_agentscope_library(

FILE: examples/functionality/long_term_memory/mem0/memory_example.py
  function main (line 26) | async def main() -> None:

FILE: examples/functionality/long_term_memory/reme/personal_memory_example.py
  function test_record_to_memory (line 31) | async def test_record_to_memory(
  function test_retrieve_from_memory (line 60) | async def test_retrieve_from_memory(
  function test_record_direct (line 82) | async def test_record_direct(memory: ReMePersonalLongTermMemory) -> None:
  function test_retrieve_direct (line 128) | async def test_retrieve_direct(memory: ReMePersonalLongTermMemory) -> None:
  function test_react_agent_with_memory (line 157) | async def test_react_agent_with_memory(
  function main (line 245) | async def main() -> None:

FILE: examples/functionality/long_term_memory/reme/task_memory_example.py
  function test_record_to_memory (line 32) | async def test_record_to_memory(memory: ReMeTaskLongTermMemory) -> None:
  function test_retrieve_from_memory (line 72) | async def test_retrieve_from_memory(
  function test_record_direct (line 107) | async def test_record_direct(memory: ReMeTaskLongTermMemory) -> None:
  function test_retrieve_direct (line 156) | async def test_retrieve_direct(memory: ReMeTaskLongTermMemory) -> None:
  function test_react_agent_with_memory (line 185) | async def test_react_agent_with_memory(
  function main (line 292) | async def main() -> None:

FILE: examples/functionality/long_term_memory/reme/tool_memory_example.py
  function web_search (line 39) | async def web_search(query: str, max_results: int = 5) -> ToolResponse:
  function calculate (line 61) | async def calculate(expression: str) -> ToolResponse:
  function record_tool_history (line 97) | async def record_tool_history(
  function retrieve_tool_guidelines (line 204) | async def retrieve_tool_guidelines(
  function use_react_agent_with_tool_memory (line 265) | async def use_react_agent_with_tool_memory(
  function main (line 347) | async def main() -> None:

FILE: examples/functionality/mcp/main.py
  class NumberResult (line 28) | class NumberResult(BaseModel):
  function main (line 34) | async def main() -> None:

FILE: examples/functionality/mcp/mcp_add.py
  function add (line 11) | def add(a: int, b: int) -> int:

FILE: examples/functionality/mcp/mcp_multiply.py
  function multiply (line 11) | def multiply(c: int, d: int) -> int:

FILE: examples/functionality/plan/main_agent_managed_plan.py
  function main (line 21) | async def main() -> None:

FILE: examples/functionality/plan/main_manual_plan.py
  function main (line 23) | async def main() -> None:

FILE: examples/functionality/rag/agentic_usage.py
  function main (line 33) | async def main() -> None:

FILE: examples/functionality/rag/basic_usage.py
  function main (line 15) | async def main() -> None:

FILE: examples/functionality/rag/multimodal_rag.py
  function example_multimodal_rag (line 25) | async def example_multimodal_rag() -> None:

FILE: examples/functionality/rag/react_agent_integration.py
  function main (line 14) | async def main() -> None:

FILE: examples/functionality/session_with_sqlite/main.py
  function main (line 16) | async def main(username: str, query: str) -> None:

FILE: examples/functionality/session_with_sqlite/sqlite_session.py
  class SqliteSession (line 12) | class SqliteSession(SessionBase):
    method __init__ (line 15) | def __init__(
    method save_session_state (line 27) | async def save_session_state(
    method load_session_state (line 69) | async def load_session_state(

FILE: examples/functionality/short_term_memory/memory_compression/main.py
  function main (line 11) | async def main() -> None:

FILE: examples/functionality/short_term_memory/reme/reme_short_term_memory.py
  class ReMeShortTermMemory (line 17) | class ReMeShortTermMemory(InMemoryMemory):
    method __init__ (line 39) | def __init__(
    method __aenter__ (line 156) | async def __aenter__(self) -> "ReMeShortTermMemory":
    method __aexit__ (line 166) | async def __aexit__(
    method get_memory (line 180) | async def get_memory(self) -> list[Msg]:
    method list_to_msg (line 269) | def list_to_msg(messages: list[dict[str, Any]]) -> list[Msg]:
    method retrieve (line 340) | async def retrieve(self, *args: Any, **kwargs: Any) -> None:

FILE: examples/functionality/short_term_memory/reme/short_term_memory_example.py
  function main (line 18) | async def main() -> None:

FILE: examples/functionality/stream_printing_messages/multi_agent.py
  function create_agent (line 13) | def create_agent(name: str) -> ReActAgent:
  function workflow (line 27) | async def workflow(
  function main (line 48) | async def main() -> None:

FILE: examples/functionality/stream_printing_messages/single_agent.py
  function main (line 21) | async def main() -> None:

FILE: examples/functionality/structured_output/main.py
  class TableModel (line 18) | class TableModel(BaseModel):
  class ChoiceModel (line 29) | class ChoiceModel(BaseModel):
  function main (line 37) | async def main() -> None:

FILE: examples/functionality/tts/main.py
  function main (line 19) | async def main() -> None:

FILE: examples/functionality/vector_store/alibabacloud_mysql_vector/main.py
  function example_basic_operations (line 12) | async def example_basic_operations() -> None:
  function example_filter_search (line 111) | async def example_filter_search() -> None:
  function example_distance_metrics (line 214) | async def example_distance_metrics() -> None:
  function main (line 259) | async def main() -> None:

FILE: examples/functionality/vector_store/milvus_lite/main.py
  function example_basic_operations (line 12) | async def example_basic_operations() -> None:
  function example_filter_search (line 103) | async def example_filter_search() -> None:
  function example_multiple_chunks (line 200) | async def example_multiple_chunks() -> None:
  function example_distance_metrics (line 264) | async def example_distance_metrics() -> None:
  function main (line 303) | async def main() -> None:

FILE: examples/functionality/vector_store/mongodb/main.py
  function example_basic_operations (line 14) | async def example_basic_operations() -> None:
  function example_filter_search (line 109) | async def example_filter_search() -> None:
  function example_multiple_chunks (line 214) | async def example_multiple_chunks() -> None:
  function example_distance_metrics (line 283) | async def example_distance_metrics() -> None:
  function main (line 327) | async def main() -> None:

FILE: examples/functionality/vector_store/oceanbase/main.py
  function _create_store (line 14) | def _create_store(
  function example_basic_operations (line 30) | async def example_basic_operations() -> None:
  function example_filter_search (line 116) | async def example_filter_search() -> None:
  function example_multiple_chunks (line 218) | async def example_multiple_chunks() -> None:
  function example_distance_metrics (line 285) | async def example_distance_metrics() -> None:
  function main (line 326) | async def main() -> None:

FILE: examples/game/werewolves/game.py
  function hunter_stage (line 51) | async def hunter_stage(
  function werewolves_game (line 67) | async def werewolves_game(agents: list[ReActAgent]) -> None:

FILE: examples/game/werewolves/main.py
  function get_official_agents (line 18) | def get_official_agents(name: str) -> ReActAgent:
  function main (line 91) | async def main() -> None:

FILE: examples/game/werewolves/prompt.py
  class EnglishPrompts (line 5) | class EnglishPrompts:
  class ChinesePrompts (line 131) | class ChinesePrompts:

FILE: examples/game/werewolves/structured_model.py
  class DiscussionModel (line 9) | class DiscussionModel(BaseModel):
  function get_vote_model (line 17) | def get_vote_model(agents: list[AgentBase]) -> type[BaseModel]:
  class WitchResurrectModel (line 30) | class WitchResurrectModel(BaseModel):
  function get_poison_model (line 38) | def get_poison_model(agents: list[AgentBase]) -> type[BaseModel]:
  function get_seer_model (line 76) | def get_seer_model(agents: list[AgentBase]) -> type[BaseModel]:
  function get_hunter_model (line 89) | def get_hunter_model(agents: list[AgentBase]) -> type[BaseModel]:

FILE: examples/game/werewolves/utils.py
  function majority_vote (line 19) | def majority_vote(votes: list[str]) -> tuple:
  function names_to_str (line 29) | def names_to_str(agents: list[str] | list[ReActAgent]) -> str:
  class EchoAgent (line 48) | class EchoAgent(AgentBase):
    method __init__ (line 51) | def __init__(self, tts_model: TTSModelBase | None = None) -> None:
    method reply (line 57) | async def reply(self, content: str) -> Msg:
    method handle_interrupt (line 77) | async def handle_interrupt(
    method observe (line 84) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
  class Players (line 88) | class Players:
    method __init__ (line 91) | def __init__(self) -> None:
    method add_player (line 105) | def add_player(self, player: ReActAgent, role: str) -> None:
    method update_players (line 132) | def update_players(self, dead_players: list[ReActAgent]) -> None:
    method print_roles (line 152) | def print_roles(self) -> None:
    method check_winning (line 158) | def check_winning(self) -> str | None:

FILE: examples/integration/alibabacloud_api_mcp/main.py
  function require_env_var (line 62) | def require_env_var(name: str) -> str:
  function main (line 70) | async def main() -> None:

FILE: examples/integration/alibabacloud_api_mcp/oauth_handler.py
  class InMemoryTokenStorage (line 72) | class InMemoryTokenStorage(TokenStorage):
    method __init__ (line 75) | def __init__(self) -> None:
    method get_tokens (line 79) | async def get_tokens(self) -> OAuthToken | None:
    method set_tokens (line 83) | async def set_tokens(self, tokens: OAuthToken) -> None:
    method get_client_info (line 87) | async def get_client_info(self) -> OAuthClientInformationFull | None:
    method set_client_info (line 91) | async def set_client_info(
  class CallbackHandler (line 99) | class CallbackHandler(BaseHTTPRequestHandler):
    method __init__ (line 102) | def __init__(
    method do_GET (line 112) | def do_GET(self) -> None:
  class CallbackServer (line 162) | class CallbackServer:
    method __init__ (line 165) | def __init__(self, port: int = 3000) -> None:
    method start (line 174) | def start(self) -> None:
    method stop (line 186) | def stop(self) -> None:
    method wait_for_callback (line 195) | async def wait_for_callback(
  function handle_redirect (line 226) | async def handle_redirect(auth_url: str) -> None:
  function handle_callback (line 242) | async def handle_callback() -> tuple[str, str | None]:

FILE: examples/integration/qwen_deep_research_model/main.py
  function main (line 10) | async def main() -> None:

FILE: examples/integration/qwen_deep_research_model/qwen_deep_research_agent.py
  class QwenDeepResearchAgent (line 17) | class QwenDeepResearchAgent(AgentBase):
    method __init__ (line 36) | def __init__(
    method reply (line 60) | async def reply(
    method _call_model (line 126) | async def _call_model(self, step_name: str) -> str:
    method _process_responses (line 165) | async def _process_responses(
    method _handle_web_research_phase (line 283) | def _handle_web_research_phase(
    method _log_status (line 328) | def _log_status(self, status: str) -> None:
    method _log_usage (line 343) | def _log_usage(self, response: GenerationResponse) -> None:
    method observe (line 356) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 371) | async def handle_interrupt(self, *args: Any, **kwargs: Any) -> Msg:
    method reset_memory (line 386) | async def reset_memory(self) -> None:

FILE: examples/tuner/react_agent/main.py
  function run_react_agent (line 19) | async def run_react_agent(
  function gsm8k_judge (line 61) | async def gsm8k_judge(

FILE: examples/workflows/multiagent_concurrent/main.py
  class ExampleAgent (line 14) | class ExampleAgent(AgentBase):
    method __init__ (line 17) | def __init__(self, name: str) -> None:
    method reply (line 27) | async def reply(self, *args: Any, **kwargs: Any) -> Msg:
    method handle_interrupt (line 55) | async def handle_interrupt(
    method observe (line 63) | async def observe(self, *args: Any, **kwargs: Any) -> None:
  function main (line 67) | async def main() -> None:

FILE: examples/workflows/multiagent_conversation/main.py
  function create_participant_agent (line 14) | def create_participant_agent(
  function main (line 38) | async def main() -> None:

FILE: examples/workflows/multiagent_debate/main.py
  function create_solver_agent (line 29) | def create_solver_agent(name: str) -> ReActAgent:
  class JudgeModel (line 72) | class JudgeModel(BaseModel):
  function run_multiagent_debate (line 85) | async def run_multiagent_debate() -> None:

FILE: examples/workflows/multiagent_realtime/run_server.py
  function get (line 29) | async def get() -> FileResponse:
  function model_availability (line 36) | async def model_availability() -> dict:
  function frontend_receive (line 45) | async def frontend_receive(
  function multi_agent_endpoint (line 63) | async def multi_agent_endpoint(

FILE: src/agentscope/__init__.py
  function _generate_random_suffix (line 16) | def _generate_random_suffix(length: int) -> str:
  function init (line 72) | def init(

FILE: src/agentscope/_logging.py
  function setup_logger (line 15) | def setup_logger(

FILE: src/agentscope/_run_config.py
  class _ConfigCls (line 6) | class _ConfigCls:
    method __init__ (line 9) | def __init__(
    method run_id (line 26) | def run_id(self) -> str:
    method run_id (line 31) | def run_id(self, value: str) -> None:
    method created_at (line 36) | def created_at(self) -> str:
    method created_at (line 41) | def created_at(self, value: str) -> None:
    method project (line 46) | def project(self) -> str:
    method project (line 51) | def project(self, value: str) -> None:
    method name (line 56) | def name(self) -> str:
    method name (line 61) | def name(self, value: str) -> None:
    method trace_enabled (line 66) | def trace_enabled(self) -> bool:
    method trace_enabled (line 71) | def trace_enabled(self, value: bool) -> None:

FILE: src/agentscope/_utils/_common.py
  function _json_loads_with_repair (line 31) | def _json_loads_with_repair(
  function _is_accessible_local_file (line 72) | def _is_accessible_local_file(url: str) -> bool:
  function _get_timestamp (line 81) | def _get_timestamp(add_random_suffix: bool = False) -> str:
  function _is_async_func (line 92) | async def _is_async_func(func: Callable) -> bool:
  function _execute_async_or_sync_func (line 108) | async def _execute_async_or_sync_func(
  function _get_bytes_from_web_url (line 134) | def _get_bytes_from_web_url(
  function _save_base64_data (line 167) | def _save_base64_data(
  function _extract_json_schema_from_mcp_tool (line 191) | def _extract_json_schema_from_mcp_tool(tool: Tool) -> dict[str, Any]:
  function _remove_title_field (line 214) | def _remove_title_field(schema: dict) -> None:
  function _create_tool_from_base_model (line 241) | def _create_tool_from_base_model(
  function _map_text_to_uuid (line 300) | def _map_text_to_uuid(text: str) -> str:
  function _parse_tool_function (line 314) | def _parse_tool_function(
  function _resample_pcm_delta (line 433) | def _resample_pcm_delta(

FILE: src/agentscope/_utils/_mixin.py
  class DictMixin (line 5) | class DictMixin(dict):

FILE: src/agentscope/a2a/_base.py
  class AgentCardResolverBase (line 12) | class AgentCardResolverBase:
    method get_agent_card (line 19) | async def get_agent_card(self, *args: Any, **kwargs: Any) -> AgentCard:

FILE: src/agentscope/a2a/_file_resolver.py
  class FileAgentCardResolver (line 15) | class FileAgentCardResolver(AgentCardResolverBase):
    method __init__ (line 46) | def __init__(
    method get_agent_card (line 58) | async def get_agent_card(self) -> AgentCard:

FILE: src/agentscope/a2a/_nacos_resolver.py
  class NacosAgentCardResolver (line 17) | class NacosAgentCardResolver(AgentCardResolverBase):
    method __init__ (line 25) | def __init__(
    method get_agent_card (line 59) | async def get_agent_card(self) -> AgentCard:

FILE: src/agentscope/a2a/_well_known_resolver.py
  class WellKnownAgentCardResolver (line 15) | class WellKnownAgentCardResolver(AgentCardResolverBase):
    method __init__ (line 18) | def __init__(
    method get_agent_card (line 35) | async def get_agent_card(self) -> AgentCard:

FILE: src/agentscope/agent/_a2a_agent.py
  class A2AAgent (line 29) | class A2AAgent(AgentBase):
    method __init__ (line 48) | def __init__(
    method state_dict (line 114) | def state_dict(self) -> dict:
    method load_state_dict (line 125) | def load_state_dict(self, state_dict: dict, strict: bool = True) -> None:
    method observe (line 154) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method reply (line 177) | async def reply(
    method handle_interrupt (line 263) | async def handle_interrupt(

FILE: src/agentscope/agent/_agent_base.py
  class AgentBase (line 30) | class AgentBase(StateModule, metaclass=_AgentMeta):
    method __init__ (line 140) | def __init__(self) -> None:
    method observe (line 185) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method reply (line 197) | async def reply(self, *args: Any, **kwargs: Any) -> Msg:
    method print (line 205) | async def print(
    method _process_audio_block (line 276) | def _process_audio_block(
    method _print_text_block (line 369) | def _print_text_block(
    method _print_last_block (line 409) | def _print_last_block(
    method __call__ (line 448) | async def __call__(self, *args: Any, **kwargs: Any) -> Msg:
    method _broadcast_to_subscribers (line 469) | async def _broadcast_to_subscribers(
    method handle_interrupt (line 478) | async def handle_interrupt(
    method interrupt (line 490) | async def interrupt(self, msg: Msg | list[Msg] | None = None) -> None:
    method register_instance_hook (line 495) | def register_instance_hook(
    method remove_instance_hook (line 523) | def remove_instance_hook(
    method register_class_hook (line 553) | def register_class_hook(
    method remove_class_hook (line 581) | def remove_class_hook(
    method clear_class_hooks (line 610) | def clear_class_hooks(
    method clear_instance_hooks (line 633) | def clear_instance_hooks(
    method reset_subscribers (line 663) | def reset_subscribers(
    method remove_subscribers (line 679) | def remove_subscribers(self, msghub_name: str) -> None:
    method disable_console_output (line 695) | def disable_console_output(self) -> None:
    method set_console_output_enabled (line 700) | def set_console_output_enabled(self, enabled: bool) -> None:
    method set_msg_queue_enabled (line 712) | def set_msg_queue_enabled(

FILE: src/agentscope/agent/_agent_meta.py
  function _normalize_to_kwargs (line 21) | def _normalize_to_kwargs(
  function _wrap_with_hooks (line 55) | def _wrap_with_hooks(
  class _AgentMeta (line 147) | class _AgentMeta(type):
    method __new__ (line 151) | def __new__(mcs, name: Any, bases: Any, attrs: Dict) -> Any:
  class _ReActAgentMeta (line 165) | class _ReActAgentMeta(_AgentMeta):
    method __new__ (line 169) | def __new__(mcs, name: Any, bases: Any, attrs: Dict) -> Any:

FILE: src/agentscope/agent/_react_agent.py
  class _QueryRewriteModel (line 33) | class _QueryRewriteModel(BaseModel):
  class SummarySchema (line 43) | class SummarySchema(BaseModel):
  class _MemoryMark (line 88) | class _MemoryMark(str, Enum):
  class ReActAgent (line 98) | class ReActAgent(ReActAgentBase):
    class CompressionConfig (line 107) | class CompressionConfig(BaseModel):
    method __init__ (line 177) | def __init__(
    method sys_prompt (line 367) | def sys_prompt(self) -> str:
    method reply (line 376) | async def reply(  # pylint: disable=too-many-branches
    method _reasoning (line 540) | async def _reasoning(
    method _acting (line 655) | async def _acting(self, tool_call: ToolUseBlock) -> dict | None:
    method observe (line 714) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method _summarizing (line 723) | async def _summarizing(self) -> Msg:
    method handle_interrupt (line 795) | async def handle_interrupt(
    method generate_response (line 825) | def generate_response(
    method _retrieve_from_long_term_memory (line 878) | async def _retrieve_from_long_term_memory(
    method _retrieve_from_knowledge (line 904) | async def _retrieve_from_knowledge(
    method _compress_memory_if_needed (line 1011) | async def _compress_memory_if_needed(self) -> None:

FILE: src/agentscope/agent/_react_agent_base.py
  class ReActAgentBase (line 12) | class ReActAgentBase(AgentBase, metaclass=_ReActAgentMeta):
    method __init__ (line 92) | def __init__(
    method _reasoning (line 105) | async def _reasoning(
    method _acting (line 114) | async def _acting(self, *args: Any, **kwargs: Any) -> Any:

FILE: src/agentscope/agent/_realtime_agent.py
  class RealtimeAgent (line 28) | class RealtimeAgent(StateModule):
    method __init__ (line 65) | def __init__(
    method start (line 102) | async def start(self, outgoing_queue: Queue) -> None:
    method stop (line 126) | async def stop(self) -> None:
    method _forward_loop (line 134) | async def _forward_loop(self) -> None:
    method _model_response_loop (line 223) | async def _model_response_loop(self, outgoing_queue: Queue) -> None:
    method handle_input (line 307) | async def handle_input(
    method _acting (line 319) | async def _acting(

FILE: src/agentscope/agent/_user_agent.py
  class UserAgent (line 12) | class UserAgent(AgentBase):
    method __init__ (line 21) | def __init__(
    method reply (line 30) | async def reply(
    method override_instance_input_method (line 78) | def override_instance_input_method(
    method override_class_input_method (line 97) | def override_class_input_method(
    method handle_interrupt (line 115) | async def handle_interrupt(
    method observe (line 127) | async def observe(self, msg: Msg | list[Msg] | None) -> None:

FILE: src/agentscope/agent/_user_input.py
  class UserInputData (line 29) | class UserInputData:
  class UserInputBase (line 39) | class UserInputBase:
    method __call__ (line 43) | async def __call__(
  class TerminalUserInput (line 68) | class TerminalUserInput(UserInputBase):
    method __init__ (line 71) | def __init__(self, input_hint: str = "User Input: ") -> None:
    method __call__ (line 75) | async def __call__(
  class StudioUserInput (line 154) | class StudioUserInput(UserInputBase):
    method __init__ (line 159) | def __init__(
    method _ensure_connected (line 286) | def _ensure_connected(
    method __call__ (line 336) | async def __call__(  # type: ignore[override]
    method __del__ (line 406) | def __del__(self) -> None:

FILE: src/agentscope/agent/_utils.py
  class _AsyncNullContext (line 6) | class _AsyncNullContext:
    method __aenter__ (line 9) | async def __aenter__(self) -> None:
    method __aexit__ (line 12) | async def __aexit__(

FILE: src/agentscope/embedding/_cache_base.py
  class EmbeddingCacheBase (line 12) | class EmbeddingCacheBase:
    method store (line 17) | async def store(
    method retrieve (line 37) | async def retrieve(
    method remove (line 50) | async def remove(
    method clear (line 62) | async def clear(self) -> None:

FILE: src/agentscope/embedding/_dashscope_embedding.py
  class DashScopeTextEmbedding (line 14) | class DashScopeTextEmbedding(EmbeddingModelBase):
    method __init__ (line 31) | def __init__(
    method _call_api (line 60) | async def _call_api(self, kwargs: dict[str, Any]) -> EmbeddingResponse:
    method __call__ (line 107) | async def __call__(

FILE: src/agentscope/embedding/_dashscope_multimodal_embedding.py
  class DashScopeMultiModalEmbedding (line 17) | class DashScopeMultiModalEmbedding(EmbeddingModelBase):
    method __init__ (line 24) | def __init__(
    method __call__ (line 91) | async def __call__(
    method _call_api (line 198) | async def _call_api(self, kwargs: dict[str, Any]) -> EmbeddingResponse:

FILE: src/agentscope/embedding/_embedding_base.py
  class EmbeddingModelBase (line 8) | class EmbeddingModelBase:
    method __init__ (line 20) | def __init__(
    method __call__ (line 36) | async def __call__(

FILE: src/agentscope/embedding/_embedding_response.py
  class EmbeddingResponse (line 13) | class EmbeddingResponse(DictMixin):

FILE: src/agentscope/embedding/_embedding_usage.py
  class EmbeddingUsage (line 10) | class EmbeddingUsage(DictMixin):

FILE: src/agentscope/embedding/_file_cache.py
  class FileEmbeddingCache (line 19) | class FileEmbeddingCache(EmbeddingCacheBase):
    method __init__ (line 23) | def __init__(
    method cache_dir (line 47) | def cache_dir(self) -> str:
    method store (line 53) | async def store(
    method retrieve (line 89) | async def retrieve(
    method remove (line 109) | async def remove(self, identifier: JSONSerializableObject) -> None:
    method clear (line 126) | async def clear(self) -> None:
    method _get_cache_size (line 132) | def _get_cache_size(self) -> float:
    method _get_filename (line 143) | def _get_filename(identifier: JSONSerializableObject) -> str:
    method _maintain_cache_dir (line 148) | async def _maintain_cache_dir(self) -> None:

FILE: src/agentscope/embedding/_gemini_embedding.py
  class GeminiTextEmbedding (line 13) | class GeminiTextEmbedding(EmbeddingModelBase):
    method __init__ (line 19) | def __init__(
    method __call__ (line 50) | async def __call__(

FILE: src/agentscope/embedding/_ollama_embedding.py
  class OllamaTextEmbedding (line 13) | class OllamaTextEmbedding(EmbeddingModelBase):
    method __init__ (line 19) | def __init__(
    method __call__ (line 48) | async def __call__(

FILE: src/agentscope/embedding/_openai_embedding.py
  class OpenAITextEmbedding (line 13) | class OpenAITextEmbedding(EmbeddingModelBase):
    method __init__ (line 19) | def __init__(
    method __call__ (line 49) | async def __call__(

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_benchmark.py
  class ACEBenchmark (line 19) | class ACEBenchmark(BenchmarkBase):
    method __init__ (line 58) | def __init__(
    method _load_data (line 87) | def _load_data(self) -> list[dict]:
    method _verify_data (line 130) | def _verify_data(self) -> bool:
    method _download_data (line 149) | def _download_data(self) -> None:
    method _data_to_task (line 176) | def _data_to_task(item: dict) -> Task:
    method __iter__ (line 229) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 234) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 238) | def __len__(self) -> int:

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_metric.py
  class ACEProcessAccuracy (line 8) | class ACEProcessAccuracy(MetricBase):
    method __init__ (line 11) | def __init__(
    method __call__ (line 23) | async def __call__(
  class ACEAccuracy (line 70) | class ACEAccuracy(MetricBase):
    method __init__ (line 73) | def __init__(
    method __call__ (line 85) | async def __call__(

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_api/_food_platform_api.py
  class FoodPlatformApi (line 7) | class FoodPlatformApi(SharedState):
    method __init__ (line 20) | def __init__(self, shared_state: dict) -> None:
    method get_state_dict (line 114) | def get_state_dict(self) -> dict:
    method login_food_platform (line 124) | def login_food_platform(
    method view_logged_in_users (line 152) | def view_logged_in_users(self) -> dict:
    method check_balance (line 162) | def check_balance(self, user_name: str) -> float:
    method add_food_delivery_order (line 174) | def add_food_delivery_order(
    method get_products (line 251) | def get_products(
    method view_orders (line 270) | def view_orders(
    method search_orders (line 284) | def search_orders(

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_api/_message_api.py
  class MessageApi (line 8) | class MessageApi(SharedState):
    method __init__ (line 21) | def __init__(self, share_state: dict) -> None:
    method get_state_dict (line 105) | def get_state_dict(self) -> dict:
    method send_message (line 119) | def send_message(
    method delete_message (line 167) | def delete_message(self, message_id: int) -> dict[str, bool | str]:
    method view_messages_between_users (line 182) | def view_messages_between_users(
    method search_messages (line 231) | def search_messages(
    method get_all_message_times_with_ids (line 270) | def get_all_message_times_with_ids(
    method get_latest_message_id (line 284) | def get_latest_message_id(self) -> dict:
    method get_earliest_message_id (line 313) | def get_earliest_message_id(self) -> dict:

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_api/_reminder_api.py
  class ReminderApi (line 8) | class ReminderApi(SharedState):
    method __init__ (line 20) | def __init__(self, share_state: dict) -> None:
    method get_state_dict (line 56) | def get_state_dict(self) -> dict:
    method _check_capacity (line 64) | def _check_capacity(self) -> bool:
    method view_reminder_by_title (line 68) | def view_reminder_by_title(
    method add_reminder (line 89) | def add_reminder(
    method delete_reminder (line 124) | def delete_reminder(self, reminder_id: int) -> dict[str, bool | str]:
    method view_all_reminders (line 141) | def view_all_reminders(
    method mark_as_notified (line 165) | def mark_as_notified(
    method search_reminders (line 183) | def search_reminders(

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_api/_shared_state.py
  class SharedState (line 5) | class SharedState:
    method __init__ (line 8) | def __init__(self, shared_state: dict) -> None:
    method wifi (line 13) | def wifi(self) -> bool:
    method logged_in (line 18) | def logged_in(self) -> bool:

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_api/_travel_api.py
  class TravelApi (line 13) | class TravelApi:
    method __init__ (line 29) | def __init__(self) -> None:
    method get_state_dict (line 228) | def get_state_dict(self) -> dict:
    method get_flight_details (line 239) | def get_flight_details(
    method get_user_details (line 286) | def get_user_details(self, user_id: str, password: str) -> dict:
    method get_reservation_details (line 303) | def get_reservation_details(
    method authenticate_user (line 350) | def authenticate_user(self, user_id: str, password: str) -> dict:
    method get_baggage_allowance (line 366) | def get_baggage_allowance(
    method find_transfer_flights (line 387) | def find_transfer_flights(
    method calculate_baggage_fee (line 455) | def calculate_baggage_fee(
    method update_balance (line 480) | def update_balance(
    method reserve_flight (line 506) | def reserve_flight(
    method modify_flight (line 587) | def modify_flight(
    method cancel_reservation (line 714) | def cancel_reservation(
    method process_refund (line 802) | def process_refund(self, user: dict, amount: float) -> str:
    method calculate_price_difference (line 812) | def calculate_price_difference(

FILE: src/agentscope/evaluate/_ace_benchmark/_ace_tools_zh.py
  function _tool_function_wrapper (line 16) | def _tool_function_wrapper(get_tool_function: Callable) -> Callable:
  class ACEPhone (line 42) | class ACEPhone:
    method __init__ (line 48) | def __init__(self) -> None:
    method turn_on_wifi (line 59) | def turn_on_wifi(self) -> dict[str, bool | str]:
    method login_device (line 64) | def login_device(self) -> dict[str, bool | str]:
    method load_initial_config (line 69) | def load_initial_config(self, initial_config: dict) -> None:
    method get_current_state (line 89) | def get_current_state(self) -> list[dict]:
    method get_tool_function (line 100) | def get_tool_function(self, name: str) -> Callable:

FILE: src/agentscope/evaluate/_benchmark_base.py
  class BenchmarkBase (line 9) | class BenchmarkBase(ABC):
    method __init__ (line 18) | def __init__(self, name: str, description: str) -> None:
    method __iter__ (line 31) | def __iter__(self) -> Generator[Task, None, None]:
    method __len__ (line 36) | def __len__(self) -> int:
    method __getitem__ (line 41) | def __getitem__(self, index: int) -> Task:

FILE: src/agentscope/evaluate/_evaluator/_evaluator_base.py
  class EvaluatorBase (line 18) | class EvaluatorBase:
    method __init__ (line 21) | def __init__(
    method run (line 49) | async def run(
    method _save_evaluation_meta (line 65) | async def _save_evaluation_meta(self) -> None:
    method _save_task_meta (line 81) | async def _save_task_meta(self, task: Task) -> None:
    method aggregate (line 96) | async def aggregate(self) -> None:

FILE: src/agentscope/evaluate/_evaluator/_general_evaluator.py
  class GeneralEvaluator (line 14) | class GeneralEvaluator(EvaluatorBase):
    method __init__ (line 17) | def __init__(
    method run_evaluation (line 43) | async def run_evaluation(
    method run_solution (line 59) | async def run_solution(
    method run (line 124) | async def run(

FILE: src/agentscope/evaluate/_evaluator/_in_memory_exporter.py
  class _InMemoryExporter (line 14) | class _InMemoryExporter(SpanExporter):
    method __init__ (line 18) | def __init__(self) -> None:
    method export (line 24) | def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
    method shutdown (line 104) | def shutdown(self) -> None:

FILE: src/agentscope/evaluate/_evaluator/_ray_evaluator.py
  function _check_ray_available (line 14) | def _check_ray_available() -> None:
  function _ray_remote_decorator (line 26) | def _ray_remote_decorator(cls: Any) -> Any:
  class RayEvaluationActor (line 39) | class RayEvaluationActor:
    method run (line 45) | async def run(
  class RaySolutionActor (line 71) | class RaySolutionActor:
    method __init__ (line 76) | def __init__(self, n_workers: int = 1):
    method run (line 96) | async def run(
  class RayEvaluator (line 189) | class RayEvaluator(EvaluatorBase):
    method __init__ (line 193) | def __init__(
    method run (line 222) | async def run(

FILE: src/agentscope/evaluate/_evaluator_storage/_evaluator_storage_base.py
  class EvaluatorStorageBase (line 13) | class EvaluatorStorageBase:
    method save_solution_result (line 18) | def save_solution_result(
    method get_evaluation_result (line 38) | def get_evaluation_result(
    method save_evaluation_result (line 61) | def save_evaluation_result(
    method get_solution_result (line 81) | def get_solution_result(
    method solution_result_exists (line 102) | def solution_result_exists(self, task_id: str, repeat_id: str) -> bool:
    method evaluation_result_exists (line 118) | def evaluation_result_exists(
    method save_aggregation_result (line 142) | def save_aggregation_result(
    method aggregation_result_exists (line 155) | def aggregation_result_exists(
    method save_evaluation_meta (line 167) | def save_evaluation_meta(self, meta_info: dict) -> None:
    method save_task_meta (line 176) | def save_task_meta(
    method save_solution_stats (line 192) | def save_solution_stats(
    method get_solution_stats (line 212) | def get_solution_stats(
    method get_agent_pre_print_hook (line 234) | def get_agent_pre_print_hook(

FILE: src/agentscope/evaluate/_evaluator_storage/_file_evaluator_storage.py
  class FileEvaluatorStorage (line 16) | class FileEvaluatorStorage(EvaluatorStorageBase):
    method __init__ (line 40) | def __init__(self, save_dir: str) -> None:
    method _get_save_path (line 44) | def _get_save_path(
    method save_solution_result (line 72) | def save_solution_result(
    method save_evaluation_result (line 98) | def save_evaluation_result(
    method get_evaluation_result (line 125) | def get_evaluation_result(
    method get_solution_result (line 158) | def get_solution_result(
    method solution_result_exists (line 206) | def solution_result_exists(self, task_id: str, repeat_id: str) -> bool:
    method evaluation_result_exists (line 228) | def evaluation_result_exists(
    method save_aggregation_result (line 258) | def save_aggregation_result(
    method aggregation_result_exists (line 277) | def aggregation_result_exists(
    method save_evaluation_meta (line 293) | def save_evaluation_meta(self, meta_info: dict) -> None:
    method save_task_meta (line 308) | def save_task_meta(
    method save_solution_stats (line 330) | def save_solution_stats(
    method get_solution_stats (line 357) | def get_solution_stats(
    method get_agent_pre_print_hook (line 399) | def get_agent_pre_print_hook(

FILE: src/agentscope/evaluate/_metric_base.py
  class MetricResult (line 15) | class MetricResult(DictMixin):
  class MetricType (line 36) | class MetricType(str, Enum):
  class MetricBase (line 47) | class MetricBase(ABC):
    method __init__ (line 63) | def __init__(
    method __call__ (line 96) | async def __call__(

FILE: src/agentscope/evaluate/_solution.py
  class SolutionOutput (line 17) | class SolutionOutput(DictMixin):
    method __getstate__ (line 30) | def __getstate__(self) -> dict[str, Any]:
    method __setstate__ (line 34) | def __setstate__(self, state: dict[str, Any]) -> None:

FILE: src/agentscope/evaluate/_task.py
  class Task (line 12) | class Task:
    method evaluate (line 38) | async def evaluate(self, solution: SolutionOutput) -> list[MetricResult]:

FILE: src/agentscope/exception/_exception_base.py
  class AgentOrientedExceptionBase (line 5) | class AgentOrientedExceptionBase(Exception):
    method __init__ (line 11) | def __init__(self, message: str):
    method __str__ (line 16) | def __str__(self) -> str:

FILE: src/agentscope/exception/_tool.py
  class ToolNotFoundError (line 7) | class ToolNotFoundError(AgentOrientedExceptionBase):
  class ToolInterruptedError (line 11) | class ToolInterruptedError(AgentOrientedExceptionBase):
  class ToolInvalidArgumentsError (line 15) | class ToolInvalidArgumentsError(AgentOrientedExceptionBase):

FILE: src/agentscope/formatter/_a2a_formatter.py
  class A2AChatFormatter (line 31) | class A2AChatFormatter(FormatterBase):
    method format (line 35) | async def format(self, msgs: list[Msg]) -> Message:
    method format_a2a_message (line 147) | async def format_a2a_message(self, name: str, message: Message) -> Msg:
    method _guess_type (line 187) | def _guess_type(
    method format_a2a_task (line 224) | async def format_a2a_task(self, name: str, task: Task) -> list[Msg]:
    method _format_a2a_part (line 273) | async def _format_a2a_part(self, part: Part) -> ContentBlock:

FILE: src/agentscope/formatter/_anthropic_formatter.py
  class AnthropicChatFormatter (line 13) | class AnthropicChatFormatter(TruncatedFormatterBase):
    method _format (line 38) | async def _format(
  class AnthropicMultiAgentFormatter (line 123) | class AnthropicMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 148) | def __init__(
    method _format_tool_sequence (line 167) | async def _format_tool_sequence(
    method _format_agent_message (line 175) | async def _format_agent_message(

FILE: src/agentscope/formatter/_dashscope_formatter.py
  function _format_dashscope_media_block (line 25) | def _format_dashscope_media_block(
  function _reformat_messages (line 67) | def _reformat_messages(
  class DashScopeChatFormatter (line 147) | class DashScopeChatFormatter(TruncatedFormatterBase):
    method __init__ (line 189) | def __init__(
    method _format (line 232) | async def _format(
  class DashScopeMultiAgentFormatter (line 413) | class DashScopeMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 453) | def __init__(
    method _format_tool_sequence (line 501) | async def _format_tool_sequence(
    method _format_agent_message (line 522) | async def _format_agent_message(
    method _format_system_message (line 631) | async def _format_system_message(

FILE: src/agentscope/formatter/_deepseek_formatter.py
  class DeepSeekChatFormatter (line 13) | class DeepSeekChatFormatter(TruncatedFormatterBase):
    method _format (line 36) | async def _format(
  class DeepSeekMultiAgentFormatter (line 123) | class DeepSeekMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 146) | def __init__(
    method _format_tool_sequence (line 173) | async def _format_tool_sequence(
    method _format_agent_message (line 190) | async def _format_agent_message(

FILE: src/agentscope/formatter/_formatter_base.py
  class FormatterBase (line 11) | class FormatterBase:
    method format (line 15) | async def format(self, *args: Any, **kwargs: Any) -> list[dict[str, An...
    method assert_list_of_msgs (line 20) | def assert_list_of_msgs(msgs: list[Msg]) -> None:
    method convert_tool_result_to_string (line 37) | def convert_tool_result_to_string(

FILE: src/agentscope/formatter/_gemini_formatter.py
  function _format_gemini_media_block (line 25) | def _format_gemini_media_block(
  function _to_gemini_inline_data (line 60) | def _to_gemini_inline_data(url: str) -> dict:
  class GeminiChatFormatter (line 107) | class GeminiChatFormatter(TruncatedFormatterBase):
    method __init__ (line 150) | def __init__(
    method _format (line 177) | async def _format(
  class GeminiMultiAgentFormatter (line 312) | class GeminiMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 352) | def __init__(
    method _format_system_message (line 384) | async def _format_system_message(
    method _format_tool_sequence (line 398) | async def _format_tool_sequence(
    method _format_agent_message (line 417) | async def _format_agent_message(

FILE: src/agentscope/formatter/_ollama_formatter.py
  function _format_ollama_image_block (line 23) | def _format_ollama_image_block(
  function _convert_ollama_image_url_to_base64_data (line 51) | def _convert_ollama_image_url_to_base64_data(url: str) -> str:
  class OllamaChatFormatter (line 71) | class OllamaChatFormatter(TruncatedFormatterBase):
    method __init__ (line 96) | def __init__(
    method _format (line 123) | async def _format(
  class OllamaMultiAgentFormatter (line 266) | class OllamaMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 291) | def __init__(
    method _format_system_message (line 323) | async def _format_system_message(
    method _format_tool_sequence (line 333) | async def _format_tool_sequence(
    method _format_agent_message (line 352) | async def _format_agent_message(

FILE: src/agentscope/formatter/_openai_formatter.py
  function _format_openai_image_block (line 27) | def _format_openai_image_block(
  function _to_openai_image_url (line 64) | def _to_openai_image_url(url: str) -> str:
  function _to_openai_audio_data (line 105) | def _to_openai_audio_data(source: URLSource | Base64Source) -> dict:
  class OpenAIChatFormatter (line 156) | class OpenAIChatFormatter(TruncatedFormatterBase):
    method __init__ (line 180) | def __init__(
    method _format (line 207) | async def _format(
  class OpenAIMultiAgentFormatter (line 362) | class OpenAIMultiAgentFormatter(TruncatedFormatterBase):
    method __init__ (line 388) | def __init__(
    method _format_tool_sequence (line 423) | async def _format_tool_sequence(
    method _format_agent_message (line 433) | async def _format_agent_message(

FILE: src/agentscope/formatter/_truncated_formatter_base.py
  class TruncatedFormatterBase (line 19) | class TruncatedFormatterBase(FormatterBase, ABC):
    method __init__ (line 23) | def __init__(
    method format (line 48) | async def format(
    method _format (line 85) | async def _format(self, msgs: list[Msg]) -> list[dict[str, Any]]:
    method _format_system_message (line 115) | async def _format_system_message(
    method _format_tool_sequence (line 130) | async def _format_tool_sequence(
    method _format_agent_message (line 140) | async def _format_agent_message(
    method _truncate (line 151) | async def _truncate(self, msgs: list[Msg]) -> list[Msg]:
    method _count (line 217) | async def _count(self, msgs: list[dict[str, Any]]) -> int | None:
    method _group_messages (line 231) | async def _group_messages(

FILE: src/agentscope/hooks/__init__.py
  function _equip_as_studio_hooks (line 17) | def _equip_as_studio_hooks(

FILE: src/agentscope/hooks/_studio_hooks.py
  function as_studio_forward_message_pre_print_hook (line 12) | def as_studio_forward_message_pre_print_hook(

FILE: src/agentscope/mcp/_client_base.py
  class MCPClientBase (line 18) | class MCPClientBase:
    method __init__ (line 21) | def __init__(self, name: str) -> None:
    method get_callable_function (line 32) | async def get_callable_function(
    method _convert_mcp_content_to_as_blocks (line 40) | def _convert_mcp_content_to_as_blocks(

FILE: src/agentscope/mcp/_http_stateful_client.py
  class HttpStatefulClient (line 11) | class HttpStatefulClient(StatefulClientBase):
    method __init__ (line 31) | def __init__(

FILE: src/agentscope/mcp/_http_stateless_client.py
  class HttpStatelessClient (line 16) | class HttpStatelessClient(MCPClientBase):
    method __init__ (line 30) | def __init__(
    method get_client (line 79) | def get_client(self) -> _AsyncGeneratorContextManager[Any]:
    method get_callable_function (line 92) | async def get_callable_function(
    method list_tools (line 139) | async def list_tools(self) -> List[mcp.types.Tool]:

FILE: src/agentscope/mcp/_mcp_function.py
  class MCPToolFunction (line 15) | class MCPToolFunction:
    method __init__ (line 27) | def __init__(
    method __call__ (line 82) | async def __call__(

FILE: src/agentscope/mcp/_stateful_client_base.py
  class StatefulClientBase (line 16) | class StatefulClientBase(MCPClientBase, ABC):
    method __init__ (line 27) | def __init__(self, name: str) -> None:
    method connect (line 46) | async def connect(self) -> None:
    method close (line 72) | async def close(self, ignore_errors: bool = True) -> None:
    method list_tools (line 97) | async def list_tools(self) -> List[mcp.types.Tool]:
    method get_callable_function (line 112) | async def get_callable_function(
    method _validate_connection (line 164) | def _validate_connection(self) -> None:

FILE: src/agentscope/mcp/_stdio_stateful_client.py
  class StdIOStatefulClient (line 11) | class StdIOStatefulClient(StatefulClientBase):
    method __init__ (line 31) | def __init__(

FILE: src/agentscope/memory/_long_term_memory/_long_term_memory_base.py
  class LongTermMemoryBase (line 11) | class LongTermMemoryBase(StateModule):
    method record (line 24) | async def record(
    method retrieve (line 35) | async def retrieve(
    method record_to_memory (line 48) | async def record_to_memory(
    method retrieve_from_memory (line 69) | async def retrieve_from_memory(

FILE: src/agentscope/memory/_long_term_memory/_mem0/_mem0_long_term_memory.py
  function _create_agentscope_config_classes (line 30) | def _create_agentscope_config_classes() -> tuple:
  class Mem0LongTermMemory (line 72) | class Mem0LongTermMemory(LongTermMemoryBase):
    method _setup_mem0_logging (line 76) | def _setup_mem0_logging(suppress_mem0_logging: bool) -> None:
    method _register_agentscope_providers (line 92) | def _register_agentscope_providers() -> None:
    method _validate_identifiers (line 135) | def _validate_identifiers(
    method _configure_mem0_config (line 161) | def _configure_mem0_config(
    method __init__ (line 263) | def __init__(
    method record_to_memory (line 380) | async def record_to_memory(
    method retrieve_from_memory (line 507) | async def retrieve_from_memory(
    method record (line 573) | async def record(
    method _format_relations (line 620) | def _format_relations(self, result: dict) -> list:
    method _mem0_record (line 642) | async def _mem0_record(
    method retrieve (line 683) | async def retrieve(

FILE: src/agentscope/memory/_long_term_memory/_mem0/_mem0_utils.py
  class _EventLoopManager (line 21) | class _EventLoopManager:
    method __init__ (line 32) | def __init__(self) -> None:
    method get_loop (line 42) | def get_loop(self) -> asyncio.AbstractEventLoop:
    method cleanup (line 88) | def cleanup(self) -> None:
  function _run_async_in_persistent_loop (line 109) | def _run_async_in_persistent_loop(coro: Coroutine) -> Any:
  class AgentScopeLLM (line 133) | class AgentScopeLLM(LLMBase):
    method __init__ (line 140) | def __init__(self, config: BaseLlmConfig | None = None):
    method _parse_response (line 157) | def _parse_response(
    method generate_response (line 208) | def generate_response(
  class AgentScopeEmbedding (line 284) | class AgentScopeEmbedding(EmbeddingBase):
    method __init__ (line 291) | def __init__(self, config: BaseEmbedderConfig | None = None):
    method embed (line 310) | def embed(

FILE: src/agentscope/memory/_long_term_memory/_reme/_reme_long_term_memory_base.py
  class ReMeLongTermMemoryBase (line 77) | class ReMeLongTermMemoryBase(LongTermMemoryBase, metaclass=ABCMeta):
    method __init__ (line 94) | def __init__(
    method __aenter__ (line 287) | async def __aenter__(self) -> "ReMeLongTermMemoryBase":
    method __aexit__ (line 321) | async def __aexit__(

FILE: src/agentscope/memory/_long_term_memory/_reme/_reme_personal_long_term_memory.py
  class ReMePersonalLongTermMemory (line 17) | class ReMePersonalLongTermMemory(ReMeLongTermMemoryBase):
    method record_to_memory (line 20) | async def record_to_memory(
    method retrieve_from_memory (line 155) | async def retrieve_from_memory(
    method record (line 253) | async def record(
    method retrieve (line 332) | async def retrieve(

FILE: src/agentscope/memory/_long_term_memory/_reme/_reme_task_long_term_memory.py
  class ReMeTaskLongTermMemory (line 17) | class ReMeTaskLongTermMemory(ReMeLongTermMemoryBase):
    method record_to_memory (line 25) | async def record_to_memory(
    method retrieve_from_memory (line 156) | async def retrieve_from_memory(
    method record (line 266) | async def record(
    method retrieve (line 356) | async def retrieve(

FILE: src/agentscope/memory/_long_term_memory/_reme/_reme_tool_long_term_memory.py
  class ReMeToolLongTermMemory (line 17) | class ReMeToolLongTermMemory(ReMeLongTermMemoryBase):
    method record_to_memory (line 25) | async def record_to_memory(
    method retrieve_from_memory (line 175) | async def retrieve_from_memory(
    method _extract_content_from_messages (line 279) | def _extract_content_from_messages(self, msg_list: list[Msg]) -> list[...
    method _extract_text_from_blocks (line 300) | def _extract_text_from_blocks(self, blocks: list) -> list[str]:
    method _parse_tool_call_results (line 319) | def _parse_tool_call_results(
    method record (line 353) | async def record(
    method _extract_tool_names_from_message (line 434) | def _extract_tool_names_from_message(self, msg: Msg) -> str:
    method _format_retrieve_result (line 457) | def _format_retrieve_result(self, result: Any) -> str:
    method retrieve (line 474) | async def retrieve(

FILE: src/agentscope/memory/_working_memory/_base.py
  class MemoryBase (line 11) | class MemoryBase(StateModule):
    method __init__ (line 14) | def __init__(self) -> None:
    method update_compressed_summary (line 22) | async def update_compressed_summary(self, summary: str) -> None:
    method add (line 32) | async def add(
    method delete (line 50) | async def delete(
    method delete_by_mark (line 66) | async def delete_by_mark(
    method size (line 92) | async def size(self) -> int:
    method clear (line 101) | async def clear(self) -> None:
    method get_memory (line 105) | async def get_memory(
    method update_messages_mark (line 134) | async def update_messages_mark(

FILE: src/agentscope/memory/_working_memory/_in_memory_memory.py
  class InMemoryMemory (line 10) | class InMemoryMemory(MemoryBase):
    method __init__ (line 13) | def __init__(self) -> None:
    method get_memory (line 22) | async def get_memory(
    method add (line 93) | async def add(
    method delete (line 137) | async def delete(
    method delete_by_mark (line 160) | async def delete_by_mark(
    method clear (line 199) | async def clear(self) -> None:
    method size (line 203) | async def size(self) -> int:
    method update_messages_mark (line 212) | async def update_messages_mark(
    method state_dict (line 273) | def state_dict(self) -> dict:
    method load_state_dict (line 280) | def load_state_dict(self, state_dict: dict, strict: bool = True) -> None:

FILE: src/agentscope/memory/_working_memory/_redis_memory.py
  class RedisMemory (line 16) | class RedisMemory(MemoryBase):
    method __init__ (line 65) | def __init__(
    method get_client (line 136) | def get_client(self) -> Redis:
    method _decode_if_bytes (line 145) | def _decode_if_bytes(self, data: Any) -> Any:
    method _decode_list (line 161) | def _decode_list(self, data_list: list) -> list:
    method _get_session_key (line 174) | def _get_session_key(self) -> str:
    method _get_session_pattern (line 186) | def _get_session_pattern(self) -> str:
    method _get_mark_key (line 198) | def _get_mark_key(self, mark: str) -> str:
    method _get_mark_pattern (line 215) | def _get_mark_pattern(self) -> str:
    method _get_marks_index_key (line 228) | def _get_marks_index_key(self) -> str:
    method _extract_mark_from_key (line 240) | def _extract_mark_from_key(self, mark_key: str) -> str:
    method _get_message_key (line 260) | def _get_message_key(self, msg_id: str) -> str:
    method _refresh_session_ttl (line 277) | async def _refresh_session_ttl(
    method _scan_and_migrate_marks (line 315) | async def _scan_and_migrate_marks(self) -> list[str]:
    method _get_all_mark_keys (line 349) | async def _get_all_mark_keys(self) -> list[str]:
    method get_memory (line 379) | async def get_memory(
    method add (line 471) | async def add(
    method delete (line 556) | async def delete(
    method delete_by_mark (line 608) | async def delete_by_mark(
    method clear (line 653) | async def clear(self) -> None:
    method size (line 679) | async def size(self) -> int:
    method update_messages_mark (line 690) | async def update_messages_mark(
    method close (line 790) | async def close(self, close_connection_pool: bool | None = None) -> None:
    method __aenter__ (line 802) | async def __aenter__(self) -> "RedisMemory":
    method __aexit__ (line 811) | async def __aexit__(

FILE: src/agentscope/memory/_working_memory/_sqlalchemy_memory.py
  class AsyncSQLAlchemyMemory (line 30) | class AsyncSQLAlchemyMemory(MemoryBase):
    class MessageTable (line 42) | class MessageTable(Base):
    class MessageMarkTable (line 72) | class MessageMarkTable(Base):
    class SessionTable (line 88) | class SessionTable(Base):
    class UserTable (line 106) | class UserTable(Base):
    method __init__ (line 118) | def __init__(
    method _make_message_id (line 170) | def _make_message_id(self, msg_id: str) -> str:
    method session (line 185) | def session(self) -> AsyncSession:
    method _create_table (line 210) | async def _create_table(self) -> None:
    method get_memory (line 263) | async def get_memory(
    method add (line 365) | async def add(
    method _get_next_index (line 491) | async def _get_next_index(self) -> int:
    method size (line 507) | async def size(self) -> int:
    method clear (line 516) | async def clear(self) -> None:
    method delete_by_mark (line 538) | async def delete_by_mark(
    method delete (line 596) | async def delete(
    method update_messages_mark (line 644) | async def update_messages_mark(
    method _replace_message_mark (line 747) | async def _replace_message_mark(
    method _add_message_mark (line 780) | async def _add_message_mark(self, msg_ids: list[str], mark: str) -> int:
    method _remove_message_mark (line 808) | async def _remove_message_mark(
    method close (line 840) | async def close(self) -> None:
    method __aenter__ (line 848) | async def __aenter__(self) -> "AsyncSQLAlchemyMemory":
    method __aexit__ (line 857) | async def __aexit__(

FILE: src/agentscope/message/_message_base.py
  class Msg (line 21) | class Msg:
    method __init__ (line 24) | def __init__(
    method to_dict (line 75) | def to_dict(self) -> dict:
    method from_dict (line 87) | def from_dict(cls, json_data: dict) -> "Msg":
    method has_content_blocks (line 101) | def has_content_blocks(
    method get_text_content (line 123) | def get_text_content(self, separator: str = "\n") -> str | None:
    method get_content_blocks (line 150) | def get_content_blocks(
    method get_content_blocks (line 157) | def get_content_blocks(
    method get_content_blocks (line 164) | def get_content_blocks(
    method get_content_blocks (line 171) | def get_content_blocks(
    method get_content_blocks (line 178) | def get_content_blocks(
    method get_content_blocks (line 185) | def get_content_blocks(
    method get_content_blocks (line 192) | def get_content_blocks(
    method get_content_blocks (line 198) | def get_content_blocks(
    method __repr__ (line 231) | def __repr__(self) -> str:

FILE: src/agentscope/message/_message_block.py
  class TextBlock (line 9) | class TextBlock(TypedDict, total=False):
  class ThinkingBlock (line 18) | class ThinkingBlock(TypedDict, total=False):
  class Base64Source (line 26) | class Base64Source(TypedDict, total=False):
  class URLSource (line 39) | class URLSource(TypedDict, total=False):
  class ImageBlock (line 49) | class ImageBlock(TypedDict, total=False):
  class AudioBlock (line 59) | class AudioBlock(TypedDict, total=False):
  class VideoBlock (line 69) | class VideoBlock(TypedDict, total=False):
  class ToolUseBlock (line 79) | class ToolUseBlock(TypedDict, total=False):
  class ToolResultBlock (line 94) | class ToolResultBlock(TypedDict, total=False):

FILE: src/agentscope/model/_anthropic_model.py
  class AnthropicChatModel (line 40) | class AnthropicChatModel(ChatModelBase):
    method __init__ (line 43) | def __init__(
    method __call__ (line 137) | async def __call__(
    method _parse_anthropic_completion_response (line 275) | async def _parse_anthropic_completion_response(
    method _parse_anthropic_stream_completion_response (line 359) | async def _parse_anthropic_stream_completion_response(
    method _format_tools_json_schemas (line 534) | def _format_tools_json_schemas(
    method _format_tool_choice (line 561) | def _format_tool_choice(

FILE: src/agentscope/model/_dashscope_model.py
  class DashScopeChatModel (line 50) | class DashScopeChatModel(ChatModelBase):
    method __init__ (line 72) | def __init__(
    method __call__ (line 162) | async def __call__(
    method _parse_dashscope_stream_response (line 300) | async def _parse_dashscope_stream_response(
    method _parse_dashscope_generation_response (line 482) | async def _parse_dashscope_generation_response(
    method _format_tools_json_schemas (line 585) | def _format_tools_json_schemas(
    method _format_tool_choice (line 610) | def _format_tool_choice(

FILE: src/agentscope/model/_gemini_model.py
  function _flatten_json_schema (line 36) | def _flatten_json_schema(schema: dict) -> dict:
  class GeminiChatModel (line 115) | class GeminiChatModel(ChatModelBase):
    method __init__ (line 118) | def __init__(
    method __call__ (line 202) | async def __call__(
    method _extract_usage (line 306) | def _extract_usage(
    method _parse_gemini_stream_generation_response (line 336) | async def _parse_gemini_stream_generation_response(
    method _parse_gemini_generation_response (line 443) | def _parse_gemini_generation_response(
    method _format_tools_json_schemas (line 536) | def _format_tools_json_schemas(
    method _format_tool_choice (line 625) | def _format_tool_choice(

FILE: src/agentscope/model/_model_base.py
  class ChatModelBase (line 13) | class ChatModelBase:
    method __init__ (line 22) | def __init__(
    method __call__ (line 39) | async def __call__(
    method _validate_tool_choice (line 46) | def _validate_tool_choice(

FILE: src/agentscope/model/_model_response.py
  class ChatResponse (line 20) | class ChatResponse(DictMixin):

FILE: src/agentscope/model/_model_usage.py
  class ChatUsage (line 10) | class ChatUsage(DictMixin):

FILE: src/agentscope/model/_ollama_model.py
  class OllamaChatModel (line 33) | class OllamaChatModel(ChatModelBase):
    method __init__ (line 36) | def __init__(
    method __call__ (line 101) | async def __call__(
    method _parse_ollama_stream_completion_response (line 174) | async def _parse_ollama_stream_completion_response(
    method _parse_ollama_completion_response (line 274) | async def _parse_ollama_completion_response(
    method _format_tools_json_schemas (line 350) | def _format_tools_json_schemas(

FILE: src/agentscope/model/_openai_model.py
  function _format_audio_data_for_qwen_omni (line 43) | def _format_audio_data_for_qwen_omni(messages: list[dict]) -> None:
  class OpenAIChatModel (line 68) | class OpenAIChatModel(ChatModelBase):
    method __init__ (line 71) | def __init__(
    method __call__ (line 172) | async def __call__(
    method _parse_openai_stream_response (line 308) | async def _parse_openai_stream_response(
    method _parse_openai_completion_response (line 516) | def _parse_openai_completion_response(
    method _format_tools_json_schemas (line 626) | def _format_tools_json_schemas(
    method _format_tool_choice (line 633) | def _format_tool_choice(

FILE: src/agentscope/model/_trinity_model.py
  class TrinityChatModel (line 21) | class TrinityChatModel(OpenAIChatModel):
    method __init__ (line 24) | def __init__(

FILE: src/agentscope/module/_state_module.py
  class _JSONSerializeFunction (line 13) | class _JSONSerializeFunction:
  class StateModule (line 20) | class StateModule:
    method __init__ (line 24) | def __init__(self) -> None:
    method __setattr__ (line 29) | def __setattr__(self, key: str, value: Any) -> None:
    method __delattr__ (line 41) | def __delattr__(self, key: str) -> None:
    method state_dict (line 49) | def state_dict(self) -> dict:
    method load_state_dict (line 74) | def load_state_dict(self, state_dict: dict, strict: bool = True) -> None:
    method register_state (line 108) | def register_state(

FILE: src/agentscope/pipeline/_chat_room.py
  class ChatRoom (line 10) | class ChatRoom:
    method __init__ (line 15) | def __init__(self, agents: list[RealtimeAgent]) -> None:
    method start (line 30) | async def start(self, outgoing_queue: Queue) -> None:
    method _forward_loop (line 45) | async def _forward_loop(self, outgoing_queue: Queue) -> None:
    method stop (line 79) | async def stop(self) -> None:
    method handle_input (line 89) | async def handle_input(self, event: ClientEvents.EventBase) -> None:

FILE: src/agentscope/pipeline/_class.py
  class SequentialPipeline (line 10) | class SequentialPipeline:
    method __init__ (line 15) | def __init__(
    method __call__ (line 27) | async def __call__(
  class FanoutPipeline (line 43) | class FanoutPipeline:
    method __init__ (line 48) | def __init__(
    method __call__ (line 66) | async def __call__(

FILE: src/agentscope/pipeline/_functional.py
  function sequential_pipeline (line 10) | async def sequential_pipeline(
  function fanout_pipeline (line 47) | async def fanout_pipeline(
  function stream_printing_messages (line 107) | async def stream_printing_messages(

FILE: src/agentscope/pipeline/_msghub.py
  class MsgHub (line 14) | class MsgHub:
    method __init__ (line 42) | def __init__(
    method __aenter__ (line 73) | async def __aenter__(self) -> "MsgHub":
    method __aexit__ (line 83) | async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
    method _reset_subscriber (line 89) | def _reset_subscriber(self) -> None:
    method add (line 95) | def add(
    method delete (line 109) | def delete(
    method broadcast (line 130) | async def broadcast(self, msg: list[Msg] | Msg) -> None:
    method set_auto_broadcast (line 140) | def set_auto_broadcast(self, enable: bool) -> None:

FILE: src/agentscope/plan/_in_memory_storage.py
  class InMemoryPlanStorage (line 9) | class InMemoryPlanStorage(PlanStorageBase):
    method __init__ (line 12) | def __init__(self) -> None:
    method add_plan (line 26) | async def add_plan(self, plan: Plan, override: bool = True) -> None:
    method delete_plan (line 41) | async def delete_plan(self, plan_id: str) -> None:
    method get_plans (line 50) | async def get_plans(self) -> list[Plan]:
    method get_plan (line 59) | async def get_plan(self, plan_id: str) -> Plan | None:

FILE: src/agentscope/plan/_plan_model.py
  class SubTask (line 11) | class SubTask(BaseModel):
    method finish (line 52) | def finish(self, outcome: str) -> None:
    method to_oneline_markdown (line 58) | def to_oneline_markdown(self) -> str:
    method to_markdown (line 68) | def to_markdown(self, detailed: bool = False) -> str:
  class Plan (line 104) | class Plan(BaseModel):
    method refresh_plan_state (line 148) | def refresh_plan_state(self) -> str:
    method finish (line 169) | def finish(
    method to_markdown (line 179) | def to_markdown(self, detailed: bool = False) -> str:

FILE: src/agentscope/plan/_plan_notebook.py
  class DefaultPlanToHint (line 16) | class DefaultPlanToHint:
    method __call__ (line 101) | def __call__(self, plan: Plan | None) -> str | None:
  class PlanNotebook (line 172) | class PlanNotebook(StateModule):
    method __init__ (line 195) | def __init__(
    method create_plan (line 232) | async def create_plan(
    method _validate_current_plan (line 295) | def _validate_current_plan(self) -> None:
    method revise_current_plan (line 303) | async def revise_current_plan(
    method update_subtask_state (line 433) | async def update_subtask_state(
    method finish_subtask (line 548) | async def finish_subtask(
    method view_subtasks (line 653) | async def view_subtasks(self, subtask_idx: list[int]) -> ToolResponse:
    method finish_plan (line 694) | async def finish_plan(
    method view_historical_plans (line 739) | async def view_historical_plans(self) -> ToolResponse:
    method recover_historical_plan (line 762) | async def recover_historical_plan(self, plan_id: str) -> ToolResponse:
    method list_tools (line 821) | def list_tools(
    method get_current_hint (line 845) | async def get_current_hint(self) -> Msg | None:
    method register_plan_change_hook (line 866) | def register_plan_change_hook(
    method remove_plan_change_hook (line 885) | def remove_plan_change_hook(self, hook_name: str) -> None:
    method _trigger_plan_change_hooks (line 897) | async def _trigger_plan_change_hooks(self) -> None:

FILE: src/agentscope/plan/_storage_base.py
  class PlanStorageBase (line 9) | class PlanStorageBase(StateModule):
    method add_plan (line 13) | async def add_plan(self, plan: Plan) -> None:
    method delete_plan (line 17) | async def delete_plan(self, plan_id: str) -> None:
    method get_plans (line 21) | async def get_plans(self) -> list[Plan]:
    method get_plan (line 25) | async def get_plan(self, plan_id: str) -> Plan | None:

FILE: src/agentscope/rag/_document.py
  class DocMetadata (line 18) | class DocMetadata(DictMixin):
  class Document (line 35) | class Document:

FILE: src/agentscope/rag/_knowledge_base.py
  class KnowledgeBase (line 13) | class KnowledgeBase:
    method __init__ (line 28) | def __init__(
    method retrieve (line 38) | async def retrieve(
    method add_documents (line 61) | async def add_documents(
    method retrieve_knowledge (line 77) | async def retrieve_knowledge(

FILE: src/agentscope/rag/_reader/_excel_reader.py
  function _get_excel_column_name (line 17) | def _get_excel_column_name(col_index: int) -> str:
  function _extract_table_data (line 38) | def _extract_table_data(df: Any) -> list[list[str]]:
  function _extract_images_from_worksheet (line 69) | def _extract_images_from_worksheet(
  class ExcelReader (line 120) | class ExcelReader(ReaderBase):
    method __init__ (line 162) | def __init__(
    method _validate_init_params (line 226) | def _validate_init_params(self, chunk_size: int, split_by: str) -> None:
    method __call__ (line 246) | async def __call__(
    method _process_sheets_merged (line 323) | async def _process_sheets_merged(
    method _process_sheets_separately (line 358) | async def _process_sheets_separately(
    method _get_sheet_blocks (line 392) | def _get_sheet_blocks(
    method _blocks_to_documents (line 499) | async def _blocks_to_documents(
    method _table_to_markdown (line 548) | def _table_to_markdown(
    method _table_to_json (line 621) | def _table_to_json(
    method get_doc_id (line 662) | def get_doc_id(self, excel_path: str) -> str:

FILE: src/agentscope/rag/_reader/_image_reader.py
  class ImageReader (line 10) | class ImageReader(ReaderBase):
    method __call__ (line 16) | async def __call__(self, image_url: str | list[str]) -> list[Document]:
    method get_doc_id (line 56) | def get_doc_id(self, image_path: str) -> str:

FILE: src/agentscope/rag/_reader/_pdf_reader.py
  class PDFReader (line 11) | class PDFReader(ReaderBase):
    method __init__ (line 14) | def __init__(
    method __call__ (line 50) | async def __call__(
    method get_doc_id (line 83) | def get_doc_id(self, pdf_path: str) -> str:

FILE: src/agentscope/rag/_reader/_ppt_reader.py
  function _extract_table_data (line 19) | def _extract_table_data(table: Any) -> list[list[str]]:
  function _extract_images_from_shape (line 44) | def _extract_images_from_shape(shape: Any) -> list[ImageBlock]:
  class PowerPointReader (line 92) | class PowerPointReader(ReaderBase):
    method __init__ (line 100) | def __init__(
    method _validate_init_params (line 167) | def _validate_init_params(self, chunk_size: int, split_by: str) -> None:
    method __call__ (line 187) | async def __call__(
    method _process_slides_merged (line 224) | async def _process_slides_merged(
    method _process_slides_separately (line 252) | async def _process_slides_separately(
    method _get_slide_blocks (line 279) | def _get_slide_blocks(
    method _get_slide_header (line 317) | def _get_slide_header(self, slide_idx: int) -> str:
    method _process_shape (line 332) | def _process_shape(
    method _add_slide_suffix (line 388) | def _add_slide_suffix(
    method _extract_shape_content (line 422) | def _extract_shape_content(
    method _add_table_block (line 481) | def _add_table_block(
    method _add_text_block (line 524) | def _add_text_block(
    method _blocks_to_documents (line 566) | async def _blocks_to_documents(
    method get_doc_id (line 621) | def get_doc_id(self, ppt_path: str) -> str:

FILE: src/agentscope/rag/_reader/_reader_base.py
  class ReaderBase (line 9) | class ReaderBase:
    method __call__ (line 15) | async def __call__(self, *args: Any, **kwargs: Any) -> list[Document]:
    method get_doc_id (line 20) | def get_doc_id(self, *args: Any, **kwargs: Any) -> str:

FILE: src/agentscope/rag/_reader/_text_reader.py
  class TextReader (line 13) | class TextReader(ReaderBase):
    method __init__ (line 17) | def __init__(
    method __call__ (line 47) | async def __call__(
    method get_doc_id (line 146) | def get_doc_id(self, text: str) -> str:

FILE: src/agentscope/rag/_reader/_utils.py
  function _get_media_type_from_data (line 6) | def _get_media_type_from_data(data: bytes) -> str:
  function _table_to_json (line 39) | def _table_to_json(table_data: list[list[str]]) -> str:
  function _table_to_markdown (line 58) | def _table_to_markdown(table_data: list[list[str]]) -> str:

FILE: src/agentscope/rag/_reader/_word_reader.py
  function _extract_text_from_paragraph (line 29) | def _extract_text_from_paragraph(para: DocxParagraph) -> str:
  function _extract_table_data (line 77) | def _extract_table_data(table: DocxTable) -> list[list[str]]:
  function _extract_image_data (line 122) | def _extract_image_data(para: DocxParagraph) -> list[ImageBlock]:
  class WordReader (line 209) | class WordReader(ReaderBase):
    method __init__ (line 218) | def __init__(
    method __call__ (line 280) | async def __call__(
    method _get_data_blocks (line 337) | def _get_data_blocks(self, word_path: str) -> list[TextBlock | ImageBl...
    method get_doc_id (line 445) | def get_doc_id(self, word_path: str) -> str:

FILE: src/agentscope/rag/_simple_knowledge.py
  class SimpleKnowledge (line 10) | class SimpleKnowledge(KnowledgeBase):
    method retrieve (line 13) | async def retrieve(
    method add_documents (line 54) | async def add_documents(

FILE: src/agentscope/rag/_store/_alibabacloud_mysql_store.py
  class AlibabaCloudMySQLStore (line 19) | class AlibabaCloudMySQLStore(VDBStoreBase):
    method __init__ (line 37) | def __init__(
    method _get_distance_function (line 112) | def _get_distance_function(self) -> str:
    method _format_vector_for_sql (line 130) | def _format_vector_for_sql(self, vector: list[float]) -> str:
    method _validate_table (line 141) | async def _validate_table(self) -> None:
    method add (line 171) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method search (line 238) | async def search(
    method delete (line 345) | async def delete(
    method get_client (line 380) | def get_client(self) -> MySQLConnection:
    method close (line 390) | def close(self) -> None:
    method __del__ (line 397) | def __del__(self) -> None:

FILE: src/agentscope/rag/_store/_milvuslite_store.py
  class MilvusLiteStore (line 19) | class MilvusLiteStore(VDBStoreBase):
    method __init__ (line 31) | def __init__(
    method _validate_collection (line 86) | async def _validate_collection(self) -> None:
    method add (line 100) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method search (line 150) | async def search(
    method delete (line 221) | async def delete(
    method get_client (line 249) | def get_client(self) -> MilvusClient:

FILE: src/agentscope/rag/_store/_mongodb_store.py
  class MongoDBStore (line 24) | class MongoDBStore(VDBStoreBase):
    method __init__ (line 38) | def __init__(
    method _validate_db_and_collection (line 109) | async def _validate_db_and_collection(self) -> None:
    method _wait_for_index_ready (line 164) | async def _wait_for_index_ready(self, timeout: int = 30) -> None:
    method add (line 193) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method search (line 252) | async def search(
    method delete (line 341) | async def delete(
    method get_client (line 361) | def get_client(self) -> AsyncMongoClient:
    method delete_collection (line 369) | async def delete_collection(self) -> None:
    method delete_database (line 377) | async def delete_database(self) -> None:
    method close (line 386) | async def close(self) -> None:

FILE: src/agentscope/rag/_store/_oceanbase_store.py
  class OceanBaseStore (line 38) | class OceanBaseStore(VDBStoreBase):
    method __init__ (line 54) | def __init__(
    method _get_metric_type (line 115) | def _get_metric_type(self) -> str:
    method _get_search_metric_type (line 119) | def _get_search_metric_type(self) -> str:
    method _validate_collection (line 130) | async def _validate_collection(self) -> None:
    method _create_schema (line 157) | def _create_schema(self) -> Any:
    method _create_index_params (line 202) | def _create_index_params(self) -> Any:
    method _content_to_text (line 218) | def _content_to_text(content: Any) -> str:
    method _normalize_content (line 228) | def _normalize_content(content: Any, fallback_text: str) -> Any:
    method _document_to_dict (line 239) | def _document_to_dict(self, doc: Document) -> dict[str, Any]:
    method add (line 279) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method _extract_distance (line 298) | def _extract_distance(
    method _create_document_from_row (line 309) | def _create_document_from_row(
    method _convert_distance_to_score (line 349) | def _convert_distance_to_score(
    method search (line 371) | async def search(
    method _prepare_output_fields (line 430) | def _prepare_output_fields(
    method _prepare_search_params (line 456) | def _prepare_search_params(
    method _filter_results_by_threshold (line 474) | def _filter_results_by_threshold(
    method delete (line 507) | async def delete(
    method get_client (line 544) | def get_client(self) -> MilvusLikeClient:

FILE: src/agentscope/rag/_store/_qdrant_store.py
  class QdrantStore (line 18) | class QdrantStore(VDBStoreBase):
    method __init__ (line 27) | def __init__(
    method _validate_collection (line 74) | async def _validate_collection(self) -> None:
    method add (line 89) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method search (line 121) | async def search(
    method delete (line 159) | async def delete(self, *args: Any, **kwargs: Any) -> None:
    method get_client (line 165) | def get_client(self) -> AsyncQdrantClient:

FILE: src/agentscope/rag/_store/_store_base.py
  class VDBStoreBase (line 10) | class VDBStoreBase:
    method add (line 15) | async def add(self, documents: list[Document], **kwargs: Any) -> None:
    method delete (line 19) | async def delete(self, *args: Any, **kwargs: Any) -> None:
    method search (line 23) | async def search(
    method get_client (line 43) | def get_client(self) -> Any:

FILE: src/agentscope/realtime/_base.py
  class RealtimeModelBase (line 13) | class RealtimeModelBase:
    method __init__ (line 34) | def __init__(
    method send (line 57) | async def send(
    method connect (line 68) | async def connect(
    method _build_session_config (line 102) | def _build_session_config(
    method disconnect (line 124) | async def disconnect(self) -> None:
    method _receive_model_event_loop (line 134) | async def _receive_model_event_loop(self, outgoing_queue: Queue) -> None:
    method parse_api_message (line 160) | async def parse_api_message(

FILE: src/agentscope/realtime/_dashscope_realtime_model.py
  class DashScopeRealtimeModel (line 15) | class DashScopeRealtimeModel(RealtimeModelBase):
    method __init__ (line 44) | def __init__(
    method _build_session_config (line 96) | def _build_session_config(
    method send (line 133) | async def send(
    method parse_api_message (line 209) | async def parse_api_message(
    method _parse_image_data (line 341) | async def _parse_image_data(self, block: ImageBlock) -> str:
    method _parse_audio_data (line 374) | async def _parse_audio_data(self, block: AudioBlock) -> str:

FILE: src/agentscope/realtime/_events/_client_event.py
  class ClientEventType (line 12) | class ClientEventType(str, Enum):
  class ClientEvents (line 45) | class ClientEvents:
    class EventBase (line 48) | class EventBase(BaseModel):
    class ClientSessionCreateEvent (line 52) | class ClientSessionCreateEvent(EventBase):
    class ClientSessionEndEvent (line 61) | class ClientSessionEndEvent(EventBase):
    class ClientResponseCreateEvent (line 70) | class ClientResponseCreateEvent(EventBase):
    class ClientResponseCancelEvent (line 79) | class ClientResponseCancelEvent(EventBase):
    class ClientImageAppendEvent (line 88) | class ClientImageAppendEvent(EventBase):
    class ClientTextAppendEvent (line 103) | class ClientTextAppendEvent(EventBase):
    class ClientAudioAppendEvent (line 115) | class ClientAudioAppendEvent(EventBase):
    class ClientAudioCommitEvent (line 130) | class ClientAudioCommitEvent(EventBase):
    class ClientToolResultEvent (line 139) | class ClientToolResultEvent(EventBase):
    method from_json (line 170) | def from_json(cls, json_data: dict) -> EventBase:

FILE: src/agentscope/realtime/_events/_model_event.py
  class ModelEventType (line 13) | class ModelEventType(str, Enum):
  class ModelEvents (line 84) | class ModelEvents:
    class EventBase (line 88) | class EventBase(BaseModel):
    class ModelSessionCreatedEvent (line 92) | class ModelSessionCreatedEvent(EventBase):
    class ModelSessionEndedEvent (line 107) | class ModelSessionEndedEvent(EventBase):
    class ModelResponseCreatedEvent (line 125) | class ModelResponseCreatedEvent(EventBase):
    class ModelResponseDoneEvent (line 136) | class ModelResponseDoneEvent(EventBase):
    class ModelResponseAudioDeltaEvent (line 156) | class ModelResponseAudioDeltaEvent(EventBase):
    class ModelResponseAudioDoneEvent (line 176) | class ModelResponseAudioDoneEvent(EventBase):
    class ModelResponseAudioTranscriptDeltaEvent (line 190) | class ModelResponseAudioTranscriptDeltaEvent(EventBase):
    class ModelResponseAudioTranscriptDoneEvent (line 207) | class ModelResponseAudioTranscriptDoneEvent(EventBase):
    class ModelResponseToolUseDeltaEvent (line 221) | class ModelResponseToolUseDeltaEvent(EventBase):
    class ModelResponseToolUseDoneEvent (line 239) | class ModelResponseToolUseDoneEvent(EventBase):
    class ModelInputTranscriptionDeltaEvent (line 256) | class ModelInputTranscriptionDeltaEvent(EventBase):
    class ModelInputTranscriptionDoneEvent (line 270) | class ModelInputTranscriptionDoneEvent(EventBase):
    class ModelInputStartedEvent (line 290) | class ModelInputStartedEvent(EventBase):
    class ModelInputDoneEvent (line 304) | class ModelInputDoneEvent(EventBase):
    class ModelErrorEvent (line 318) | class ModelErrorEvent(EventBase):
    class WebsocketConnectEvent (line 333) | class WebsocketConnectEvent(EventBase):
    class WebsocketDisconnectEvent (line 339) | class WebsocketDisconnectEvent(EventBase):

FILE: src/agentscope/realtime/_events/_server_event.py
  class ServerEventType (line 13) | class ServerEventType(str, Enum):
  class ServerEvents (line 91) | class ServerEvents:
    class EventBase (line 94) | class EventBase(BaseModel):
    class ServerSessionCreatedEvent (line 98) | class ServerSessionCreatedEvent(EventBase):
    class ServerSessionUpdatedEvent (line 109) | class ServerSessionUpdatedEvent(EventBase):
    class ServerSessionEndedEvent (line 120) | class ServerSessionEndedEvent(EventBase):
    class AgentReadyEvent (line 131) | class AgentReadyEvent(EventBase):
    class AgentEndedEvent (line 145) | class AgentEndedEvent(EventBase):
    class AgentResponseCreatedEvent (line 159) | class AgentResponseCreatedEvent(EventBase):
    class AgentResponseDoneEvent (line 176) | class AgentResponseDoneEvent(EventBase):
    class AgentResponseAudioDeltaEvent (line 202) | class AgentResponseAudioDeltaEvent(EventBase):
    class AgentResponseAudioDoneEvent (line 228) | class AgentResponseAudioDoneEvent(EventBase):
    class AgentResponseAudioTranscriptDeltaEvent (line 247) | class AgentResponseAudioTranscriptDeltaEvent(EventBase):
    class AgentResponseAudioTranscriptDoneEvent (line 270) | class AgentResponseAudioTranscriptDoneEvent(EventBase):
    class AgentResponseToolUseDeltaEvent (line 290) | class AgentResponseToolUseDeltaEvent(EventBase):
    class AgentResponseToolUseDoneEvent (line 314) | class AgentResponseToolUseDoneEvent(EventBase):
    class AgentResponseToolResultEvent (line 337) | class AgentResponseToolResultEvent(EventBase):
    class AgentInputTranscriptionDeltaEvent (line 354) | class AgentInputTranscriptionDeltaEvent(EventBase):
    class AgentInputTranscriptionDoneEvent (line 374) | class AgentInputTranscriptionDoneEvent(EventBase):
    class AgentInputStartedEvent (line 400) | class AgentInputStartedEvent(EventBase):
    class AgentInputDoneEvent (line 420) | class AgentInputDoneEvent(EventBase):
    class AgentErrorEvent (line 440) | class AgentErrorEvent(EventBase):
    method from_model_event (line 464) | def from_model_event(

FILE: src/agentscope/realtime/_events/_utils.py
  class AudioFormat (line 6) | class AudioFormat(BaseModel):

FILE: src/agentscope/realtime/_gemini_realtime_model.py
  class GeminiRealtimeModel (line 21) | class GeminiRealtimeModel(RealtimeModelBase):
    method __init__ (line 50) | def __init__(
    method _build_session_config (line 93) | def _build_session_config(
    method _format_toolkit_schema (line 152) | def _format_toolkit_schema(
    method send (line 175) | async def send(
    method parse_api_message (line 251) | async def parse_api_message(
    method _ensure_response_id (line 324) | def _ensure_response_id(self) -> str:
    method _parse_model_turn (line 339) | def _parse_model_turn(
    method _parse_inline_data (line 375) | def _parse_inline_data(
    method _parse_server_content (line 408) | async def _parse_server_content(
    method _parse_tool_call (line 478) | async def _parse_tool_call(
    method _parse_image_data (line 518) | async def _parse_image_data(self, block: ImageBlock) -> str | None:
    method _parse_audio_data (line 553) | async def _parse_audio_data(self, block: AudioBlock) -> str:
    method _parse_text_data (line 586) | async def _parse_text_data(self, block: TextBlock) -> str:
    method _parse_tool_result_data (line 615) | async def _parse_tool_result_data(self, block: ToolResultBlock) -> str:

FILE: src/agentscope/realtime/_openai_realtime_model.py
  class OpenAIRealtimeModel (line 19) | class OpenAIRealtimeModel(RealtimeModelBase):
    method __init__ (line 40) | def __init__(
    method _build_session_config (line 86) | def _build_session_config(
    method _format_toolkit_schema (line 127) | def _format_toolkit_schema(
    method send (line 151) | async def send(
    method parse_api_message (line 218) | async def parse_api_message(
    method _parse_audio_data (line 403) | async def _parse_audio_data(self, block: AudioBlock) -> str:
    method _parse_text_data (line 433) | async def _parse_text_data(self, block: TextBlock) -> str:
    method _parse_tool_result_data (line 463) | async def _parse_tool_result_data(self, block: ToolResultBlock) -> str:

FILE: src/agentscope/session/_json_session.py
  class JSONSession (line 12) | class JSONSession(SessionBase):
    method __init__ (line 15) | def __init__(
    method _get_save_path (line 27) | def _get_save_path(self, session_id: str, user_id: str) -> str:
    method save_session_state (line 47) | async def save_session_state(
    method load_session_state (line 81) | async def load_session_state(

FILE: src/agentscope/session/_redis_session.py
  class RedisSession (line 17) | class RedisSession(SessionBase):
    method __init__ (line 25) | def __init__(
    method get_client (line 81) | def get_client(self) -> Redis:
    method _get_session_key (line 90) | def _get_session_key(
    method save_session_state (line 101) | async def save_session_state(
    method load_session_state (line 129) | async def load_session_state(
    method close (line 180) | async def close(self) -> None:
    method __aenter__ (line 184) | async def __aenter__(self) -> "RedisSession":
    method __aexit__ (line 193) | async def __aexit__(

FILE: src/agentscope/session/_session_base.py
  class SessionBase (line 8) | class SessionBase:
    method save_session_state (line 12) | async def save_session_state(
    method load_session_state (line 30) | async def load_session_state(

FILE: src/agentscope/token/_anthropic_token_counter.py
  class AnthropicTokenCounter (line 7) | class AnthropicTokenCounter(TokenCounterBase):
    method __init__ (line 10) | def __init__(self, model_name: str, api_key: str, **kwargs: Any) -> None:
    method count (line 24) | async def count(

FILE: src/agentscope/token/_char_token_counter.py
  class CharTokenCounter (line 8) | class CharTokenCounter(TokenCounterBase):
    method count (line 17) | async def count(

FILE: src/agentscope/token/_gemini_token_counter.py
  class GeminiTokenCounter (line 8) | class GeminiTokenCounter(TokenCounterBase):
    method __init__ (line 11) | def __init__(self, model_name: str, api_key: str, **kwargs: Any) -> None:
    method count (line 31) | async def count(

FILE: src/agentscope/token/_huggingface_token_counter.py
  class HuggingFaceTokenCounter (line 9) | class HuggingFaceTokenCounter(TokenCounterBase):
    method __init__ (line 12) | def __init__(
    method count (line 65) | async def count(

FILE: src/agentscope/token/_openai_token_counter.py
  function _calculate_tokens_for_high_quality_image (line 18) | def _calculate_tokens_for_high_quality_image(
  function _get_size_of_image_url (line 51) | def _get_size_of_image_url(url: str) -> tuple[int, int]:
  function _get_base_and_tile_tokens (line 82) | def _get_base_and_tile_tokens(model_name: str) -> tuple[int, int]:
  function _calculate_tokens_for_tools (line 121) | def _calculate_tokens_for_tools(
  function _count_content_tokens_for_openai_vision_model (line 177) | def _count_content_tokens_for_openai_vision_model(
  class OpenAITokenCounter (line 297) | class OpenAITokenCounter(TokenCounterBase):
    method __init__ (line 300) | def __init__(self, model_name: str) -> None:
    method count (line 309) | async def count(

FILE: src/agentscope/token/_token_base.py
  class TokenCounterBase (line 7) | class TokenCounterBase:
    method count (line 11) | async def count(

FILE: src/agentscope/tool/_async_wrapper.py
  function _postprocess_tool_response (line 16) | async def _postprocess_tool_response(
  function _object_wrapper (line 38) | async def _object_wrapper(
  function _sync_generator_wrapper (line 50) | async def _sync_generator_wrapper(
  function _async_generator_wrapper (line 63) | async def _async_generator_wrapper(

FILE: src/agentscope/tool/_coding/_python.py
  function execute_python_code (line 17) | async def execute_python_code(

FILE: src/agentscope/tool/_coding/_shell.py
  function execute_shell_command (line 12) | async def execute_shell_command(

FILE: src/agentscope/tool/_multi_modality/_dashscope_tools.py
  function dashscope_text_to_image (line 18) | def dashscope_text_to_image(
  function dashscope_image_to_text (line 117) | def dashscope_image_to_text(
  function dashscope_text_to_audio (line 229) | def dashscope_text_to_audio(

FILE: src/agentscope/tool/_multi_modality/_openai_tools.py
  function _parse_url (line 24) | def _parse_url(url: str) -> BytesIO | IO[bytes]:
  function openai_text_to_image (line 39) | def openai_text_to_image(
  function openai_edit_image (line 180) | def openai_edit_image(
  function openai_create_image_variation (line 320) | def openai_create_image_variation(
  function openai_image_to_text (line 416) | def openai_image_to_text(
  function openai_text_to_audio (line 500) | def openai_text_to_audio(
  function openai_audio_to_text (line 591) | def openai_audio_to_text(

FILE: src/agentscope/tool/_response.py
  class ToolResponse (line 12) | class ToolResponse:

FILE: src/agentscope/tool/_text_file/_utils.py
  function _calculate_view_ranges (line 6) | def _calculate_view_ranges(
  function _assert_ranges (line 36) | def _assert_ranges(
  function _view_text_file (line 62) | def _view_text_file(

FILE: src/agentscope/tool/_text_file/_view_text_file.py
  function view_text_file (line 13) | async def view_text_file(

FILE: src/agentscope/tool/_text_file/_write_text_file.py
  function insert_text_file (line 12) | async def insert_text_file(
  function write_text_file (line 108) | async def write_text_file(

FILE: src/agentscope/tool/_toolkit.py
  function _apply_middlewares (line 57) | def _apply_middlewares(
  class Toolkit (line 117) | class Toolkit(StateModule):
    method __init__ (line 152) | def __init__(
    method create_tool_group (line 182) | def create_tool_group(
    method update_tool_groups (line 217) | def update_tool_groups(self, group_names: list[str], active: bool) -> ...
    method remove_tool_groups (line 236) | def remove_tool_groups(self, group_names: str | list[str]) -> None:
    method register_tool_function (line 269) | def register_tool_function(
    method remove_tool_function (line 523) | def remove_tool_function(
    method get_json_schemas (line 545) | def get_json_schemas(
    method set_extended_model (line 608) | def set_extended_model(
    method remove_mcp_clients (line 636) | async def remove_mcp_clients(
    method call_tool_function (line 674) | async def call_tool_function(
    method register_mcp_client (line 817) | async def register_mcp_client(
    method state_dict (line 957) | def state_dict(self) -> dict[str, Any]:
    method load_state_dict (line 970) | def load_state_dict(
    method get_activated_notes (line 1009) | def get_activated_notes(self) -> str:
    method reset_equipped_tools (line 1027) | def reset_equipped_tools(self, **kwargs: Any) -> ToolResponse:
    method clear (line 1091) | def clear(self) -> None:
    method _validate_tool_function (line 1096) | def _validate_tool_function(self, func_name: str) -> None:
    method register_agent_skill (line 1105) | def register_agent_skill(
    method remove_agent_skill (line 1173) | def remove_agent_skill(self, name: str) -> None:
    method get_agent_skill_prompt (line 1188) | def get_agent_skill_prompt(self) -> str | None:
    method register_middleware (line 1218) | def register_middleware(

FILE: src/agentscope/tool/_types.py
  class RegisteredToolFunction (line 16) | class RegisteredToolFunction:
    method extended_json_schema (line 59) | def extended_json_schema(self) -> dict:
  class ToolGroup (line 132) | class ToolGroup:
  class AgentSkill (line 148) | class AgentSkill(TypedDict):

FILE: src/agentscope/tracing/_attributes.py
  class SpanAttributes (line 8) | class SpanAttributes:
  class OperationNameValues (line 131) | class OperationNameValues:
  class ProviderNameValues (line 153) | class ProviderNameValues:

FILE: src/agentscope/tracing/_converter.py
  function _convert_media_block (line 11) | def _convert_media_block(
  function _convert_block_to_part (line 57) | def _convert_block_to_part(block: ContentBlock) -> Dict[str, Any] | None:

FILE: src/agentscope/tracing/_extractor.py
  function _get_common_attributes (line 52) | def _get_common_attributes() -> Dict[str, str]:
  function _get_format_target (line 66) | def _get_format_target(instance: Any) -> str:
  function _get_provider_name (line 88) | def _get_provider_name(instance: ChatModelBase) -> str:
  function _get_tool_definitions (line 136) | def _get_tool_definitions(
  function _get_llm_request_attributes (line 198) | def _get_llm_request_attributes(
  function _get_llm_span_name (line 270) | def _get_llm_span_name(attributes: Dict[str, str]) -> str:
  function _get_llm_output_messages (line 289) | def _get_llm_output_messages(
  function _get_llm_response_attributes (line 346) | def _get_llm_response_attributes(
  function _get_agent_messages (line 394) | def _get_agent_messages(
  function _get_agent_request_attributes (line 447) | def _get_agent_request_attributes(
  function _get_agent_span_name (line 507) | def _get_agent_span_name(attributes: Dict[str, str]) -> str:
  function _get_agent_response_attributes (line 526) | def _get_agent_response_attributes(
  function _get_tool_request_attributes (line 552) | def _get_tool_request_attributes(
  function _get_tool_span_name (line 609) | def _get_tool_span_name(attributes: Dict[str, str]) -> str:
  function _get_tool_response_attributes (line 628) | def _get_tool_response_attributes(
  function _get_formatter_request_attributes (line 655) | def _get_formatter_request_attributes(
  function _get_formatter_span_name (line 691) | def _get_formatter_span_name(attributes: Dict[str, str]) -> str:
  function _get_formatter_response_attributes (line 710) | def _get_formatter_response_attributes(
  function _get_generic_function_request_attributes (line 734) | def _get_generic_function_request_attributes(
  function _get_generic_function_span_name (line 771) | def _get_generic_function_span_name(attributes: Dict[str, str]) -> str:
  function _get_generic_function_response_attributes (line 790) | def _get_generic_function_response_attributes(
  function _get_embedding_request_attributes (line 811) | def _get_embedding_request_attributes(
  function _get_embedding_span_name (line 855) | def _get_embedding_span_name(attributes: Dict[str, str]) -> str:
  function _get_embedding_response_attributes (line 874) | def _get_embedding_response_attributes(

FILE: src/agentscope/tracing/_setup.py
  function setup_tracing (line 11) | def setup_tracing(endpoint: str) -> None:
  function _get_tracer (line 41) | def _get_tracer() -> Tracer:

FILE: src/agentscope/tracing/_trace.py
  function _check_tracing_enabled (line 69) | def _check_tracing_enabled() -> bool:
  function _set_span_success_status (line 80) | def _set_span_success_status(span: Span) -> None:
  function _set_span_error_status (line 92) | def _set_span_error_status(span: Span, e: Exception) -> None:
  function _trace_sync_generator_wrapper (line 107) | def _trace_sync_generator_wrapper(
  function _trace_async_generator_wrapper (line 134) | async def _trace_async_generator_wrapper(
  function trace (line 192) | def trace(
  function trace_toolkit (line 322) | def trace_toolkit(
  function trace_reply (line 367) | def trace_reply(
  function trace_embedding (line 436) | def trace_embedding(
  function trace_format (line 496) | def trace_format(
  function trace_llm (line 567) | def trace_llm(

FILE: src/agentscope/tracing/_utils.py
  function _to_serializable (line 15) | def _to_serializable(
  function _serialize_to_str (line 60) | def _serialize_to_str(value: Any) -> str:

FILE: src/agentscope/tts/_dashscope_cosyvoice_realtime_tts_model.py
  class DashScopeCosyVoiceRealtimeTTSModel (line 13) | class DashScopeCosyVoiceRealtimeTTSModel(TTSModelBase):
    method __init__ (line 31) | def __init__(
    method connect (line 127) | async def connect(self) -> None:
    method close (line 140) | async def close(self) -> None:
    method push (line 144) | async def push(
    method synthesize (line 215) | async def synthesize(

FILE: src/agentscope/tts/_dashscope_cosyvoice_tts_model.py
  class DashScopeCosyVoiceTTSModel (line 14) | class DashScopeCosyVoiceTTSModel(TTSModelBase):
    method __init__ (line 29) | def __init__(
    method _create_synthesizer (line 84) | def _create_synthesizer(self) -> tuple:
    method push (line 100) | async def push(self, msg: Msg, **kwargs: Any) -> TTSResponse:
    method synthesize (line 115) | async def synthesize(

FILE: src/agentscope/tts/_dashscope_realtime_tts_model.py
  function _get_qwen_tts_realtime_callback_class (line 24) | def _get_qwen_tts_realtime_callback_class() -> type["QwenTtsRealtimeCall...
  class DashScopeRealtimeTTSModel (line 170) | class DashScopeRealtimeTTSModel(TTSModelBase):
    method __init__ (line 188) | def __init__(
    method connect (line 278) | async def connect(self) -> None:
    method close (line 294) | async def close(self) -> None:
    method push (line 304) | async def push(
    method synthesize (line 379) | async def synthesize(

FILE: src/agentscope/tts/_dashscope_tts_model.py
  class DashScopeTTSModel (line 28) | class DashScopeTTSModel(TTSModelBase):
    method __init__ (line 37) | def __init__(
    method synthesize (line 78) | async def synthesize(
    method _parse_into_async_generator (line 137) | async def _parse_into_async_generator(

FILE: src/agentscope/tts/_gemini_tts_model.py
  class GeminiTTSModel (line 19) | class GeminiTTSModel(TTSModelBase):
    method __init__ (line 28) | def __init__(
    method synthesize (line 79) | async def synthesize(
    method _parse_into_async_generator (line 175) | async def _parse_into_async_generator(

FILE: src/agentscope/tts/_openai_tts_model.py
  class OpenAITTSModel (line 17) | class OpenAITTSModel(TTSModelBase):
    method __init__ (line 26) | def __init__(
    method synthesize (line 76) | async def synthesize(
    method _parse_into_async_generator (line 139) | async def _parse_into_async_generator(

FILE: src/agentscope/tts/_tts_base.py
  class TTSModelBase (line 12) | class TTSModelBase(ABC):
    method __init__ (line 40) | def __init__(self, model_name: str, stream: bool) -> None:
    method __aenter__ (line 52) | async def __aenter__(self) -> "TTSModelBase":
    method __aexit__ (line 60) | async def __aexit__(
    method connect (line 70) | async def connect(self) -> None:
    method close (line 82) | async def close(self) -> None:
    method push (line 94) | async def push(
    method synthesize (line 125) | async def synthesize(

FILE: src/agentscope/tts/_tts_response.py
  class TTSUsage (line 14) | class TTSUsage(DictMixin):
  class TTSResponse (line 31) | class TTSResponse(DictMixin):

FILE: src/agentscope/tts/_utils.py
  function _get_cosyvoice_callback_class (line 18) | def _get_cosyvoice_callback_class() -> type["ResultCallback"]:

FILE: src/agentscope/tuner/_algorithm.py
  class AlgorithmConfig (line 7) | class AlgorithmConfig(BaseModel):

FILE: src/agentscope/tuner/_config.py
  function _set_if_not_none (line 14) | def _set_if_not_none(obj: Any, field: str, value: Any) -> None:
  function _to_trinity_config (line 20) | def _to_trinity_config(
  function _load_config_from_path_or_default (line 124) | def _load_config_from_path_or_default(
  function check_workflow_function (line 184) | def check_workflow_function(
  function check_judge_function (line 201) | def check_judge_function(
  function _check_function_signature (line 218) | def _check_function_signature(

FILE: src/agentscope/tuner/_dataset.py
  class DatasetConfig (line 8) | class DatasetConfig(BaseModel):
    method preview (line 38) | def preview(self, n: int = 5) -> List:

FILE: src/agentscope/tuner/_judge.py
  class JudgeOutput (line 9) | class JudgeOutput(BaseModel):

FILE: src/agentscope/tuner/_model.py
  class TunerModelConfig (line 8) | class TunerModelConfig(BaseModel):
    method get_config (line 78) | def get_config(self) -> Dict[str, Any]:
  class TinkerConfig (line 96) | class TinkerConfig(BaseModel):
    method get_config (line 135) | def get_config(self) -> Dict[str, Any]:

FILE: src/agentscope/tuner/_tune.py
  function tune (line 16) | def tune(

FILE: src/agentscope/tuner/_workflow.py
  class WorkflowOutput (line 9) | class WorkflowOutput(BaseModel):

FILE: tests/a2a_agent_test.py
  class MockA2AClient (line 24) | class MockA2AClient:
    method __init__ (line 27) | def __init__(self, response_type: str = "message") -> None:
    method send_message (line 37) | async def send_message(
  class MockClientFactory (line 87) | class MockClientFactory:
    method __init__ (line 90) | def __init__(self, response_type: str = "message") -> None:
    method create (line 95) | def create(self, card: AgentCard) -> MockA2AClient:
  class A2AAgentTest (line 103) | class A2AAgentTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 106) | async def asyncSetUp(self) -> None:
    method test_reply_with_task (line 120) | async def test_reply_with_task(self) -> None:
    method test_reply_with_no_messages (line 149) | async def test_reply_with_no_messages(self) -> None:
    method test_observe_method (line 191) | async def test_observe_method(self) -> None:
    method test_observe_and_reply_merge (line 212) | async def test_observe_and_reply_merge(self) -> None:
    method test_reply_with_only_observed_messages (line 234) | async def test_reply_with_only_observed_messages(self) -> None:

FILE: tests/a2a_resolver_test.py
  class A2AAgentCardResolverTest (line 12) | class A2AAgentCardResolverTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 15) | async def asyncSetUp(self) -> None:
    method test_file_card_resolver (line 53) | async def test_file_card_resolver(self) -> None:

FILE: tests/config_test.py
  function async_task (line 14) | async def async_task(field: str) -> str:
  function sync_task (line 32) | def sync_task(field: str) -> None:
  class ConfigTest (line 50) | class ConfigTest(IsolatedAsyncioTestCase):
    method test_config_attributes (line 53) | async def test_config_attributes(self) -> None:

FILE: tests/embedding_cache_test.py
  class EmbeddingCacheTest (line 13) | class EmbeddingCacheTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 16) | async def asyncSetUp(self) -> None:
    method _get_filenames (line 59) | def _get_filenames(self, path_dir: str) -> list[str]:
    method test_embedding_cache (line 70) | async def test_embedding_cache(self) -> None:
    method asyncTearDown (line 165) | async def asyncTearDown(self) -> None:

FILE: tests/evaluation_test.py
  class CheckEqual (line 53) | class CheckEqual(MetricBase):
    method __init__ (line 56) | def __init__(
    method __call__ (line 68) | async def __call__(
  class ToyBenchmark (line 86) | class ToyBenchmark(BenchmarkBase):
    method __init__ (line 89) | def __init__(self) -> None:
    method _load_data (line 98) | def _load_data() -> list[Task]:
    method __iter__ (line 115) | def __iter__(self) -> Generator[Task, None, None]:
    method __getitem__ (line 120) | def __getitem__(self, index: int) -> Task:
    method __len__ (line 124) | def __len__(self) -> int:
  class EvalTestAgent (line 129) | class EvalTestAgent(AgentBase):
    method __init__ (line 132) | def __init__(self) -> None:
    method reply (line 138) | async def reply(self, msg: Msg) -> Msg:
    method handle_interrupt (line 147) | async def handle_interrupt(
    method observe (line 155) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
  function dummy_solution_generation (line 160) | async def dummy_solution_generation(
  class EvaluatorTest (line 176) | class EvaluatorTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 179) | async def asyncSetUp(self) -> None:
    method test_general_evaluator (line 210) | async def test_general_evaluator(self) -> None:
    method test_ray_evaluator (line 243) | async def test_ray_evaluator(self) -> None:
    method asyncTearDown (line 276) | async def asyncTearDown(self) -> None:

FILE: tests/formatter_a2a_test.py
  class A2AFormatterTest (line 35) | class A2AFormatterTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 38) | async def asyncSetUp(self) -> None:
    method test_as_to_a2a (line 160) | async def test_as_to_a2a(self) -> None:
    method test_a2a_msg_to_as (line 249) | async def test_a2a_msg_to_as(self) -> None:
    method test_a2a_task_to_as (line 300) | async def test_a2a_task_to_as(self) -> None:

FILE: tests/formatter_anthropic_test.py
  class TestAnthropicChatFormatterFormatter (line 19) | class TestAnthropicChatFormatterFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 22) | async def asyncSetUp(self) -> None:
    method test_chat_formatter (line 460) | async def test_chat_formatter(self) -> None:
    method test_multiagent_formater (line 509) | async def test_multiagent_formater(self) -> None:

FILE: tests/formatter_dashscope_test.py
  class TestDashScopeFormatter (line 24) | class TestDashScopeFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 27) | async def asyncSetUp(self) -> None:
    method _mock_save_base64_data (line 482) | def _mock_save_base64_data(
    method test_chat_formatter (line 506) | async def test_chat_formatter(
    method test_chat_formatter_with_extract_media_blocks (line 554) | async def test_chat_formatter_with_extract_media_blocks(
    method test_multiagent_formater (line 680) | async def test_multiagent_formater(
    method test_multiagent_formatter_with_promote_media_tool_result (line 781) | async def test_multiagent_formatter_with_promote_media_tool_result(
    method asyncTearDown (line 905) | async def asyncTearDown(self) -> None:

FILE: tests/formatter_deepseek_test.py
  class TestDeepSeekFormatter (line 18) | class TestDeepSeekFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 21) | async def asyncSetUp(self) -> None:
    method test_chat_formatter (line 335) | async def test_chat_formatter(self) -> None:
    method test_multi_agent_formatter (line 376) | async def test_multi_agent_formatter(

FILE: tests/formatter_gemini_test.py
  class TestGeminiFormatter (line 20) | class TestGeminiFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 23) | async def asyncSetUp(self) -> None:
    method test_chat_formatter (line 580) | async def test_chat_formatter(
    method test_chat_formatter_with_extract_image_blocks (line 625) | async def test_chat_formatter_with_extract_image_blocks(
    method test_multi_agent_formatter (line 771) | async def test_multi_agent_formatter(
    method test_multi_agent_formatter_with_promote_tool_result_images (line 862) | async def test_multi_agent_formatter_with_promote_tool_result_images(
    method asyncTearDown (line 994) | async def asyncTearDown(self) -> None:

FILE: tests/formatter_ollama_test.py
  class TestOllamaFormatter (line 18) | class TestOllamaFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 21) | async def asyncSetUp(self) -> None:
    method test_chat_formatter (line 369) | async def test_chat_formatter(self) -> None:
    method test_chat_formatter_with_extract_image_blocks (line 410) | async def test_chat_formatter_with_extract_image_blocks(
    method test_multi_agent_formatter (line 485) | async def test_multi_agent_formatter(
    method test_multi_agent_formatter_with_promote_tool_result_images (line 574) | async def test_multi_agent_formatter_with_promote_tool_result_images(
    method asyncTearDown (line 653) | async def asyncTearDown(self) -> None:

FILE: tests/formatter_openai_test.py
  class TestOpenAIFormatter (line 21) | class TestOpenAIFormatter(IsolatedAsyncioTestCase):
    method asyncSetUp (line 24) | async def asyncSetUp(self) -> None:
    method test_formatter (line 392) | async def test_formatter(self, mock_save_base64_data: MagicMock) -> None:
    method test_formatter_with_extract_image_blocks (line 436) | async def test_formatter_with_extract_image_blocks(
    method test_multiagent_formatter (line 595) | async def test_multiagent_formatter(
    method test_multiagent_formatter_with_promote_tool_result_images (line 641) | async def test_multiagent_formatter_with_promote_tool_result_images(
    method asyncTearDown (line 773) | async def asyncTearDown(self) -> None:

FILE: tests/hook_test.py
  class MyAgent (line 10) | class MyAgent(AgentBase):
    method __init__ (line 13) | def __init__(self) -> None:
    method reply (line 19) | async def reply(self, msg: Msg) -> Msg:
    method observe (line 31) | async def observe(self, msg: Msg) -> None:
    method handle_interrupt (line 35) | async def handle_interrupt(self, *args: Any, **kwargs: Any) -> Msg:
  class ChildAgent (line 41) | class ChildAgent(MyAgent):
  class GrandChildAgent (line 45) | class GrandChildAgent(ChildAgent):
  class AgentA (line 49) | class AgentA(MyAgent):
  class AgentB (line 53) | class AgentB(MyAgent):
  class AgentC (line 57) | class AgentC(AgentA, AgentB):
  function async_pre_func_w_modifying (line 61) | async def async_pre_func_w_modifying(
  function async_pre_func_wo_modifying (line 78) | async def async_pre_func_wo_modifying(
  function sync_pre_func_w_modifying (line 93) | def sync_pre_func_w_modifying(
  function sync_pre_func_wo_modifying (line 110) | def sync_pre_func_wo_modifying(
  function async_post_func_w_modifying (line 126) | async def async_post_func_w_modifying(
  function async_post_func_wo_modifying (line 143) | async def async_post_func_wo_modifying(
  function sync_post_func_w_modifying (line 159) | def sync_post_func_w_modifying(
  function sync_post_func_wo_modifying (line 176) | def sync_post_func_wo_modifying(
  class HookTest (line 192) | class HookTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 195) | async def asyncSetUp(self) -> None:
    method msg (line 200) | def msg(self) -> Msg:
    method test_reply_hooks (line 208) | async def test_reply_hooks(self) -> None:
    method test_print_hooks (line 528) | async def test_print_hooks(self) -> None:
    method test_observe_hooks (line 561) | async def test_observe_hooks(self) -> None:
    method asyncTearDown (line 778) | async def asyncTearDown(self) -> None:

FILE: tests/mcp_sse_client_test.py
  function tool_1 (line 15) | async def tool_1(arg1: str, arg2: list[int]) -> str:
  function setup_server (line 27) | def setup_server() -> None:
  class SseMCPClientTest (line 34) | class SseMCPClientTest(IsolatedAsyncioTestCase):
    method asyncTearDown (line 37) | async def asyncTearDown(self) -> None:
    method asyncSetUp (line 45) | async def asyncSetUp(self) -> None:
    method test_stateless_client (line 107) | async def test_stateless_client(self) -> None:
    method test_stateful_client (line 256) | async def test_stateful_client(self) -> None:

FILE: tests/mcp_streamable_http_client_test.py
  function tool_1 (line 16) | async def tool_1(arg1: str, arg2: list[int]) -> str:
  function tool_2 (line 28) | async def tool_2() -> list:
  function setup_server (line 44) | def setup_server() -> None:
  class StreamableHttpMCPClientTest (line 54) | class StreamableHttpMCPClientTest(IsolatedAsyncioTestCase):
    method asyncTearDown (line 57) | async def asyncTearDown(self) -> None:
    method asyncSetUp (line 63) | async def asyncSetUp(self) -> None:
    method test_streamable_http_stateless_client (line 70) | async def test_streamable_http_stateless_client(self) -> None:
    method test_embedded_content (line 156) | async def test_embedded_content(self) -> None:

FILE: tests/mem0_utils_test.py
  class OllamaMessageMock (line 20) | class OllamaMessageMock:
    method __init__ (line 23) | def __init__(
  class OllamaResponseMock (line 34) | class OllamaResponseMock:
    method __init__ (line 37) | def __init__(
    method get (line 53) | def get(self, key: str, default: Any | None = None) -> Any:
    method __contains__ (line 57) | def __contains__(self, key: str) -> bool:
  class TestAgentScopeLLMWithOllama (line 62) | class TestAgentScopeLLMWithOllama(IsolatedAsyncioTestCase):
    method test_agentscope_llm_parallel_calls_with_asyncio_gather (line 66) | def test_agentscope_llm_parallel_calls_with_asyncio_gather(self) -> None:
    method test_agentscope_llm_async_gather_in_async_context (line 146) | async def test_agentscope_llm_async_gather_in_async_context(self) -> N...

FILE: tests/memory_compression_test.py
  class MockChatModel (line 14) | class MockChatModel(ChatModelBase):
    method __init__ (line 17) | def __init__(
    method __call__ (line 34) | async def __call__(
  class MockFormatter (line 69) | class MockFormatter(FormatterBase):
    method format (line 72) | async def format(self, msgs: list[Msg], **kwargs: Any) -> list[dict]:
  class MemoryCompressionTest (line 86) | class MemoryCompressionTest(IsolatedAsyncioTestCase):
    method test_no_compression_below_threshold (line 89) | async def test_no_compression_below_threshold(self) -> None:
    method test_compression_above_threshold (line 142) | async def test_compression_above_threshold(self) -> None:

FILE: tests/memory_reme_test.py
  class TestReMeMemory (line 42) | class TestReMeMemory(IsolatedAsyncioTestCase):
    method setUp (line 45) | def setUp(self) -> None:
    method _create_memory_instance (line 71) | def _create_memory_instance(self) -> Any:
    method test_init_with_default_params (line 86) | async def test_init_with_default_params(self) -> None:
    method test_record_to_memory_success (line 99) | async def test_record_to_memory_success(self) -> None:
    method test_record_to_memory_app_not_started (line 194) | async def test_record_to_memory_app_not_started(self) -> None:
    method test_record_to_memory_error_handling (line 208) | async def test_record_to_memory_error_handling(self) -> None:
    method test_retrieve_from_memory_success (line 245) | async def test_retrieve_from_memory_success(self) -> None:
    method test_retrieve_from_memory_no_results (line 337) | async def test_retrieve_from_memory_no_results(self) -> None:
    method test_retrieve_from_memory_app_not_started (line 359) | async def test_retrieve_from_memory_app_not_started(self) -> None:
    method test_record_direct_method_success (line 372) | async def test_record_direct_method_success(self) -> None:
    method test_record_direct_with_single_message (line 431) | async def test_record_direct_with_single_message(self) -> None:
    method test_record_direct_with_empty_list (line 474) | async def test_record_direct_with_empty_list(self) -> None:
    method test_record_direct_filters_none_messages (line 485) | async def test_record_direct_filters_none_messages(self) -> None:
    method test_record_direct_app_not_started (line 552) | async def test_record_direct_app_not_started(self) -> None:
    method test_retrieve_direct_method_success (line 565) | async def test_retrieve_direct_method_success(self) -> None:
    method test_retrieve_direct_with_message_list (line 609) | async def test_retrieve_direct_with_message_list(self) -> None:
    method test_retrieve_direct_with_none_message (line 635) | async def test_retrieve_direct_with_none_message(self) -> None:
    method test_retrieve_direct_invalid_input (line 644) | async def test_retrieve_direct_invalid_input(self) -> None:
    method test_retrieve_direct_app_not_started (line 654) | async def test_retrieve_direct_app_not_started(self) -> None:
    method test_context_manager_usage (line 667) | async def test_context_manager_usage(self) -> None:
    method test_integration_record_and_retrieve (line 688) | async def test_integration_record_and_retrieve(self) -> None:

FILE: tests/memory_test.py
  class ShortTermMemoryTest (line 17) | class ShortTermMemoryTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 29) | async def asyncSetUp(self) -> None:
    method _basic_tests (line 46) | async def _basic_tests(self) -> None:
    method _mark_tests (line 106) | async def _mark_tests(self) -> None:
    method _multi_tenant_tests (line 247) | async def _multi_tenant_tests(self) -> None:
    method _multi_session_tests (line 338) | async def _multi_session_tests(self) -> None:
    method _test_add_duplicated_msgs (line 429) | async def _test_add_duplicated_msgs(self) -> None:
    method _test_delete_nonexistent_msg (line 442) | async def _test_delete_nonexistent_msg(self) -> None:
    method _test_serialization (line 454) | async def _test_serialization(self) -> None:
    method asyncTearDown (line 495) | async def asyncTearDown(self) -> None:
  class InMemoryMemoryTest (line 503) | class InMemoryMemoryTest(ShortTermMemoryTest):
    method asyncSetUp (line 506) | async def asyncSetUp(self) -> None:
    method test_memory (line 511) | async def test_memory(self) -> None:
    method test_serialization (line 518) | async def test_serialization(self) -> None:
  class AsyncSQLAlchemyMemoryTest (line 604) | class AsyncSQLAlchemyMemoryTest(ShortTermMemoryTest):
    method asyncSetUp (line 607) | async def asyncSetUp(self) -> None:
    method test_memory (line 632) | async def test_memory(self) -> None:
    method asyncTearDown (line 642) | async def asyncTearDown(self) -> None:
  class RedisMemoryTest (line 648) | class RedisMemoryTest(ShortTermMemoryTest):
    method asyncSetUp (line 660) | async def asyncSetUp(self) -> None:
    method test_memory (line 691) | async def test_memory(self) -> None:
    method test_ttl (line 701) | async def test_ttl(self) -> None:
  class RedisMemoryTestWithBytes (line 724) | class RedisMemoryTestWithBytes(ShortTermMemoryTest):
    method asyncSetUp (line 736) | async def asyncSetUp(self) -> None:
    method test_memory (line 767) | async def test_memory(self) -> None:
    method test_ttl (line 776) | async def test_ttl(self) -> None:

FILE: tests/model_anthropic_test.py
  class SampleModel (line 12) | class SampleModel(BaseModel):
  class AnthropicMessageMock (line 19) | class AnthropicMessageMock:
    method __init__ (line 22) | def __init__(self, content: list = None, usage: dict = None):
    method _create_usage_mock (line 26) | def _create_usage_mock(self, usage_data: dict) -> Mock:
  class AnthropicContentBlockMock (line 33) | class AnthropicContentBlockMock:
    method __init__ (line 36) | def __init__(self, block_type: str, **kwargs: Any) -> None:
  class AnthropicEventMock (line 42) | class AnthropicEventMock:
    method __init__ (line 45) | def __init__(self, event_type: str, **kwargs: Any) -> None:
  class TestAnthropicChatModel (line 51) | class TestAnthropicChatModel(IsolatedAsyncioTestCase):
    method test_init_default_params (line 54) | def test_init_default_params(self) -> None:
    method test_init_with_custom_params (line 68) | def test_init_with_custom_params(self) -> None:
    method test_call_with_regular_messages (line 91) | async def test_call_with_regular_messages(self) -> None:
    method test_call_with_system_message (line 130) | async def test_call_with_system_message(self) -> None:
    method test_call_with_thinking_enabled (line 166) | async def test_call_with_thinking_enabled(self) -> None:
    method test_call_with_tools_integration (line 213) | async def test_call_with_tools_integration(self) -> None:
    method test_streaming_response_processing (line 276) | async def test_streaming_response_processing(self) -> None:
    method test_generate_kwargs_integration (line 329) | async def test_generate_kwargs_integration(self) -> None:
    method test_call_with_structured_model_integration (line 358) | async def test_call_with_structured_model_integration(self) -> None:

FILE: tests/model_dashscope_test.py
  class MessageMock (line 13) | class MessageMock(dict):
    method __init__ (line 17) | def __init__(self, data: dict[str, Any]):
  class SampleModel (line 23) | class SampleModel(BaseModel):
  class TestDashScopeChatModel (line 30) | class TestDashScopeChatModel(IsolatedAsyncioTestCase):
    method test_init_default_params (line 33) | def test_init_default_params(self) -> None:
    method test_init_with_enable_thinking_forces_stream (line 45) | def test_init_with_enable_thinking_forces_stream(self) -> None:
    method test_init_with_custom_params (line 58) | def test_init_with_custom_params(self) -> None:
    method test_call_with_regular_model (line 73) | async def test_call_with_regular_model(self) -> None:
    method test_call_with_tools_integration (line 100) | async def test_call_with_tools_integration(self) -> None:
    method test_call_with_enable_thinking_streaming (line 153) | async def test_call_with_enable_thinking_streaming(self) -> None:
    method test_call_with_structured_model_integration (line 190) | async def test_call_with_structured_model_integration(self) -> None:
    method test_streaming_response_processing (line 271) | async def test_streaming_response_processing(self) -> None:
    method test_tools_schema_validation_through_api (line 343) | def test_tools_schema_validation_through_api(self) -> None:
    method test_call_with_multimodal_model (line 385) | async def test_call_with_multimodal_model(self) -> None:
    method test_error_handling_scenarios (line 411) | async def test_error_handling_scenarios(self) -> None:
    method _create_mock_response (line 431) | def _create_mock_response(self, content: str) -> Mock:
    method _create_mock_response_with_tools (line 444) | def _create_mock_response_with_tools(
    method _create_mock_chunk (line 464) | def _create_mock_chunk(
    method _create_async_generator (line 486) | async def _create_async_generator(self, items: list) -> AsyncGenerator:

FILE: tests/model_gemini_test.py
  class GeminiResponseMock (line 13) | class GeminiResponseMock:
    method __init__ (line 16) | def __init__(
    method _create_usage_mock (line 53) | def _create_usage_mock(self, usage_data: dict) -> Mock:
  class GeminiFunctionCallMock (line 60) | class GeminiFunctionCallMock:
    method __init__ (line 63) | def __init__(self, call_id: str, name: str, args: dict = None):
  class GeminiPartMock (line 69) | class GeminiPartMock:
    method __init__ (line 72) | def __init__(self, text: str = "", thought: bool = False):
  class GeminiCandidateMock (line 79) | class GeminiCandidateMock:
    method __init__ (line 82) | def __init__(self, parts: list = None):
  class SampleModel (line 87) | class SampleModel(BaseModel):
  class TestGeminiChatModel (line 94) | class TestGeminiChatModel(IsolatedAsyncioTestCase):
    method test_init_default_params (line 97) | def test_init_default_params(self) -> None:
    method test_init_with_custom_params (line 110) | def test_init_with_custom_params(self) -> None:
    method test_call_with_regular_model (line 131) | async def test_call_with_regular_model(self) -> None:
    method test_call_with_tools_integration (line 162) | async def test_call_with_tools_integration(self) -> None:
    method test_call_with_thinking_enabled (line 236) | async def test_call_with_thinking_enabled(self) -> None:
    method test_call_with_structured_model_integration (line 289) | async def test_call_with_structured_model_integration(self) -> None:
    method test_streaming_response_processing (line 329) | async def test_streaming_response_processing(self) -> None:
    method test_generate_kwargs_integration (line 363) | async def test_generate_kwargs_integration(self) -> None:
    method test_format_tools_with_nested_schema (line 391) | def test_format_tools_with_nested_schema(self) -> None:
    method _create_mock_response (line 451) | def _create_mock_response(
    method _create_mock_response_with_tools (line 463) | def _create_mock_response_with_tools(
    method _create_mock_response_with_thinking (line 477) | def _create_mock_response_with_thinking(
    method _create_mock_chunk (line 491) | def _create_mock_chunk(
    method _create_async_generator (line 510) | async def _create_async_generator(self, items: list) -> AsyncGenerator:

FILE: tests/model_ollama_test.py
  class OllamaMessageMock (line 13) | class OllamaMessageMock:
    method __init__ (line 16) | def __init__(
  class OllamaFunctionMock (line 27) | class OllamaFunctionMock:
    method __init__ (line 30) | def __init__(self, name: str, arguments: dict = None):
  class OllamaToolCallMock (line 35) | class OllamaToolCallMock:
    method __init__ (line 38) | def __init__(
  class OllamaResponseMock (line 47) | class OllamaResponseMock:
    method __init__ (line 50) | def __init__(
    method get (line 62) | def get(self, key: str, default: Any = None) -> Any:
    method __contains__ (line 66) | def __contains__(self, key: str) -> bool:
  class SampleModel (line 71) | class SampleModel(BaseModel):
  class TestOllamaChatModel (line 78) | class TestOllamaChatModel(IsolatedAsyncioTestCase):
    method test_init_default_params (line 81) | def test_init_default_params(self) -> None:
    method test_init_with_custom_params (line 92) | def test_init_with_custom_params(self) -> None:
    method test_call_with_regular_model (line 115) | async def test_call_with_regular_model(self) -> None:
    method test_call_with_tools_integration (line 141) | async def test_call_with_tools_integration(self) -> None:
    method test_call_with_thinking_enabled (line 196) | async def test_call_with_thinking_enabled(self) -> None:
    method test_call_with_structured_model_integration (line 234) | async def test_call_with_structured_model_integration(self) -> None:
    method test_streaming_response_processing (line 263) | async def test_streaming_response_processing(self) -> None:
    method test_options_integration (line 291) | async def test_options_integration(self) -> None:
    method _create_mock_response (line 317) | def _create_mock_response(
    method _create_mock_response_with_message (line 331) | def _create_mock_response_with_message(
    method _create_mock_chunk (line 344) | def _create_mock_chunk(
    method _create_async_generator (line 366) | async def _create_async_generator(self, items: list) -> AsyncGenerator:

FILE: tests/model_openai_test.py
  class SampleModel (line 12) | class SampleModel(BaseModel):
  class TestOpenAIChatModel (line 19) | class TestOpenAIChatModel(IsolatedAsyncioTestCase):
    method test_init_default_params (line 22) | def test_init_default_params(self) -> None:
    method test_init_with_custom_params (line 35) | def test_init_with_custom_params(self) -> None:
    method test_call_with_regular_model (line 59) | async def test_call_with_regular_model(self) -> None:
    method test_call_with_tools_integration (line 91) | async def test_call_with_tools_integration(self) -> None:
    method test_call_with_reasoning_effort (line 145) | async def test_call_with_reasoning_effort(self) -> None:
    method test_call_with_structured_model_integration (line 182) | async def test_call_with_structured_model_integration(self) -> None:
    method test_streaming_response_processing (line 212) | async def test_streaming_response_processing(self) -> None:
    method _create_mock_response (line 253) | def _create_mock_response(
    method _create_mock_response_with_tools (line 279) | def _create_mock_response_with_tools(
    method _create_mock_response_with_reasoning (line 297) | def _create_mock_response_with_reasoning(
    method _create_mock_response_with_structured_data (line 307) | def _create_mock_response_with_structured_data(self, data: dict) -> Mock:
    method test_streaming_response_with_none_delta (line 325) | async def test_streaming_response_with_none_delta(self) -> None:
    method _create_stream_mock (line 363) | def _create_stream_mock(self, chunks_data: list) -> Any:

FILE: tests/pipeline_test.py
  class AddAgent (line 18) | class AddAgent(AgentBase):
    method __init__ (line 21) | def __init__(self, value: int) -> None:
    method reply (line 27) | async def reply(self, x: Msg | None) -> Msg | None:
    method observe (line 34) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 37) | async def handle_interrupt(
  class StreamAgent (line 45) | class StreamAgent(AgentBase):
    method __init__ (line 48) | def __init__(self) -> None:
    method reply (line 53) | async def reply(self) -> Msg | None:
    method observe (line 78) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 81) | async def handle_interrupt(
  class ErrorAgent (line 89) | class ErrorAgent(AgentBase):
    method __init__ (line 92) | def __init__(self, error_msg: str = "Test error") -> None:
    method reply (line 98) | async def reply(self) -> Msg | None:
    method observe (line 109) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 112) | async def handle_interrupt(
  class MultAgent (line 120) | class MultAgent(AgentBase):
    method __init__ (line 123) | def __init__(self, value: int) -> None:
    method reply (line 129) | async def reply(self, x: Msg | None) -> Msg | None:
    method observe (line 136) | async def observe(self, msg: Msg | list[Msg] | None) -> None:
    method handle_interrupt (line 139) | async def handle_interrupt(
  class PipelineTest (line 147) | class PipelineTest(IsolatedAsyncioTestCase):
    method test_functional_sequential_pipeline (line 150) | async def test_functional_sequential_pipeline(self) -> None:
    method test_class_sequential_pipeline (line 169) | async def test_class_sequential_pipeline(self) -> None:
    method test_functional_sequential_pipeline_with_none_message (line 191) | async def test_functional_sequential_pipeline_with_none_message(
    method test_class_sequential_pipeline_with_none_message (line 207) | async def test_class_sequential_pipeline_with_none_message(self) -> None:
    method test_empty_agent_list (line 224) | async def test_empty_agent_list(self) -> None:
    method test_single_agent_pipeline (line 240) | async def test_single_agent_pipeline(
    method test_functional_fanout_pipeline_concurrent (line 267) | async def test_functional_fanout_pipeline_concurrent(self) -> None:
    method test_functional_fanout_pipeline_sequential (line 291) | async def test_functional_fanout_pipeline_sequential(self) -> None:
    method test_class_fanout_pipeline_concurrent (line 312) | async def test_class_fanout_pipeline_concurrent(self) -> None:
    method test_class_fanout_pipeline_sequential (line 327) | async def test_class_fanout_pipeline_sequential(self) -> None:
    method test_fanout_pipeline_empty_agents (line 343) | async def test_fanout_pipeline_empty_agents(self) -> None:
    method test_fanout_pipeline_with_none_message (line 360) | async def test_fanout_pipeline_with_none_message(self) -> None:
    method test_stream_printing_messages (line 379) | async def test_stream_printing_messages(self) -> None:
    method test_stream_printing_messages_with_error_after_print (line 411) | async def test_stream_printing_messages_with_error_after_print(

FILE: tests/plan_test.py
  class PlanTest (line 12) | class PlanTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 15) | async def asyncSetUp(self) -> None:
    method test_plan_model (line 46) | async def test_plan_model(self) -> None:
    method test_plan_subtasks (line 119) | async def test_plan_subtasks(self) -> None:
    method test_serialization (line 277) | async def test_serialization(self) -> None:
    method test_hint_generator_all_states (line 614) | async def test_hint_generator_all_states(self) -> None:
    method test_error_paths (line 665) | async def test_error_paths(self) -> None:
    method test_edge_cases (line 717) | async def test_edge_cases(self) -> None:
    method test_recover_historical_plan_triggers_hook (line 786) | async def test_recover_historical_plan_triggers_hook(self) -> None:

FILE: tests/rag_knowledge_test.py
  class TestTextEmbedding (line 19) | class TestTextEmbedding(EmbeddingModelBase):
    method __init__ (line 25) | def __init__(self) -> None:
    method __call__ (line 29) | async def __call__(
  class RAGKnowledgeTest (line 51) | class RAGKnowledgeTest(IsolatedAsyncioTestCase):
    method test_simple_knowledge (line 54) | async def test_simple_knowledge(self) -> None:

FILE: tests/rag_reader_test.py
  class RAGReaderText (line 16) | class RAGReaderText(IsolatedAsyncioTestCase):
    method test_text_reader (line 19) | async def test_text_reader(self) -> None:
    method test_pdf_reader (line 81) | async def test_pdf_reader(self) -> None:
    method test_word_reader_with_images_and_tables (line 104) | async def test_word_reader_with_images_and_tables(self) -> None:
    method test_excel_reader_with_images_and_tables (line 155) | async def test_excel_reader_with_images_and_tables(self) -> None:
    method test_ppt_reader_with_images_and_tables (line 258) | async def test_ppt_reader_with_images_and_tables(self) -> None:
    method test_ppt_reader_with_json_table_format (line 325) | async def test_ppt_reader_with_json_table_format(self) -> None:
    method test_ppt_reader_without_image (line 367) | async def test_ppt_reader_without_image(self) -> None:
    method test_ppt_reader_merged_table (line 392) | async def test_ppt_reader_merged_table(self) -> None:
    method test_ppt_reader_without_slide_tags (line 433) | async def test_ppt_reader_without_slide_tags(self) -> None:

FILE: tests/rag_store_test.py
  class RAGStoreTest (line 22) | class RAGStoreTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 25) | async def asyncSetUp(self) -> None:
    method test_qdrant_store (line 31) | async def test_qdrant_store(self) -> None:
    method test_milvus_lite_store (line 83) | async def test_milvus_lite_store(self) -> None:
    method test_oceanbase_store (line 138) | async def test_oceanbase_store(self) -> None:
    method test_alibabacloud_mysql_store (line 292) | async def test_alibabacloud_mysql_store(self) -> None:
    method test_mongodb_store (line 421) | async def test_mongodb_store(self) -> None:
    method asyncTearDown (line 593) | async def asyncTearDown(self) -> None:

FILE: tests/react_agent_test.py
  class MyModel (line 16) | class MyModel(ChatModelBase):
    method __init__ (line 19) | def __init__(self) -> None:
    method __call__ (line 39) | async def __call__(
  function pre_reasoning_hook (line 56) | async def pre_reasoning_hook(self: ReActAgent, _kwargs: Any) -> None:
  function post_reasoning_hook (line 64) | async def post_reasoning_hook(
  function pre_acting_hook (line 76) | async def pre_acting_hook(self: ReActAgent, _kwargs: Any) -> None:
  function post_acting_hook (line 84) | async def post_acting_hook(
  class ReActAgentTest (line 96) | class ReActAgentTest(IsolatedAsyncioTestCase):
    method test_react_agent (line 99) | async def test_react_agent(self) -> None:

FILE: tests/realtime_dashscope_test.py
  class TestDashScopeRealtimeModelParseAPIMessage (line 17) | class TestDashScopeRealtimeModelParseAPIMessage(IsolatedAsyncioTestCase):
    method setUp (line 20) | def setUp(self) -> None:
    method test_parse_session_created_event (line 28) | async def test_parse_session_created_event(self) -> None:
    method test_parse_response_created_event (line 45) | async def test_parse_response_created_event(self) -> None:
    method test_parse_response_done_event (line 64) | async def test_parse_response_done_event(self) -> None:
    method test_parse_response_audio_delta_event (line 92) | async def test_parse_response_audio_delta_event(self) -> None:
    method test_parse_response_audio_done_event (line 114) | async def test_parse_response_audio_done_event(self) -> None:
    method test_parse_response_audio_transcript_delta_event (line 132) | async def test_parse_response_audio_transcript_delta_event(self) -> None:
    method test_parse_response_audio_transcript_done_event (line 158) | async def test_parse_response_audio_transcript_done_event(self) -> None:
    method test_parse_input_audio_transcription_completed_event (line 179) | async def test_parse_input_audio_transcription_completed_event(
    method test_parse_input_audio_buffer_speech_started_event (line 203) | async def test_parse_input_audio_buffer_speech_started_event(
    method test_parse_input_audio_buffer_speech_stopped_event (line 222) | async def test_parse_input_audio_buffer_speech_stopped_event(
    method test_parse_error_event (line 241) | async def test_parse_error_event(self) -> None:
  class TestDashScopeRealtimeModelSend (line 263) | class TestDashScopeRealtimeModelSend(IsolatedAsyncioTestCase):
    method setUp (line 266) | def setUp(self) -> None:
    method test_send_audio_base64 (line 280) | async def test_send_audio_base64(self) -> None:
    method test_send_image_base64 (line 303) | async def test_send_image_base64(self) -> None:
    method test_send_image_url (line 326) | async def test_send_image_url(self) -> None:

FILE: tests/realtime_event_test.py
  class TestServerEventsFromModelEvent (line 9) | class TestServerEventsFromModelEvent(IsolatedAsyncioTestCase):
    method setUp (line 12) | def setUp(self) -> None:
    method test_model_response_created_event (line 17) | async def test_model_response_created_event(self) -> None:
    method test_model_response_done_event (line 39) | async def test_model_response_done_event(self) -> None:
    method test_model_response_audio_delta_event (line 66) | async def test_model_response_audio_delta_event(self) -> None:
    method test_model_response_audio_done_event (line 94) | async def test_model_response_audio_done_event(self) -> None:
    method test_model_response_audio_transcript_delta_event (line 117) | async def test_model_response_audio_transcript_delta_event(self) -> None:
    method test_model_response_audio_transcript_done_event (line 141) | async def test_model_response_audio_transcript_done_event(self) -> None:
    method test_model_response_tool_use_delta_event (line 163) | async def test_model_response_tool_use_delta_event(self) -> None:
    method test_model_response_tool_use_done_event (line 195) | async def test_model_response_tool_use_done_event(self) -> None:
    method test_model_input_transcription_delta_event (line 227) | async def test_model_input_transcription_delta_event(self) -> None:
    method test_model_input_transcription_done_event (line 249) | async def test_model_input_transcription_done_event(self) -> None:
    method test_model_input_started_event (line 275) | async def test_model_input_started_event(self) -> None:
    method test_model_input_done_event (line 297) | async def test_model_input_done_event(self) -> None:
    method test_model_error_event (line 319) | async def test_model_error_event(self) -> None:
  class TestClientEventsFromJson (line 345) | class TestClientEventsFromJson(IsolatedAsyncioTestCase):
    method test_client_session_create_event (line 348) | async def test_client_session_create_event(self) -> None:
    method test_client_session_end_event (line 368) | async def test_client_session_end_event(self) -> None:
    method test_client_response_create_event (line 381) | async def test_client_response_create_event(self) -> None:
    method test_client_response_cancel_event (line 394) | async def test_client_response_cancel_event(self) -> None:
    method test_client_image_append_event (line 407) | async def test_client_image_append_event(self) -> None:
    method test_client_text_append_event (line 424) | async def test_client_text_append_event(self) -> None:
    method test_client_audio_append_event (line 439) | async def test_client_audio_append_event(self) -> None:
    method test_client_audio_commit_event (line 457) | async def test_client_audio_commit_event(self) -> None:
    method test_client_tool_result_event (line 470) | async def test_client_tool_result_event(self) -> None:
    method test_invalid_json_data_no_type (line 489) | async def test_invalid_json_data_no_type(self) -> None:
    method test_invalid_json_data_not_dict (line 500) | async def test_invalid_json_data_not_dict(self) -> None:
    method test_unknown_event_type (line 509) | async def test_unknown_event_type(self) -> None:

FILE: tests/realtime_gemini_test.py
  class TestGeminiRealtimeModelParseAPIMessage (line 18) | class TestGeminiRealtimeModelParseAPIMessage(IsolatedAsyncioTestCase):
    method setUp (line 21) | def setUp(self) -> None:
    method test_parse_setup_complete_event (line 29) | async def test_parse_setup_complete_event(self) -> None:
    method test_parse_audio_delta_event (line 39) | async def test_parse_audio_delta_event(self) -> None:
    method test_parse_output_transcription_event (line 66) | async def test_parse_output_transcription_event(self) -> None:
    method test_parse_input_transcription_event (line 86) | async def test_parse_input_transcription_event(self) -> None:
    method test_parse_generation_complete_event (line 106) | async def test_parse_generation_complete_event(self) -> None:
    method test_parse_turn_complete_event (line 124) | async def test_parse_turn_complete_event(self) -> None:
    method test_parse_tool_call_event (line 142) | async def test_parse_tool_call_event(self) -> None:
    method test_parse_error_event (line 174) | async def test_parse_error_event(self) -> None:
  class TestGeminiRealtimeModelSend (line 195) | class TestGeminiRealtimeModelSend(IsolatedAsyncioTestCase):
    method setUp (line 198) | def setUp(self) -> None:
    method test_send_audio_base64 (line 211) | async def test_send_audio_base64(self) -> None:
    method test_send_image_base64 (line 235) | async def test_send_image_base64(self) -> None:
    method test_send_text (line 259) | async def test_send_text(self) -> None:
    method test_send_tool_result (line 277) | async def test_send_tool_result(self) -> None:

FILE: tests/realtime_openai_test.py
  class TestOpenAIRealtimeModelParseAPIMessage (line 18) | class TestOpenAIRealtimeModelParseAPIMessage(IsolatedAsyncioTestCase):
    method setUp (line 21) | def setUp(self) -> None:
    method test_parse_session_created_event (line 29) | async def test_parse_session_created_event(self) -> None:
    method test_parse_response_created_event (line 46) | async def test_parse_response_created_event(self) -> None:
    method test_parse_response_done_event (line 64) | async def test_parse_response_done_event(self) -> None:
    method test_parse_response_audio_delta_event (line 90) | async def test_parse_response_audio_delta_event(self) -> None:
    method test_parse_response_audio_done_event (line 112) | async def test_parse_response_audio_done_event(self) -> None:
    method test_parse_response_audio_transcript_delta_event (line 130) | async def test_parse_response_audio_transcript_delta_event(self) -> None:
    method test_parse_response_audio_transcript_done_event (line 156) | async def test_parse_response_audio_transcript_done_event(self) -> None:
    method test_parse_function_call_arguments_delta_event (line 177) | async def test_parse_function_call_arguments_delta_event(self) -> None:
    method test_parse_function_call_arguments_done_event (line 202) | async def test_parse_function_call_arguments_done_event(self) -> None:
    method test_parse_input_audio_transcription_completed_event (line 235) | async def test_parse_input_audio_transcription_completed_event(
    method test_parse_input_audio_buffer_speech_started_event (line 259) | async def test_parse_input_audio_buffer_speech_started_event(
    method test_parse_input_audio_buffer_speech_stopped_event (line 278) | async def test_parse_input_audio_buffer_speech_stopped_event(
    method test_parse_error_event (line 297) | async def test_parse_error_event(self) -> None:
  class TestOpenAIRealtimeModelSend (line 319) | class TestOpenAIRealtimeModelSend(IsolatedAsyncioTestCase):
    method setUp (line 322) | def setUp(self) -> None:
    method test_send_audio_base64 (line 335) | async def test_send_audio_base64(self) -> None:
    method test_send_text (line 356) | async def test_send_text(self) -> None:
    method test_send_tool_result (line 378) | async def test_send_tool_result(self) -> None:
    method test_send_audio_url (line 402) | async def test_send_audio_url(self) -> None:

FILE: tests/session_test.py
  class MyAgent (line 16) | class MyAgent(AgentBase):
    method __init__ (line 19) | def __init__(self) -> None:
    method reply (line 29) | async def reply(self, msg: Msg) -> None:
    method observe (line 32) | async def observe(self, msg: Msg) -> None:
    method handle_interrupt (line 36) | async def handle_interrupt(
  class SessionTest (line 43) | class SessionTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 46) | async def asyncSetUp(self) -> None:
    method test_session_base (line 52) | async def test_session_base(self) -> None:
    method asyncTearDown (line 96) | async def asyncTearDown(self) -> None:
  class RedisSessionTest (line 104) | class RedisSessionTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 107) | async def asyncSetUp(self) -> None:
    method test_redis_session_save_and_load (line 122) | async def test_redis_session_save_and_load(self) -> None:
    method asyncTearDown (line 157) | async def asyncTearDown(self) -> None:

FILE: tests/token_anthropic_test.py
  class AnthropicTokenCounterTest (line 9) | class AnthropicTokenCounterTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 12) | async def asyncSetUp(self) -> None:
    method test_anthropic_token_counter (line 98) | async def test_anthropic_token_counter(self) -> None:

FILE: tests/token_char_test.py
  class CharTokenCounterTest (line 6) | class CharTokenCounterTest(IsolatedAsyncioTestCase):
    method test_count_tokens (line 9) | async def test_count_tokens(self) -> None:

FILE: tests/token_openai_test.py
  class OpenAITokenCounterTest (line 11) | class OpenAITokenCounterTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 14) | async def asyncSetUp(self) -> None:
    method test_openai_token_counter (line 142) | async def test_openai_token_counter(self) -> None:

FILE: tests/tool_dashscope_test.py
  class TestDashScopeTextToImage (line 16) | class TestDashScopeTextToImage:
    method test_text_to_image_success_url_mode (line 19) | def test_text_to_image_success_url_mode(self) -> None:
    method test_text_to_image_success_base64_mode (line 54) | def test_text_to_image_success_base64_mode(self) -> None:
    method test_text_to_image_empty_results (line 94) | def test_text_to_image_empty_results(self) -> None:
    method test_text_to_image_none_results (line 110) | def test_text_to_image_none_results(self) -> None:
    method test_text_to_image_exception (line 129) | def test_text_to_image_exception(self) -> None:
  class TestDashScopeImageToText (line 149) | class TestDashScopeImageToText:
    method test_image_to_text_single_url_success (line 152) | def test_image_to_text_single_url_success(self) -> None:
    method test_image_to_text_multiple_urls_success (line 175) | def test_image_to_text_multiple_urls_success(self) -> None:
    method test_image_to_text_local_file_success (line 201) | def test_image_to_text_local_file_success(self) -> None:
    method test_image_to_text_invalid_local_path (line 232) | def test_image_to_text_invalid_local_path(self) -> None:
    method test_image_to_text_list_content_response (line 256) | def test_image_to_text_list_content_response(self) -> None:
    method test_image_to_text_none_content (line 279) | def test_image_to_text_none_content(self) -> None:
    method test_image_to_text_exception (line 300) | def test_image_to_text_exception(self) -> None:
  class TestDashScopeTextToAudio (line 322) | class TestDashScopeTextToAudio:
    method test_text_to_audio_success (line 325) | def test_text_to_audio_success(self) -> None:
    method test_text_to_audio_no_data (line 355) | def test_text_to_audio_no_data(self) -> None:
    method test_text_to_audio_api_exception (line 378) | def test_text_to_audio_api_exception(self) -> None:

FILE: tests/tool_openai_test.py
  class TestOpenAITextToImage (line 20) | class TestOpenAITextToImage:
    method test_text_to_image_success_url_mode (line 23) | def test_text_to_image_success_url_mode(self) -> None:
    method test_text_to_image_success_base64_mode (line 60) | def test_text_to_image_success_base64_mode(self) -> None:
    method test_text_to_image_gpt_image_1_force_base64 (line 89) | def test_text_to_image_gpt_image_1_force_base64(self) -> None:
    method test_text_to_image_exception (line 118) | def test_text_to_image_exception(self) -> None:
  class TestOpenAIEditImage (line 139) | class TestOpenAIEditImage:
    method test_edit_image_success_url_input (line 142) | def test_edit_image_success_url_input(self) -> None:
    method test_edit_image_success_local_file (line 181) | def test_edit_image_success_local_file(self) -> None:
    method test_edit_image_exception (line 219) | def test_edit_image_exception(self) -> None:
    method test_edit_image_file_not_found (line 248) | def test_edit_image_file_not_found(self) -> None:
  class TestOpenAICreateImageVariation (line 270) | class TestOpenAICreateImageVariation:
    method test_create_variation_success_url_mode (line 273) | def test_create_variation_success_url_mode(self) -> None:
    method test_create_variation_success_base64_mode (line 314) | def test_create_variation_success_base64_mode(self) -> None:
    method test_create_variation_exception (line 346) | def test_create_variation_exception(self) -> None:
  class TestOpenAIImageToText (line 373) | class TestOpenAIImageToText:
    method test_image_to_text_single_url_success (line 376) | def test_image_to_text_single_url_success(self) -> None:
    method test_image_to_text_multiple_urls_success (line 408) | def test_image_to_text_multiple_urls_success(self) -> None:
    method test_image_to_text_exception (line 443) | def test_image_to_text_exception(self) -> None:
  class TestOpenAITextToAudio (line 477) | class TestOpenAITextToAudio:
    method test_text_to_audio_success (line 480) | def test_text_to_audio_success(self) -> None:
    method test_text_to_audio_different_format (line 508) | def test_text_to_audio_different_format(self) -> None:
    method test_text_to_audio_exception (line 539) | def test_text_to_audio_exception(self) -> None:
  class TestOpenAIAudioToText (line 562) | class TestOpenAIAudioToText:
    method test_audio_to_text_local_file_success (line 565) | def test_audio_to_text_local_file_success(self) -> None:
    method test_audio_to_text_url_success (line 601) | def test_audio_to_text_url_success(self) -> None:
    method test_audio_to_text_file_not_found (line 636) | def test_audio_to_text_file_not_found(self) -> None:
    method test_audio_to_text_api_exception (line 657) | def test_audio_to_text_api_exception(self) -> None:

FILE: tests/tool_test.py
  class ToolTest (line 21) | class ToolTest(IsolatedAsyncioTestCase):
    method setUp (line 24) | def setUp(self) -> None:
    method test_execute_python_code (line 30) | async def test_execute_python_code(self) -> None:
    method test_execute_shell_command (line 98) | async def test_execute_shell_command(self) -> None:
    method test_view_text_file (line 155) | async def test_view_text_file(self) -> None:
    method test_write_text_file (line 223) | async def test_write_text_file(self) -> None:
    method test_insert_text_file (line 248) | async def test_insert_text_file(self) -> None:
    method tearDown (line 362) | def tearDown(self) -> None:

FILE: tests/toolkit_basic_test.py
  function aenumerate (line 18) | async def aenumerate(
  function async_func (line 42) | async def async_func(raise_cancel: bool) -> ToolResponse:
  function sync_func (line 50) | def sync_func(
  class TestCls (line 75) | class TestCls:
    method sync_func (line 78) | def sync_func(self) -> ToolResponse:
  function async_generator_func (line 90) | async def async_generator_func(
  function async_func_return_async_generator (line 102) | async def async_func_return_async_generator(
  function async_func_return_sync_generator (line 109) | async def async_func_return_sync_generator() -> Generator[
  function sync_generator_func (line 118) | def sync_generator_func() -> Generator[ToolResponse, None, None]:
  class StructuredModel (line 125) | class StructuredModel(BaseModel):
  class MyBaseModel1 (line 131) | class MyBaseModel1(BaseModel):
  class MyBaseModel2 (line 137) | class MyBaseModel2(BaseModel):
  class ExtendedModelReusingBaseModel (line 143) | class ExtendedModelReusingBaseModel(BaseModel):
  class ToolkitBasicTest (line 150) | class ToolkitBasicTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 153) | async def asyncSetUp(self) -> None:
    method test_duplicate_tool_registration (line 192) | async def test_duplicate_tool_registration(self) -> None:
    method test_basic_functionalities (line 335) | async def test_basic_functionalities(self) -> None:
    method test_extended_model_reusing_same_base_model (line 435) | async def test_extended_model_reusing_same_base_model(self) -> None:
    method test_detailed_arguments (line 523) | async def test_detailed_arguments(self) -> None:
    method _verify_async_generator_wo_interruption (line 605) | async def _verify_async_generator_wo_interruption(
    method test_async_func (line 618) | async def test_async_func(self) -> None:
    method test_register_async_generator_func (line 662) | async def test_register_async_generator_func(self) -> None:
    method test_register_async_func_return_async_generator (line 712) | async def test_register_async_func_return_async_generator(self) -> None:
    method test_register_async_func_return_sync_generator (line 762) | async def test_register_async_func_return_sync_generator(self) -> None:
    method test_register_sync_generator_func (line 775) | async def test_register_sync_generator_func(self) -> None:
    method test_create_tool_group (line 788) | async def test_create_tool_group(self) -> None:
    method test_postprocess_func (line 834) | async def test_postprocess_func(self) -> None:
    method test_async_postprocess_func (line 873) | async def test_async_postprocess_func(self) -> None:
    method test_register_with_valid_json_schema (line 912) | async def test_register_with_valid_json_schema(self) -> None:
    method test_register_with_invalid_json_schema (line 963) | async def test_register_with_invalid_json_schema(self) -> None:
    method test_register_with_custom_json_schema_without_overrides (line 983) | async def test_register_with_custom_json_schema_without_overrides(
    method test_register_with_json_schema_preset_kwargs_keep_other_required (line 1025) | async def test_register_with_json_schema_preset_kwargs_keep_other_requ...
    method test_partial_function (line 1061) | async def test_partial_function(self) -> None:
    method test_func_name_parameter (line 1127) | async def test_func_name_parameter(self) -> None:
    method asyncTearDown (line 1223) | async def asyncTearDown(self) -> None:

FILE: tests/toolkit_meta_tool_test.py
  function tool_function_1 (line 10) | def tool_function_1() -> ToolResponse:
  function tool_function_2 (line 22) | def tool_function_2() -> ToolResponse:
  class ToolkitMetaToolTest (line 34) | class ToolkitMetaToolTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 37) | async def asyncSetUp(self) -> None:
    method test_meta_tool (line 90) | async def test_meta_tool(self) -> None:
    method asyncTearDown (line 274) | async def asyncTearDown(self) -> None:

FILE: tests/toolkit_middleware_test.py
  function middleware_1 (line 10) | async def middleware_1(
  function middleware_2 (line 27) | async def middleware_2(
  function tool (line 44) | async def tool(a: str) -> ToolResponse:
  class ToolkitMiddlewareTest (line 60) | class ToolkitMiddlewareTest(IsolatedAsyncioTestCase):
    method asyncSetUp (line 63) | async def asyncSetUp(self) -> None:
    method test_toolkit_middleware (line 68) | async def test_toolkit_middleware(self) -> None:

FILE: tests/tracing_converter_test.py
  class ConverterTest (line 17) | class ConverterTest(TestCase):
    method test_convert_text_block (line 20) | def test_convert_text_block(self) -> None:
  
Condensed preview — 566 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,995K chars).
[
  {
    "path": ".gemini/styleguide.md",
    "chars": 2928,
    "preview": "# AgentScope Code Review Guide\n\nYou should conduct a strict code review. Each requirement is labeled with priority:\n- **"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 804,
    "preview": "---\nname: Bug Report\nabout: Create a report to help us improve\ntitle: '[Bug]:'\nlabels: 'bug'\nassignees: ''\n\n---\n\n**<u>Ag"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/custom.md",
    "chars": 256,
    "preview": "---\nname: Custom issue template\nabout: Describe this issue template's purpose here.\ntitle: ''\nlabels: ''\nassignees: ''\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 746,
    "preview": "---\nname: Feature Request\nabout: Suggest an idea for this project\ntitle: '[Feature]: '\nlabels: 'enhancement'\nassignees: "
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 902,
    "preview": "## PR Title Format\n\nPlease ensure your PR title follows the Conventional Commits format:\n- Format: `<type>(<scope>): <de"
  },
  {
    "path": ".github/copilot-instructions.md",
    "chars": 2928,
    "preview": "# AgentScope Code Review Guide\n\nYou should conduct a strict code review. Each requirement is labeled with priority:\n- **"
  },
  {
    "path": ".github/scripts/update_news.py",
    "chars": 4691,
    "preview": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nScript to automatically update NEWS section in README files.\nReads th"
  },
  {
    "path": ".github/workflows/pr-title-check.yml",
    "chars": 1629,
    "preview": "name: PR Title Check\n\non:\n  pull_request:\n    branches:\n      - main\n    types: [opened, edited, synchronize, reopened]\n"
  },
  {
    "path": ".github/workflows/pre-commit.yml",
    "chars": 1033,
    "preview": "name: Pre-commit\n\non: [push, pull_request]\n\njobs:\n  run:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: Tr"
  },
  {
    "path": ".github/workflows/publish-pypi.yml",
    "chars": 1234,
    "preview": "# This workflow will upload a Python Package using Twine when a release is created\n# For more information see: https://d"
  },
  {
    "path": ".github/workflows/sphinx_docs.yml",
    "chars": 2666,
    "preview": "name: Deploy Sphinx documentation to Pages\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  build_en:\n    timeout-minute"
  },
  {
    "path": ".github/workflows/stale.yml",
    "chars": 1245,
    "preview": "# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.\n#\n# You c"
  },
  {
    "path": ".github/workflows/toc.yml",
    "chars": 715,
    "preview": "name: Generate TOC\non:\n  push:\n    paths:\n      - 'README.md'\n      - 'README_ZH.md'\n    branches-ignore:\n      - 'main'"
  },
  {
    "path": ".github/workflows/unittest.yml",
    "chars": 918,
    "preview": "name: Python Unittest Coverage\n\non: [push, pull_request]\n\njobs:\n  test:\n    if: false == contains(github.event.pull_requ"
  },
  {
    "path": ".github/workflows/update_news.yml",
    "chars": 988,
    "preview": "name: Update NEWS in README\non:\n  push:\n    paths:\n      - 'docs/NEWS.md'\n      - 'docs/NEWS_zh.md'\n    branches-ignore:"
  },
  {
    "path": ".gitignore",
    "chars": 2060,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 2925,
    "preview": "repos:\n  - repo: https://github.com/pre-commit/pre-commit-hooks\n    rev: v4.3.0\n    hooks:\n      - id: check-ast\n      -"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 12391,
    "preview": "# Contributing to AgentScope\n\n## Welcome! 🎉\n\nThank you for your interest in contributing to AgentScope! As an open-sourc"
  },
  {
    "path": "CONTRIBUTING_zh.md",
    "chars": 6540,
    "preview": "# 贡献到 AgentScope\n\n## 欢迎!🎉\n\n感谢开源社区对 AgentScope 项目的关注和支持,作为一个开源项目,我们热烈欢迎并鼓励来自社区的贡献。无论是修复错误、添加新功能、改进文档还是\n分享想法,这些贡献都能帮助 Agen"
  },
  {
    "path": "LICENSE",
    "chars": 20637,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 18339,
    "preview": "<p align=\"center\">\n  <img\n    src=\"https://img.alicdn.com/imgextra/i1/O1CN01nTg6w21NqT5qFKH1u_!!6000000001621-55-tps-550"
  },
  {
    "path": "README_zh.md",
    "chars": 16004,
    "preview": "<p align=\"center\">\n  <img\n    src=\"https://img.alicdn.com/imgextra/i1/O1CN01nTg6w21NqT5qFKH1u_!!6000000001621-55-tps-550"
  },
  {
    "path": "docs/NEWS.md",
    "chars": 3967,
    "preview": "<!-- This is the source of truth for all NEWS items. -->\n<!-- The first 10 items are automatically synced to README.md a"
  },
  {
    "path": "docs/NEWS_zh.md",
    "chars": 3294,
    "preview": "<!-- This is the source of truth for all NEWS items. -->\n<!-- The first 10 items are automatically synced to README.md a"
  },
  {
    "path": "docs/changelog.md",
    "chars": 3020,
    "preview": "# CHANGELOG of v1.0.0\n\n> ➡️ change; ✅ new feature; ❌ deprecate\n\nThe overall changes from v0.x.x to v1.0.0 are summarized"
  },
  {
    "path": "docs/roadmap.md",
    "chars": 4826,
    "preview": "# Roadmap\n\n## Long-term Goals\n\nOffering **agent-oriented programming (AOP)** as a new programming paradigm to organize t"
  },
  {
    "path": "docs/tutorial/_static/css/gallery.css",
    "chars": 3763,
    "preview": ".sphx-glr-download-link-note.admonition.note {\n    display: none;\n}\n\n.sphx-glr-footer {\n    display: flex;\n    flex-dire"
  },
  {
    "path": "docs/tutorial/_static/language_switch.js",
    "chars": 452,
    "preview": "function switchV1Language() {\n    if (window.location.href.includes(\"zh_CN\")) {\n        window.location.href = \"https://"
  },
  {
    "path": "docs/tutorial/_templates/components/language-switch.html",
    "chars": 248,
    "preview": "{# _templates/components/language-switch.html #}\n<button onclick=\"switchV1Language()\" class=\"language-switch-button\" tit"
  },
  {
    "path": "docs/tutorial/_templates/module.rst_t",
    "chars": 128,
    "preview": "{{ basename |  heading }}\n.. automodule:: {{ qualname }}\n{%- for option in automodule_options %}\n   :{{ option }}:\n{%- e"
  },
  {
    "path": "docs/tutorial/_templates/package.rst_t",
    "chars": 222,
    "preview": "{%- macro automodule(modname, options) -%}\n.. automodule:: {{ modname }}\n{%- for option in options %}\n   :{{ option }}:\n"
  },
  {
    "path": "docs/tutorial/_templates/page.html",
    "chars": 12517,
    "preview": "{% extends \"base.html\" %}\n\n{% block body -%}\n{{ super() }}\n{% include \"partials/icons.html\" %}\n\n<input type=\"checkbox\" c"
  },
  {
    "path": "docs/tutorial/_templates/sidebar/navigation.html",
    "chars": 482,
    "preview": "<div class=\"sidebar-tree\">\n    <p class=\"caption\" role=\"heading\">\n        <span class=\"caption-text\">\n            Versio"
  },
  {
    "path": "docs/tutorial/en/Makefile",
    "chars": 639,
    "preview": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line, and also\n# from the "
  },
  {
    "path": "docs/tutorial/en/build.sh",
    "chars": 407,
    "preview": "#!/bin/bash\n\nset -e\n\n# Clean old build files\nrm -rf build/ doctrees/\n\n# Build the html\nsphinx-build -M html ./ build\n\n# "
  },
  {
    "path": "docs/tutorial/en/conf.py",
    "chars": 7340,
    "preview": "# -*- coding: utf-8 -*-\n# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in con"
  },
  {
    "path": "docs/tutorial/en/index.rst",
    "chars": 1579,
    "preview": ".. AgentScope Doc documentation master file, created by\n   sphinx-quickstart on Thu Aug  8 15:07:21 2024.\n   You can ada"
  },
  {
    "path": "docs/tutorial/en/make.bat",
    "chars": 769,
    "preview": "@ECHO OFF\n\npushd %~dp0\n\nREM Command file for Sphinx documentation\n\nif \"%SPHINXBUILD%\" == \"\" (\n\tset SPHINXBUILD=sphinx-bu"
  },
  {
    "path": "docs/tutorial/en/src/README.md",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs/tutorial/en/src/faq.py",
    "chars": 2319,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _faq:\n\nFAQ\n========================================\n\nAbout AgentScope\n~~~~~~~~~~~~~~~~~~~"
  },
  {
    "path": "docs/tutorial/en/src/quickstart_agent.py",
    "chars": 7272,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _react-agent:\n\nCreate ReAct Agent\n====================\n\nAgentScope provides out-of-the-bo"
  },
  {
    "path": "docs/tutorial/en/src/quickstart_installation.py",
    "chars": 1328,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _installation:\n\nInstallation\n============================\n\nAgentScope requires Python 3.1"
  },
  {
    "path": "docs/tutorial/en/src/quickstart_key_concept.py",
    "chars": 4557,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. key-concepts:\n\nKey Concepts\n====================================\n\nThis chapter establishe"
  },
  {
    "path": "docs/tutorial/en/src/quickstart_message.py",
    "chars": 7136,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _message:\n\nCreate Message\n====================\n\nMessage is the core concept in AgentScope"
  },
  {
    "path": "docs/tutorial/en/src/task_a2a.py",
    "chars": 7968,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _a2a:\n\nA2A Agent\n============================\n\nA2A (Agent-to-Agent) is an open standard p"
  },
  {
    "path": "docs/tutorial/en/src/task_agent.py",
    "chars": 15238,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _agent:\n\nAgent\n=========================\n\nIn this tutorial, we first focus on introducing"
  },
  {
    "path": "docs/tutorial/en/src/task_agent_skill.py",
    "chars": 3939,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _agent_skill:\n\nAgent Skill\n============================\n\n`Agent skill <https://claude.com"
  },
  {
    "path": "docs/tutorial/en/src/task_embedding.py",
    "chars": 4502,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _embedding:\n\nEmbedding\n=========================\n\nIn AgentScope, the embedding module pro"
  },
  {
    "path": "docs/tutorial/en/src/task_eval.py",
    "chars": 7749,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _eval:\n\nEvaluation\n=========================\n\nAgentScope provides a built-in evaluation f"
  },
  {
    "path": "docs/tutorial/en/src/task_eval_openjudge.py",
    "chars": 12232,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\nEvaluation with OpenJudge\n=========================\n\nThis guide introduces how to use [OpenJ"
  },
  {
    "path": "docs/tutorial/en/src/task_hook.py",
    "chars": 8083,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _hook:\n\nAgent Hooks\n===========================\n\nHooks are extension points in AgentScope"
  },
  {
    "path": "docs/tutorial/en/src/task_long_term_memory.py",
    "chars": 16811,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _long-term-memory:\n\nLong-Term Memory\n========================\n\nIn AgentScope, we provide "
  },
  {
    "path": "docs/tutorial/en/src/task_mcp.py",
    "chars": 6968,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _mcp:\n\nMCP\n=========================\n\nThe tutorial covers the following features of Agent"
  },
  {
    "path": "docs/tutorial/en/src/task_memory.py",
    "chars": 13913,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _memory:\n\nMemory\n========================\n\nThe memory module in AgentScope is responsible"
  },
  {
    "path": "docs/tutorial/en/src/task_middleware.py",
    "chars": 11837,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _middleware:\n\nMiddleware\n===========================\n\nAgentScope provides a flexible midd"
  },
  {
    "path": "docs/tutorial/en/src/task_model.py",
    "chars": 6855,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _model:\n\nModel\n====================\n\nIn this tutorial, we introduce the model APIs integr"
  },
  {
    "path": "docs/tutorial/en/src/task_pipeline.py",
    "chars": 9791,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _pipeline:\n\nPipeline\n========================\n\nFor multi-agent orchestration, AgentScope "
  },
  {
    "path": "docs/tutorial/en/src/task_plan.py",
    "chars": 10837,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _plan:\n\nPlan\n=========================\n\nThe Plan Module enables agents to formally break "
  },
  {
    "path": "docs/tutorial/en/src/task_prompt.py",
    "chars": 10219,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _prompt:\n\nPrompt Formatter\n=========================\n\nThe formatter module in AgentScope "
  },
  {
    "path": "docs/tutorial/en/src/task_rag.py",
    "chars": 14982,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _rag:\n\nRAG\n===========================\n\nAgentScope provides built-in support for Retrieva"
  },
  {
    "path": "docs/tutorial/en/src/task_realtime.py",
    "chars": 16297,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _realtime:\n\nRealtime Agent\n====================\n\nThe **realtime** agent is designed to ha"
  },
  {
    "path": "docs/tutorial/en/src/task_state.py",
    "chars": 6302,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _state:\n\nState/Session Management\n=================================\n\nIn AgentScope, the *"
  },
  {
    "path": "docs/tutorial/en/src/task_studio.py",
    "chars": 3322,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _studio:\n\nAgentScope Studio\n=========================\n\nAgentScope Studio is a local-deplo"
  },
  {
    "path": "docs/tutorial/en/src/task_token.py",
    "chars": 1751,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _token:\n\nToken\n=========================\n\nAgentScope provides a token counter module unde"
  },
  {
    "path": "docs/tutorial/en/src/task_tool.py",
    "chars": 14591,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tool:\n\nTool\n=========================\n\nTo ensure accurate and reliable tool parsing, Age"
  },
  {
    "path": "docs/tutorial/en/src/task_tracing.py",
    "chars": 7654,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tracing:\n\nTracing\n==============================\n\nAgentScope implements OpenTelemetry-ba"
  },
  {
    "path": "docs/tutorial/en/src/task_tts.py",
    "chars": 7800,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tts:\n\nTTS\n====================\n\nAgentScope provides a unified interface for Text-to-Spee"
  },
  {
    "path": "docs/tutorial/en/src/task_tuner.py",
    "chars": 9558,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tuner:\n\nTuner\n=================\n\nAgentScope provides the ``tuner`` module for training a"
  },
  {
    "path": "docs/tutorial/en/src/workflow_concurrent_agents.py",
    "chars": 1269,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\nConcurrent Agents\n===================================\nWith the help of asynchronous programm"
  },
  {
    "path": "docs/tutorial/en/src/workflow_conversation.py",
    "chars": 6302,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _conversation:\n\nConversation\n======================\n\nConversation is a design pattern tha"
  },
  {
    "path": "docs/tutorial/en/src/workflow_handoffs.py",
    "chars": 2683,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\nHandoffs\n========================================\n\n.. figure:: ../../_static/images/handoffs"
  },
  {
    "path": "docs/tutorial/en/src/workflow_multiagent_debate.py",
    "chars": 4759,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _multiagent-debate:\n\nMulti-Agent Debate\n========================\n\nDebate workflow simulat"
  },
  {
    "path": "docs/tutorial/en/src/workflow_routing.py",
    "chars": 4836,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _routing:\n\nRouting\n==========================\nThere are two ways to implement routing in "
  },
  {
    "path": "docs/tutorial/zh_CN/Makefile",
    "chars": 639,
    "preview": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line, and also\n# from the "
  },
  {
    "path": "docs/tutorial/zh_CN/build.sh",
    "chars": 407,
    "preview": "#!/bin/bash\n\nset -e\n\n# Clean old build files\nrm -rf build/ doctrees/\n\n# Build the html\nsphinx-build -M html ./ build\n\n# "
  },
  {
    "path": "docs/tutorial/zh_CN/conf.py",
    "chars": 7343,
    "preview": "# -*- coding: utf-8 -*-\n# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in con"
  },
  {
    "path": "docs/tutorial/zh_CN/index.rst",
    "chars": 1580,
    "preview": ".. AgentScope Doc documentation master file, created by\n   sphinx-quickstart on Thu Aug  8 15:07:21 2024.\n   You can ada"
  },
  {
    "path": "docs/tutorial/zh_CN/make.bat",
    "chars": 769,
    "preview": "@ECHO OFF\n\npushd %~dp0\n\nREM Command file for Sphinx documentation\n\nif \"%SPHINXBUILD%\" == \"\" (\n\tset SPHINXBUILD=sphinx-bu"
  },
  {
    "path": "docs/tutorial/zh_CN/src/README.md",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "docs/tutorial/zh_CN/src/faq.py",
    "chars": 1413,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _faq:\n\n常见问题\n========================================\n\n关于 AgentScope\n~~~~~~~~~~~~~~~~~~~~~"
  },
  {
    "path": "docs/tutorial/zh_CN/src/quickstart_agent.py",
    "chars": 5452,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _react-agent:\n\n创建 ReAct 智能体\n====================\n\nAgentScope 在 ``agentscope.agent`` 模块下提供"
  },
  {
    "path": "docs/tutorial/zh_CN/src/quickstart_installation.py",
    "chars": 831,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _installation:\n\n安装\n============================\n\nAgentScope 需要 Python 3.10 或更高版本。您可以从源代码或"
  },
  {
    "path": "docs/tutorial/zh_CN/src/quickstart_key_concept.py",
    "chars": 2538,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. key-concepts:\n\n核心概念\n====================================\n\n本章从工程实践的角度介绍 AgentScope 中的核心概念,"
  },
  {
    "path": "docs/tutorial/zh_CN/src/quickstart_message.py",
    "chars": 5658,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _message:\n\n创建消息\n====================\n\n消息是 AgentScope 中的核心概念,用于支持多模态数据、工具 API、信息存储/交换和提示构建"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_a2a.py",
    "chars": 5504,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _a2a:\n\nA2A 智能体\n============================\n\nA2A(Agent-to-Agent)是一种开放标准协议,用于实现不同 AI 智能体之间"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_agent.py",
    "chars": 10544,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _agent:\n\n智能体\n=========================\n\n在章我们首先重点介绍 AgentScope 中的 ReAct 智能体,然后简要介绍如何从零开始自定"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_agent_skill.py",
    "chars": 2764,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _agent_skill:\n\n智能体技能\n============================\n\n`智能体技能(Agent skill) <https://claude.co"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_embedding.py",
    "chars": 3317,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _embedding:\n\n嵌入(Embedding)\n=========================\n\nAgentScope 中,嵌入模块提供了用于向量生成的统一接口,具有以"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_eval.py",
    "chars": 6165,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _eval:\n\n智能体评测\n=========================\n\nAgentScope 提供了一个内置的评测框架,用于评测智能体在不同任务和基准测试中的性能,主要"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_eval_openjudge.py",
    "chars": 11079,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\nOpenJudge 评估器\n=======================\n\n[OpenJudge](https://github.com/agentscope-ai/OpenJudg"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_hook.py",
    "chars": 5380,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _hook:\n\n智能体钩子函数\n===========================\n\n钩子(Hook)是 AgentScope 中的扩展点,允许开发者在特定位置自定义智能体行"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_long_term_memory.py",
    "chars": 12506,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _long-term-memory:\n\n长期记忆\n========================\n\nAgentScope 为长期记忆提供了一个基类 ``LongTermMemo"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_mcp.py",
    "chars": 4655,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _mcp:\n\nMCP\n=========================\n\n本章将介绍 AgentScope 对 MCP(Model Context Protocol)的以下支持"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_memory.py",
    "chars": 10385,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _memory:\n\n记忆\n========================\n\nAgentScope 中的记忆模块负责:\n\n- 存储消息对象(``Msg``)\n- 利用标记(mar"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_middleware.py",
    "chars": 8735,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _middleware:\n\n中间件\n===========================\n\nAgentScope 提供了灵活的中间件系统,允许开发者拦截和修改各种操作的执行。\n"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_model.py",
    "chars": 5195,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _model:\n\n模型\n====================\n\n在本教程中,我们介绍 AgentScope 中集成的模型 API、如何使用它们,以及如何集成新的模型 API。"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_pipeline.py",
    "chars": 6532,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _pipeline:\n\n管道 (Pipeline)\n========================\n\n对于多智能体编排,AgentScope 提供了 ``agentscope."
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_plan.py",
    "chars": 6628,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _plan:\n\n计划\n=========================\n\nAgentScope 中的计划(Plan)模块使智能体能够正式地将复杂任务分解为可管理的子任务并系统地"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_prompt.py",
    "chars": 7586,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _prompt:\n\n提示词格式化\n=========================\n\nAgentScope 中的格式化器(formatter)模块负责\n\n- 将 Msg 对象转"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_rag.py",
    "chars": 10508,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _rag:\n\nRAG\n==========================\n\nAgentScope 提供了内置的 RAG(Retrieval-Augmented Generati"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_realtime.py",
    "chars": 11906,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _realtime:\n\n实时智能体\n====================\n\n**实时智能体(Realtime Agent)** 用于处理实时交互场景,例如语音对话或实时聊天会"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_state.py",
    "chars": 4680,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _state:\n\n状态/会话管理\n=================================\n\n在 AgentScope 中,**\"状态\"** 是指智能体在运行中某一时刻"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_studio.py",
    "chars": 2094,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _studio:\n\nAgentScope Studio\n=========================\n\nAgentScope Studio 是一个本地部署的 Web 应用程"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_token.py",
    "chars": 1459,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _token:\n\nToken 计数\n=========================\n\nAgentScope 在 ``agentscope.token`` 模块下提供了 tok"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_tool.py",
    "chars": 10166,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tool:\n\n工具\n=========================\n\n为了确保准确可靠的工具解析,AgentScope 全面支持工具 API 的使用,具有以下特性:\n\n- "
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_tracing.py",
    "chars": 5479,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tracing:\n\n追踪\n==============================\n\nAgentScope 实现了基于 OpenTelemetry 的追踪来监控和调试\n智能"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_tts.py",
    "chars": 5438,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tts:\n\nTTS\n====================\n\nAgentScope 为多个 API 提供商的文本转语音(TTS)模型提供了统一接口。\n本章节演示如何在 Age"
  },
  {
    "path": "docs/tutorial/zh_CN/src/task_tuner.py",
    "chars": 6700,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _tuner:\n\nTuner\n=================\n\nAgentScope 提供了 ``tuner`` 模块,用于通过强化学习(RL)训练智能体应用。\n本教程将带你"
  },
  {
    "path": "docs/tutorial/zh_CN/src/workflow_concurrent_agents.py",
    "chars": 1029,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n\nConcurrent Agents\n===================================\n在异步编程的帮助下,多智能体并发可以通过 Python 中的 ``asyn"
  },
  {
    "path": "docs/tutorial/zh_CN/src/workflow_conversation.py",
    "chars": 4469,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _conversation:\n\nConversation\n======================\n\nConversation 是一种智能体间交换和共享信息的设计模式,常见于"
  },
  {
    "path": "docs/tutorial/zh_CN/src/workflow_handoffs.py",
    "chars": 2207,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _handoffs:\n\nHandoffs\n========================================\n\nHandoffs 是由 OpenAI 提出的工作流模"
  },
  {
    "path": "docs/tutorial/zh_CN/src/workflow_multiagent_debate.py",
    "chars": 3148,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _multiagent-debate:\n\nMulti-Agent Debate\n========================\n\nMulti-Agent debate 模拟不同"
  },
  {
    "path": "docs/tutorial/zh_CN/src/workflow_routing.py",
    "chars": 3768,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _routing:\n\nRouting\n==========================\n在 AgentScope 中有两种实现 Routing 的方法,都简单易实现:\n\n- "
  },
  {
    "path": "examples/agent/a2a_agent/README.md",
    "chars": 1691,
    "preview": "# Agent-to-Agent Protocol Example\n\nThe `A2AAgent` in AgentScope is an A2A client that connects to an external agent serv"
  },
  {
    "path": "examples/agent/a2a_agent/agent_card.py",
    "chars": 1172,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"The agent card definition for the A2A agent.\"\"\"\nfrom a2a.types import AgentCard, AgentCapabil"
  },
  {
    "path": "examples/agent/a2a_agent/main.py",
    "chars": 587,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"The main entry for the A2A agent example.\"\"\"\nimport asyncio\n\nfrom agent_card import agent_car"
  },
  {
    "path": "examples/agent/a2a_agent/setup_a2a_server.py",
    "chars": 3987,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Set up an A2A server with a ReAct agent to handle the input query\"\"\"\nimport os\nimport uuid\nfr"
  },
  {
    "path": "examples/agent/a2ui_agent/README.md",
    "chars": 5697,
    "preview": "# A2UI in AgentScope\n\n[A2UI (Agent-to-Agent UI)](https://github.com/google/A2UI) is a protocol for agents to send\nstream"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/a2a_client.py",
    "chars": 5288,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"A2A client example demonstrating agent card fetching and message sending.\"\"\"\nimport logging\n\n"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/README.md",
    "chars": 658,
    "preview": "# A2UI Generator\n\nThis is a UI to generate and visualize A2UI responses.\n\n## Prerequisites\n\n1. [nodejs](https://nodejs.o"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/client.ts",
    "chars": 1797,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/contact.ts",
    "chars": 9471,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/events/events.ts",
    "chars": 1004,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/index.html",
    "chars": 6058,
    "preview": "<!DOCTYPE html>\n<!--\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you m"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/middleware/a2a.ts",
    "chars": 4678,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/middleware/index.ts",
    "chars": 614,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/package.json",
    "chars": 1859,
    "preview": "{\n  \"name\": \"@a2ui/contact\",\n  \"private\": true,\n  \"version\": \"0.8.1\",\n  \"description\": \"A2UI Contact Demo\",\n  \"main\": \"."
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/theme/theme.ts",
    "chars": 10694,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/tsconfig.json",
    "chars": 837,
    "preview": "{\n  \"$schema\": \"https://json.schemastore.org/tsconfig\",\n\n  \"compilerOptions\": {\n    \"composite\": false,\n    \"declaration"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/types/types.ts",
    "chars": 1132,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/README.md",
    "chars": 4396,
    "preview": "# A2UI custom component integration guide\n\nThis guide details how to create, register, and use a custom component in the"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/org-chart.ts",
    "chars": 4000,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/premium-text-field.ts",
    "chars": 2601,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/register-components.ts",
    "chars": 1081,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/test/README.md",
    "chars": 1206,
    "preview": "# Contact sample verification tests\n\nThis directory contains tests to verify custom component integration specifically w"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/test/org-chart-test.html",
    "chars": 2593,
    "preview": "<!--\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this "
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/test/override-test.html",
    "chars": 1043,
    "preview": "<!--\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this "
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/custom-components/test/override-test.ts",
    "chars": 1511,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/snackbar.ts",
    "chars": 7335,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/ui/ui.ts",
    "chars": 610,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/contact/vite.config.ts",
    "chars": 1218,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/package.json",
    "chars": 1284,
    "preview": "{\n  \"name\": \"@a2ui/lit-samples\",\n  \"private\": true,\n  \"version\": \"0.8.1\",\n  \"description\": \"A2UI Lit Samples\",\n  \"worksp"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/README.md",
    "chars": 2207,
    "preview": "# A2UI Generator\n\nThis is a UI to generate and visualize A2UI responses.\n\n## Prerequisites\n\n1. [nodejs](https://nodejs.o"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/THEMING.md",
    "chars": 8845,
    "preview": "# A2UI Theming & Configuration Guide\n\nThis guide explains how the Universal App Shell handles theming and how to add new"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/app.ts",
    "chars": 14248,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/client.ts",
    "chars": 3926,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/configs/contacts.ts",
    "chars": 8872,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/configs/restaurant.ts",
    "chars": 1614,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/configs/types.ts",
    "chars": 1389,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/events/events.ts",
    "chars": 1004,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/index.html",
    "chars": 7389,
    "preview": "<!DOCTYPE html>\n<!--\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you m"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/middleware/a2a.ts",
    "chars": 4678,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/middleware/index.ts",
    "chars": 614,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/package.json",
    "chars": 1915,
    "preview": "{\n  \"name\": \"@a2ui/shell\",\n  \"private\": true,\n  \"version\": \"0.8.1\",\n  \"description\": \"A2UI Universal Shell\",\n  \"main\": \""
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/theme/clone-default-theme.ts",
    "chars": 741,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/theme/default-theme.ts",
    "chars": 10925,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/tsconfig.json",
    "chars": 837,
    "preview": "{\n  \"$schema\": \"https://json.schemastore.org/tsconfig\",\n\n  \"compilerOptions\": {\n    \"composite\": false,\n    \"declaration"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/types/types.ts",
    "chars": 1132,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/ui/snackbar.ts",
    "chars": 7335,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/ui/ui.ts",
    "chars": 610,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/client/lit/shell/vite.config.ts",
    "chars": 1216,
    "preview": "/*\n Copyright 2025 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this fi"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/__main__.py",
    "chars": 1022,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Main entry point for running the restaurant finder A2UI server.\"\"\"\nimport logging\nimport os\ni"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.py",
    "chars": 10795,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Utility functions for A2UI agent integration.\"\"\"\nimport json\nfrom typing import Any\nfrom pyda"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/agent_card.py",
    "chars": 1289,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"The agent card definition for the A2A agent.\"\"\"\nfrom a2a.types import AgentCard, AgentCapabil"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/prompt_builder.py",
    "chars": 4034,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Prompt builder for Agent with A2UI support.\"\"\"\n# Copyright 2025 Google LLC\n#\n# Licensed under"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/pyproject.toml",
    "chars": 545,
    "preview": "[project]\nname = \"general-agent\"\nversion = \"0.1.0\"\nrequires-python = \">=3.10\"\ndependencies = [\n    \"agentscope[a2a]\",\n  "
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.py",
    "chars": 9524,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Set up an A2A server with a ReAct agent to handle the input query\"\"\"\nimport os\nimport uuid\nim"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/SKILL.md",
    "chars": 8185,
    "preview": "---\nname: A2UI_response_generator\ndescription: A skill that can retrieve A2UI UI JSON schematics and UI templates that b"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/__init__.py",
    "chars": 1453,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template examples for generating UI responses.\"\"\"\nfrom .booking_for"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/booking_form.py",
    "chars": 2682,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for booking form.\"\"\"\n\nBOOKING_FORM_WITH_IMAGE = \"\""
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/contact_form.py",
    "chars": 2239,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for contact form.\"\"\"\n\nCONTACT_FORM_EXAMPLE = \"\"\"\n-"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/email_compose_form.py",
    "chars": 3539,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for email compose form.\"\"\"\n\nEMAIL_COMPOSE_FORM_EXA"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/error_message.py",
    "chars": 1778,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for error message.\"\"\"\n\nERROR_MESSAGE_EXAMPLE = \"\"\""
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/info_message.py",
    "chars": 1732,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for info message.\"\"\"\n\nINFO_MESSAGE_EXAMPLE = \"\"\"\n-"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/item_detail_card_with_image.py",
    "chars": 4594,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for item detail card with image.\"\"\"\n\n# Detail exam"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/profile_view.py",
    "chars": 5039,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for profile view.\"\"\"\n\nPROFILE_VIEW_WITH_IMAGE_EXAM"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/search_filter_form.py",
    "chars": 3338,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for search filter form.\"\"\"\n\nSEARCH_FILTER_FORM_EXA"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/selection_card.py",
    "chars": 8655,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for selection card.\"\"\"\n\nSELECTION_CARD_EXAMPLE = \""
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/simple_column_list_without_image.py",
    "chars": 2351,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for simple column list without images.\"\"\"\n\nSIMPLE_"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/single_column_list.py",
    "chars": 3058,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for single column list with images.\"\"\"\n\n# List exa"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/success_confirmation_with_image.py",
    "chars": 2396,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for success confirmation with image.\"\"\"\n# Confirma"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/two_column_list.py",
    "chars": 4033,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI template example for two column grid list with images.\"\"\"\n\nTWO_COLU"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/__init__.py",
    "chars": 232,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"A2UI response generator skill package.\"\"\"\nfrom .view_a2ui_schema import view_a2ui_schema\nfrom"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/schema/__init__.py",
    "chars": 159,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"A2UI schema module for validating A2UI protocol messages.\"\"\"\nfrom .base_schema import A2UI_SC"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/schema/base_schema.py",
    "chars": 35156,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"A2UI base schema definition for validating A2UI protocol messages.\"\"\"\n# "
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/view_a2ui_examples.py",
    "chars": 4076,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"\nA2UI Example Viewer - Tool for viewing A2UI UI template examples.\n\nThis"
  },
  {
    "path": "examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/view_a2ui_schema.py",
    "chars": 1788,
    "preview": "# -*- coding: utf-8 -*-\n# flake8: noqa: E501\n\"\"\"\nA2UI Schema Viewer - Tool for viewing A2UI schema.\n\nThis script provide"
  },
  {
    "path": "examples/agent/browser_agent/README.md",
    "chars": 1143,
    "preview": "# Browser Agent Example\n\nThis example demonstrates how to use AgentScope's BrowserAgent for web automation tasks. The Br"
  },
  {
    "path": "examples/agent/browser_agent/browser_agent.py",
    "chars": 47397,
    "preview": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"Browser Agent\"\"\"\n# flake8: noqa: E501\n# pylint: disable=W0212,too-many"
  },
  {
    "path": "examples/agent/browser_agent/build_in_helper/_file_download.py",
    "chars": 7222,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Standalone file download skill for the browser agent.\"\"\"\n# flake8: noqa: E501\n# pylint: disab"
  },
  {
    "path": "examples/agent/browser_agent/build_in_helper/_form_filling.py",
    "chars": 6536,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Standalone form filling skill for the browser agent.\"\"\"\n# flake8: noqa: E501\n# pylint: disabl"
  },
  {
    "path": "examples/agent/browser_agent/build_in_helper/_image_understanding.py",
    "chars": 4800,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Standalone image understanding skill for the browser agent.\"\"\"\n# flake8: noqa: E501\n# pylint:"
  },
  {
    "path": "examples/agent/browser_agent/build_in_helper/_video_understanding.py",
    "chars": 8787,
    "preview": "# -*- coding: utf-8 -*-\n\"\"\"Standalone video understanding skill for the browser agent.\"\"\"\n# flake8: noqa: E501\n# pylint:"
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_decompose_reflection_prompt.md",
    "chars": 1543,
    "preview": "Your role is to assess and optimize task decomposition for browser automation. Specifically, you will evaluate:\nWhether "
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_file_download_sys_prompt.md",
    "chars": 791,
    "preview": "You are a meticulous web automation specialist. Study the provided page snapshot carefully before acting.\nIdentify the e"
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_form_filling_sys_prompt.md",
    "chars": 1481,
    "preview": "You are a specialized web form operator. Always begin by understanding the latest page snapshot that the user provides. "
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_observe_reasoning_prompt.md",
    "chars": 1651,
    "preview": "You are viewing a website snapshot in multiple chunks because the content is too long to display at once.\nContext from p"
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_pure_reasoning_prompt.md",
    "chars": 1256,
    "preview": "Current subtask to be completed: {current_subtask}\n\nPlease carefully evaluate whether you need to use a tool to achieve "
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_subtask_revise_prompt.md",
    "chars": 1429,
    "preview": "You are an expert in web task decomposition and revision. Based on the current progress, memory content, and the origina"
  },
  {
    "path": "examples/agent/browser_agent/build_in_prompt/browser_agent_summarize_task.md",
    "chars": 1057,
    "preview": "## Instruction\nReview the execution trace above and generate a comprehensive summary report that addresses the original "
  }
]

// ... and 366 more files (download for full content)

About this extraction

This page contains the full source code of the agentscope-ai/agentscope GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 566 files (3.6 MB), approximately 970.3k tokens, and a symbol index with 2374 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!