Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/run-tck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ jobs:
uv run run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category capabilities --transports jsonrpc
working-directory: tck/a2a-tck

- name: Run TCK (quality)
id: run-tck-quality
run: |
uv run run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category quality --transports jsonrpc
working-directory: tck/a2a-tck

- name: Run TCK (features)
id: run-tck-features
run: |
uv run run_tck.py --sut-url ${{ env.SUT_JSONRPC_URL }} --category features --transports jsonrpc
working-directory: tck/a2a-tck

- name: Stop SUT
if: always()
run: |
Expand Down
1 change: 1 addition & 0 deletions src/a2a/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ class A2ABaseModel(BaseModel):
validate_by_alias=True,
serialize_by_alias=True,
alias_generator=to_camel_custom,
extra='forbid',
)
39 changes: 39 additions & 0 deletions tck/sut_agent.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import asyncio
import logging
import os
import uuid

from datetime import datetime, timezone

import uvicorn

from a2a.server.agent_execution.agent_executor import AgentExecutor
from a2a.server.agent_execution.context import RequestContext
from a2a.server.apps import A2AStarletteApplication
from a2a.server.events.event_queue import EventQueue
from a2a.server.request_handlers.default_request_handler import (
DefaultRequestHandler,
)
from a2a.server.tasks.inmemory_task_store import InMemoryTaskStore
from a2a.types import (
AgentCapabilities,
AgentCard,
AgentProvider,
Message,
TaskState,
TaskStatus,
TaskStatusUpdateEvent,
TextPart,
FilePart,
DataPart,
InvalidParamsError,
)
from a2a.utils.errors import ServerError

Check failure on line 31 in tck/sut_agent.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Ruff (I001)

tck/sut_agent.py:1:1: I001 Import block is un-sorted or un-formatted


JSONRPC_URL = '/a2a/jsonrpc'
Expand Down Expand Up @@ -67,6 +71,41 @@
task_id = context.task_id
context_id = context.context_id

# Validate message parts
if not user_message.parts:
# Empty parts array is invalid
raise ServerError(
error=InvalidParamsError(message='Message must contain at least one part')
)

for part in user_message.parts:
# Unwrap RootModel if present to get the actual part
actual_part = part
if hasattr(part, 'root'):
actual_part = part.root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

There's a minor indentation issue here. This line has an extra space at the beginning. Please correct it for code style consistency.

Suggested change
actual_part = part.root
actual_part = part.root


# Check if it's a known part type
if not isinstance(actual_part, (TextPart, FilePart, DataPart)):
# If we received something that isn't a known part, treating it as unsupported.
# Enqueue a failed status event.
await event_queue.enqueue_event(TaskStatusUpdateEvent(
task_id=task_id,
context_id=context_id,
status=TaskStatus(
state=TaskState.failed,
message=Message(
role='agent',
message_id=str(uuid.uuid4()),
parts=[TextPart(text='Unsupported message part type')],
task_id=task_id,
context_id=context_id,
Comment on lines +100 to +101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

The task_id and context_id fields are already present in the parent TaskStatusUpdateEvent object. Including them again in this nested Message object is redundant. Consider removing them to improve code clarity and avoid data duplication.

),
timestamp=datetime.now(timezone.utc).isoformat(),
),
final=True,
))
return

self.running_tasks.add(task_id)

logger.info(
Expand Down
Loading