From 4d8daec055fd7984b56885e686ab590bb6cd2606 Mon Sep 17 00:00:00 2001 From: a2a-code-editor Date: Sat, 18 Jul 2026 10:38:09 +0000 Subject: [PATCH] code editor: Agent Studio improvement iteration 1 for `invoice-guard-studio-v1`. Goal --- agent.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/agent.py b/agent.py index dd461c7..219f9ed 100644 --- a/agent.py +++ b/agent.py @@ -21,7 +21,7 @@ from datetime import UTC, datetime from decimal import Decimal, InvalidOperation, ROUND_HALF_UP from typing import Annotated, Any -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field, ValidationError import a2a_pack as a2a from a2a_pack import ( @@ -43,6 +43,7 @@ from a2a_pack import ( MAX_INVOICES = 50 MAX_UPLOADS = 5 MAX_UPLOAD_BYTES = 256 * 1024 +MAX_TEXT_FIELD_LENGTH = 180 ACCEPTED_MEDIA_TYPES = {"application/json", "text/json", "text/csv", "text/plain"} DB_CONNECT_OPTIONS = "-c statement_timeout=5000 -c lock_timeout=3000 -c idle_in_transaction_session_timeout=10000" @@ -57,6 +58,16 @@ class BrowserDocument(BaseModel): data_base64: str = Field(min_length=1, max_length=((MAX_UPLOAD_BYTES * 4) // 3) + 16) +class InvoiceInput(BaseModel): + model_config = ConfigDict(extra="allow") + + invoice_number: str = Field(min_length=1, max_length=120) + vendor: str = Field(min_length=1, max_length=MAX_TEXT_FIELD_LENGTH) + subtotal: Any + tax: Any + total: Any + + class DecisionInput(BaseModel): decision_id: str = Field(min_length=1, max_length=120) invoice_number: str | None = Field(default=None, max_length=120) @@ -70,7 +81,7 @@ class InvoiceGuardStudioV1(A2AAgent[InvoiceGuardStudioV1Config, PlatformUserAuth "One-page InvoiceGuard app for deterministic duplicate invoice number " "and stated-total mismatch review with user-scoped Postgres persistence." ) - version = "0.1.1" + version = "0.1.2" config_model = InvoiceGuardStudioV1Config auth_model = PlatformUserAuth