in a2a/a2a-core/src/commonTest/kotlin/ai/koog/a2a/model/AgentCardSerializationTest.kt [15:69]
fun testMinimalAgentCardSerialization() {
val agentCard = AgentCard(
name = "Test Agent",
description = "A test agent",
url = "https://api.example.com/a2a",
version = "1.0.0",
capabilities = AgentCapabilities(),
defaultInputModes = listOf("text/plain"),
defaultOutputModes = listOf("text/plain"),
skills = listOf(
AgentSkill(
id = "test-skill",
name = "Test Skill",
description = "A test skill",
tags = listOf("test")
)
)
)
//language=JSON
val expectedJson = """
{
"protocolVersion": "0.3.0",
"name": "Test Agent",
"description": "A test agent",
"url": "https://api.example.com/a2a",
"preferredTransport": "JSONRPC",
"version": "1.0.0",
"capabilities": {},
"defaultInputModes": [
"text/plain"
],
"defaultOutputModes": [
"text/plain"
],
"skills": [
{
"id": "test-skill",
"name": "Test Skill",
"description": "A test skill",
"tags": [
"test"
]
}
]
}
""".trimIndent()
val actualJson = TestJson.encodeToString(agentCard)
assertEquals(expectedJson, actualJson)
// Test deserialization
val deserializedCard = TestJson.decodeFromString<AgentCard>(actualJson)
assertEquals(agentCard, deserializedCard)
}