This commit is contained in:
a2a-platform
2026-07-08 12:05:26 +00:00
parent 5154e2e53a
commit 4e43fbe8e2
4 changed files with 543 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
Generated A2APack agent for a2a cloud blog API.
- Source OpenAPI: https://blog.a2acloud.io/openapi.json
- Generated operations: 6
- Generated operations: 10
- Main skill: `auto`
- Routing mode: direct operation skills

View File

@@ -1,9 +1,9 @@
name: blog-openapi-agent
version: 0.1.0
entrypoint: agent:BlogOpenapiAgent
description: Publishing and read API for the a2a cloud blog. Published content is
public; draft, preview, create, update, and delete operations require the blog API
key.
description: Publishing, read, comment, and reaction API for the a2a cloud blog. Published
content and comments are public; publishing requires the blog API key; comment and
reaction writes require an a2a Cloud browser session.
runtime:
resources:
cpu: 200m

174
agent.py

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,26 @@
}
},
"responses": {
"A2AAuthUnavailable": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginErrorResponse"
}
}
},
"description": "a2a Cloud authentication is unavailable."
},
"A2AUnauthorized": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginErrorResponse"
}
}
},
"description": "An a2a Cloud browser session is required."
},
"AuthNotConfigured": {
"content": {
"application/json": {
@@ -57,6 +77,61 @@
}
},
"schemas": {
"BlogComment": {
"properties": {
"author_name": {
"example": "Dev User",
"type": "string"
},
"body": {
"example": "This cleared up the deployment flow.",
"maxLength": 4000,
"minLength": 2,
"type": "string"
},
"created_at": {
"format": "date-time",
"type": "string"
},
"id": {
"example": 12,
"format": "int64",
"type": "integer"
},
"post_id": {
"example": 42,
"format": "int64",
"type": "integer"
},
"updated_at": {
"format": "date-time",
"type": "string"
}
},
"required": [
"id",
"post_id",
"author_name",
"body",
"created_at",
"updated_at"
],
"type": "object"
},
"BlogCommentInput": {
"properties": {
"body": {
"example": "This cleared up the deployment flow.",
"maxLength": 4000,
"minLength": 2,
"type": "string"
}
},
"required": [
"body"
],
"type": "object"
},
"BlogPost": {
"properties": {
"author": {
@@ -201,6 +276,62 @@
],
"type": "object"
},
"BlogReaction": {
"enum": [
"like",
"dislike"
],
"type": "string"
},
"BlogReactionInput": {
"properties": {
"reaction": {
"description": "Set to null to clear the viewer's reaction.",
"oneOf": [
{
"$ref": "#/components/schemas/BlogReaction"
},
{
"type": "null"
}
]
}
},
"required": [
"reaction"
],
"type": "object"
},
"BlogReactionSummary": {
"properties": {
"dislikes": {
"example": 1,
"minimum": 0,
"type": "integer"
},
"likes": {
"example": 10,
"minimum": 0,
"type": "integer"
},
"viewer_reaction": {
"oneOf": [
{
"$ref": "#/components/schemas/BlogReaction"
},
{
"type": "null"
}
]
}
},
"required": [
"likes",
"dislikes",
"viewer_reaction"
],
"type": "object"
},
"BlogStatus": {
"enum": [
"draft",
@@ -208,6 +339,31 @@
],
"type": "string"
},
"CommentListResponse": {
"properties": {
"comments": {
"items": {
"$ref": "#/components/schemas/BlogComment"
},
"type": "array"
}
},
"required": [
"comments"
],
"type": "object"
},
"CommentResponse": {
"properties": {
"comment": {
"$ref": "#/components/schemas/BlogComment"
}
},
"required": [
"comment"
],
"type": "object"
},
"DeleteResponse": {
"properties": {
"ok": {
@@ -259,6 +415,21 @@
],
"type": "object"
},
"LoginErrorResponse": {
"properties": {
"error": {
"type": "string"
},
"login_url": {
"format": "uri",
"type": "string"
}
},
"required": [
"error"
],
"type": "object"
},
"PostListResponse": {
"properties": {
"posts": {
@@ -283,9 +454,26 @@
"post"
],
"type": "object"
},
"ReactionResponse": {
"properties": {
"reactions": {
"$ref": "#/components/schemas/BlogReactionSummary"
}
},
"required": [
"reactions"
],
"type": "object"
}
},
"securitySchemes": {
"a2aSession": {
"description": "Shared a2a Cloud browser session cookie.",
"in": "cookie",
"name": "a2a_session",
"type": "apiKey"
},
"apiKeyAuth": {
"description": "Use the configured `BLOG_API_KEY` value.",
"in": "header",
@@ -300,7 +488,7 @@
}
},
"info": {
"description": "Publishing and read API for the a2a cloud blog. Published content is public; draft, preview, create, update, and delete operations require the blog API key.",
"description": "Publishing, read, comment, and reaction API for the a2a cloud blog. Published content and comments are public; publishing requires the blog API key; comment and reaction writes require an a2a Cloud browser session.",
"title": "a2a cloud blog API",
"version": "0.1.0"
},
@@ -601,6 +789,181 @@
"Posts"
]
}
},
"/api/posts/{slug}/comments": {
"get": {
"operationId": "listBlogPostComments",
"parameters": [
{
"$ref": "#/components/parameters/Slug"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommentListResponse"
}
}
},
"description": "Comments returned oldest-first."
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"summary": "List comments for a post",
"tags": [
"Comments"
]
},
"post": {
"description": "Requires the shared a2a Cloud browser session cookie from the web login flow.",
"operationId": "createBlogPostComment",
"parameters": [
{
"$ref": "#/components/parameters/Slug"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BlogCommentInput"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommentResponse"
}
}
},
"description": "The comment was created."
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/A2AUnauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"503": {
"$ref": "#/components/responses/A2AAuthUnavailable"
}
},
"security": [
{
"a2aSession": []
}
],
"summary": "Create a comment",
"tags": [
"Comments"
]
}
},
"/api/posts/{slug}/reaction": {
"get": {
"description": "Returns public like/dislike counts. If an a2a Cloud session cookie is present, `viewer_reaction` is populated.",
"operationId": "getBlogPostReactions",
"parameters": [
{
"$ref": "#/components/parameters/Slug"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReactionResponse"
}
}
},
"description": "Reaction counts for the post."
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{},
{
"a2aSession": []
}
],
"summary": "Get post reaction counts",
"tags": [
"Reactions"
]
},
"put": {
"description": "Creates, updates, or clears the authenticated viewer's like/dislike reaction.",
"operationId": "setBlogPostReaction",
"parameters": [
{
"$ref": "#/components/parameters/Slug"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BlogReactionInput"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReactionResponse"
}
}
},
"description": "Updated reaction counts for the post."
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/A2AUnauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"503": {
"$ref": "#/components/responses/A2AAuthUnavailable"
}
},
"security": [
{
"a2aSession": []
}
],
"summary": "Set the viewer reaction",
"tags": [
"Reactions"
]
}
}
},
"servers": [
@@ -618,6 +981,14 @@
"description": "Blog post listing, publishing, and lookup.",
"name": "Posts"
},
{
"description": "Public comments on published posts.",
"name": "Comments"
},
{
"description": "Like and dislike reactions on published posts.",
"name": "Reactions"
},
{
"description": "Service health checks.",
"name": "Health"