Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
feat(event): add metadata in EventBase (#1788)
qbc9419a6a0e6fa
diff --git a/README.md b/README.mdindex 9173f35ec..e40070db7 100644--- a/README.md+++ b/README.md@@ -73,6 +73,7 @@ rather than constraining them with strict prompts and opinionated orchestrations## News<!-- BEGIN NEWS -->+- **[2026-06] `FEAT`:** Agent Team support. [Example](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent_service) | [Docs](https://docs.agentscope.io/v2/deploy/agent-team)- **[2026-05] `RELS`:** AgentScope 2.0 released! [Docs](https://docs.agentscope.io/)<!-- END NEWS -->diff --git a/README_zh.md b/README_zh.mdindex 4a5bedda4..6d6fbbdbe 100644--- a/README_zh.md+++ b/README_zh.md@@ -73,6 +73,7 @@ AgentScope 2.0 是一款生产就绪、易于使用的智能体框架,提供## 新闻<!-- BEGIN NEWS -->+- **[2026-06] `功能`:** 支持 Agent Team。[样例](https://github.com/agentscope-ai/agentscope/tree/main/examples/agent_service) | [文档](https://docs.agentscope.io/zh/v2/deploy/agent-team)- **[2026-05] `发布`:** AgentScope 2.0 已发布<!-- END NEWS -->diff --git a/src/agentscope/event/_event.py b/src/agentscope/event/_event.pyindex ae40b96d9..922e3831a 100644--- a/src/agentscope/event/_event.py+++ b/src/agentscope/event/_event.py@@ -3,7 +3,7 @@import uuidfrom datetime import datetimefrom enum import StrEnum-from typing import Literal, List, TypeAlias+from typing import Any, Dict, Literal, List, TypeAliasfrom pydantic import BaseModel, Field, ConfigDict@@ -69,6 +69,8 @@ class EventBase(BaseModel):"""Unique event identifier."""created_at: str = Field(default_factory=lambda: datetime.now().isoformat())"""ISO 8601 timestamp of when the event was created."""+ metadata: Dict[str, Any] = Field(default_factory=dict)+ """Optional metadata attached to the event."""class ReplyStartEvent(EventBase):diff --git a/tests/agent_basic_test.py b/tests/agent_basic_test.pyindex 59ed5b462..dfa9d8c8b 100644--- a/tests/agent_basic_test.py+++ b/tests/agent_basic_test.py@@ -112,6 +112,7 @@ class AgentBasicTest(IsolatedAsyncioTestCase):return {"id": AnyString(),"created_at": AnyString(),+ "metadata": {},"reply_id": reply_id,}diff --git a/tests/event_test.py b/tests/event_test.pyindex 24df95ea1..f766d9556 100644--- a/tests/event_test.py+++ b/tests/event_test.py@@ -24,6 +24,7 @@ class EventTest(IsolatedAsyncioTestCase):"type": "REPLY_START","id": AnyString(),"created_at": AnyString(),+ "metadata": {},"session_id": "test_session","reply_id": "test_reply","name": "Friday",diff --git a/tests/hitl_external_execution_test.py b/tests/hitl_external_execution_test.pyindex e4627bda2..8bb381faa 100644--- a/tests/hitl_external_execution_test.py+++ b/tests/hitl_external_execution_test.py@@ -170,6 +170,7 @@ class AgentExternalExecutionTest(IsolatedAsyncioTestCase):return {"id": AnyString(),"created_at": AnyString(),+ "metadata": {},"reply_id": reply_id,}diff --git a/tests/hitl_user_confirmation_test.py b/tests/hitl_user_confirmation_test.pyindex ce0027369..e8820a503 100644--- a/tests/hitl_user_confirmation_test.py+++ b/tests/hitl_user_confirmation_test.py@@ -219,6 +219,7 @@ class AgentUserConfirmationTest(IsolatedAsyncioTestCase):return {"id": AnyString(),"created_at": AnyString(),+ "metadata": {},"reply_id": reply_id,}