Skip to content

Commit b27b210

Browse files
committed
Updates to types
1 parent a2bbdbe commit b27b210

27 files changed

+226
-220
lines changed

src/a2a/client/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create_text_message_object(
1515
content: The text content of the message. Defaults to an empty string.
1616
1717
Returns:
18-
A `Message` object with a new UUID messageId.
18+
A `Message` object with a new UUID message_id.
1919
"""
2020
return Message(
2121
role=role, parts=[Part(TextPart(text=content))], message_id=str(uuid4())

src/a2a/server/request_handlers/default_request_handler.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ async def _setup_message_execution(
184184
"""
185185
# Create task manager and validate existing task
186186
task_manager = TaskManager(
187-
task_id=params.message.taskId,
187+
task_id=params.message.task_id,
188188
context_id=params.message.context_id,
189189
task_store=self.task_store,
190190
initial_message=params.message,
@@ -218,10 +218,10 @@ async def _setup_message_execution(
218218
if (
219219
self._push_config_store
220220
and params.configuration
221-
and params.configuration.pushNotificationConfig
221+
and params.configuration.push_notification_config
222222
):
223223
await self._push_config_store.set_info(
224-
task_id, params.configuration.pushNotificationConfig
224+
task_id, params.configuration.push_notification_config
225225
)
226226

227227
queue = await self._queue_manager.create_or_tap(task_id)
@@ -366,13 +366,13 @@ async def on_set_task_push_notification_config(
366366
if not self._push_config_store:
367367
raise ServerError(error=UnsupportedOperationError())
368368

369-
task: Task | None = await self.task_store.get(params.taskId)
369+
task: Task | None = await self.task_store.get(params.task_id)
370370
if not task:
371371
raise ServerError(error=TaskNotFoundError())
372372

373373
await self._push_config_store.set_info(
374-
params.taskId,
375-
params.pushNotificationConfig,
374+
params.task_id,
375+
params.push_notification_config,
376376
)
377377

378378
return params
@@ -404,7 +404,8 @@ async def on_get_task_push_notification_config(
404404
)
405405

406406
return TaskPushNotificationConfig(
407-
taskId=params.id, pushNotificationConfig=push_notification_config[0]
407+
task_id=params.id,
408+
pushNotificationConfig=push_notification_config[0],
408409
)
409410

410411
async def on_resubscribe_to_task(
@@ -470,7 +471,7 @@ async def on_list_task_push_notification_config(
470471
for config in push_notification_config_list:
471472
task_push_notification_config.append(
472473
TaskPushNotificationConfig(
473-
taskId=params.id, pushNotificationConfig=config
474+
task_id=params.id, pushNotificationConfig=config
474475
)
475476
)
476477

@@ -493,5 +494,5 @@ async def on_delete_task_push_notification_config(
493494
raise ServerError(error=TaskNotFoundError())
494495

495496
await self._push_config_store.delete_info(
496-
params.id, params.pushNotificationConfigId
497+
params.id, params.push_notification_configId
497498
)

src/a2a/server/request_handlers/grpc_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ async def GetTaskPushNotificationConfig(
224224
return a2a_pb2.TaskPushNotificationConfig()
225225

226226
@validate(
227-
lambda self: self.agent_card.capabilities.pushNotifications,
227+
lambda self: self.agent_card.capabilities.push_notifications,
228228
'Push notifications are not supported by the agent',
229229
)
230230
async def CreateTaskPushNotificationConfig(

src/a2a/server/request_handlers/jsonrpc_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def get_push_notification_config(
255255
)
256256

257257
@validate(
258-
lambda self: self.agent_card.capabilities.pushNotifications,
258+
lambda self: self.agent_card.capabilities.push_notifications,
259259
'Push notifications are not supported by the agent',
260260
)
261261
async def set_push_notification_config(

src/a2a/server/tasks/task_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async def save_task_event(
9999
when the TaskManager's ID is already set.
100100
"""
101101
task_id_from_event = (
102-
event.id if isinstance(event, Task) else event.taskId
102+
event.id if isinstance(event, Task) else event.task_id
103103
)
104104
# If task id is known, make sure it is matched
105105
if self.task_id and self.task_id != task_id_from_event:
@@ -172,12 +172,12 @@ async def ensure_task(
172172
if not task:
173173
logger.info(
174174
'Task not found or task_id not set. Creating new task for event (task_id: %s, context_id: %s).',
175-
event.taskId,
175+
event.task_id,
176176
event.context_id,
177177
)
178178
# streaming agent did not previously stream task object.
179179
# Create a task object with the available information and persist the event
180-
task = self._init_task_obj(event.taskId, event.context_id)
180+
task = self._init_task_obj(event.task_id, event.context_id)
181181
await self._save_task(task)
182182

183183
return task

src/a2a/server/tasks/task_updater.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def update_status(
7474
)
7575
await self.event_queue.enqueue_event(
7676
TaskStatusUpdateEvent(
77-
taskId=self.task_id,
77+
task_id=self.task_id,
7878
context_id=self.context_id,
7979
final=final,
8080
status=TaskStatus(
@@ -109,7 +109,7 @@ async def add_artifact( # noqa: PLR0913
109109

110110
await self.event_queue.enqueue_event(
111111
TaskArtifactUpdateEvent(
112-
taskId=self.task_id,
112+
task_id=self.task_id,
113113
context_id=self.context_id,
114114
artifact=Artifact(
115115
artifactId=artifact_id,
@@ -197,7 +197,7 @@ def new_agent_message(
197197
"""
198198
return Message(
199199
role=Role.agent,
200-
taskId=self.task_id,
200+
task_id=self.task_id,
201201
context_id=self.context_id,
202202
messageId=str(uuid.uuid4()),
203203
metadata=metadata,

src/a2a/utils/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ def append_artifact_to_task(task: Task, event: TaskArtifactUpdateEvent) -> None:
6262
task.artifacts = []
6363

6464
new_artifact_data: Artifact = event.artifact
65-
artifact_id: str = new_artifact_data.artifactId
65+
artifact_id: str = new_artifact_data.artifact_id
6666
append_parts: bool = event.append or False
6767

6868
existing_artifact: Artifact | None = None
6969
existing_artifact_list_index: int | None = None
7070

7171
# Find existing artifact by its id
7272
for i, art in enumerate(task.artifacts):
73-
if art.artifactId == artifact_id:
73+
if art.artifact_id == artifact_id:
7474
existing_artifact = art
7575
existing_artifact_list_index = i
7676
break

src/a2a/utils/message.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def new_agent_text_message(
3434
return Message(
3535
role=Role.agent,
3636
parts=[Part(root=TextPart(text=text))],
37-
messageId=str(uuid.uuid4()),
38-
taskId=task_id,
37+
message_id=str(uuid.uuid4()),
38+
task_id=task_id,
3939
context_id=context_id,
4040
)
4141

@@ -58,8 +58,8 @@ def new_agent_parts_message(
5858
return Message(
5959
role=Role.agent,
6060
parts=parts,
61-
messageId=str(uuid.uuid4()),
62-
taskId=task_id,
61+
message_id=str(uuid.uuid4()),
62+
task_id=task_id,
6363
context_id=context_id,
6464
)
6565

0 commit comments

Comments
 (0)