a2a-source-edit: write agent.py

This commit is contained in:
a2a-cloud
2026-07-13 03:29:14 +00:00
parent 7558eaa14f
commit b783118a01

View File

@@ -310,7 +310,7 @@ class ContractFixture(StrictModel):
@field_validator("payload") @field_validator("payload")
@classmethod @classmethod
def _bounded_payload(cls, value: dict[str, Any]) -> dict[str, Any]: def _bounded_payload(cls, value: dict[str, Any]) -> Any:
_ensure_bounded_json(value, MAX_JSON_BYTES) _ensure_bounded_json(value, MAX_JSON_BYTES)
return value return value
@@ -325,7 +325,7 @@ class ContractArtifact(StrictModel):
@field_validator("schema_doc") @field_validator("schema_doc")
@classmethod @classmethod
def _bounded_schema(cls, value: dict[str, Any]) -> dict[str, Any]: def _bounded_schema(cls, value: dict[str, Any]) -> Any:
_ensure_bounded_json(value, MAX_JSON_BYTES) _ensure_bounded_json(value, MAX_JSON_BYTES)
return value return value
@@ -484,7 +484,7 @@ class CustomerIntegrationEngineer(A2AAgent[CustomerIntegrationEngineerConfig, No
) )
@a2a.tool(description="Capture requirements, produce architecture and field mapping artifacts", input_schema=_DESIGN_INPUT_SCHEMA, timeout_seconds=120, idempotent=True, max_retries=0, cost_class="deterministic", grant_outputs_prefix="outputs", grant_write_prefixes=("outputs/integrations",)) @a2a.tool(description="Capture requirements, produce architecture and field mapping artifacts", input_schema=_DESIGN_INPUT_SCHEMA, timeout_seconds=120, idempotent=True, max_retries=0, cost_class="deterministic", grant_outputs_prefix="outputs", grant_write_prefixes=("outputs/integrations",))
async def design_integration(self, ctx: RunContext[NoAuth], request: DesignIntegrationRequest) -> dict[str, Any]: async def design_integration(self, ctx: RunContext[NoAuth], request: DesignIntegrationRequest) -> Any:
req = request.requirements.model_copy( req = request.requirements.model_copy(
update={"dry_run": _effective_dry_run(self, request.dry_run, request.requirements.dry_run)} update={"dry_run": _effective_dry_run(self, request.dry_run, request.requirements.dry_run)}
) )
@@ -863,7 +863,7 @@ def _required_setup(req: IntegrationRequirements) -> list[str]:
return sorted(setup) return sorted(setup)
def _build_mapping(req: IntegrationRequirements) -> dict[str, Any]: def _build_mapping(req: IntegrationRequirements) -> Any:
return { return {
"integration_id": req.integration_id, "integration_id": req.integration_id,
"title": req.title, "title": req.title,