a2a-source-edit: write agent.py
This commit is contained in:
11
agent.py
11
agent.py
@@ -55,6 +55,12 @@ class QuoteJudgeStudioV1Config(BaseModel):
|
||||
"""No user-configurable settings; all state is tenant-scoped by platform auth."""
|
||||
|
||||
|
||||
class QuoteJudgeDurableState(BaseModel):
|
||||
"""Marker state model: durable product state lives in managed Postgres."""
|
||||
|
||||
database: str = "quote-judge-studio-v1-data"
|
||||
|
||||
|
||||
class QuoteInput(BaseModel):
|
||||
vendor: str = Field(..., min_length=1, max_length=120)
|
||||
unit_price: float = Field(..., gt=0, le=1_000_000)
|
||||
@@ -103,12 +109,13 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
|
||||
"weights; persist results; reopen prior comparisons; accept browser "
|
||||
"base64 uploads and typed FileUpload inputs; and persist execution receipts."
|
||||
)
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
|
||||
config_model = QuoteJudgeStudioV1Config
|
||||
auth_model = PlatformUserAuth
|
||||
|
||||
state = State.DURABLE
|
||||
state_model = QuoteJudgeDurableState
|
||||
resources = Resources(cpu="500m", memory="512Mi", max_runtime_seconds=120)
|
||||
pricing = Pricing(
|
||||
price_per_call_usd=0.0,
|
||||
@@ -251,7 +258,7 @@ class QuoteJudgeStudioV1(A2AAgent[QuoteJudgeStudioV1Config, PlatformUserAuth]):
|
||||
return _validation_result(comparison_id, issues)
|
||||
try:
|
||||
data = ctx.workspace.read_bytes(quote_file.path) # concrete runtime clients expose this helper
|
||||
except Exception as exc: # noqa: BLE001
|
||||
except Exception: # noqa: BLE001
|
||||
return _validation_result(
|
||||
comparison_id,
|
||||
[ValidationIssue(code="upload_read_failed", message="The uploaded file could not be read from the invocation workspace.", field="quote_file", action=f"Re-upload the file and ensure it is below {MAX_BROWSER_UPLOAD_BYTES} bytes.")],
|
||||
|
||||
Reference in New Issue
Block a user