3636 EmbeddingFulfillment ,
3737 EmbeddingServiceExtensionClient ,
3838 EmbeddingServiceExtensionSpec ,
39+ FormServiceExtensionSpec ,
3940 LLMFulfillment ,
4041 LLMServiceExtensionClient ,
4142 LLMServiceExtensionSpec ,
4243 PlatformApiExtensionClient ,
4344 PlatformApiExtensionSpec ,
45+ RequestFormExtensionSpec ,
4446 TrajectoryExtensionClient ,
4547 TrajectoryExtensionSpec ,
4648)
47- from agentstack_sdk .a2a .extensions .ui .form import (
49+ from agentstack_sdk .a2a .extensions .common .form import (
4850 CheckboxField ,
4951 CheckboxFieldValue ,
5052 DateField ,
5153 DateFieldValue ,
52- FormExtensionSpec ,
5354 FormFieldValue ,
5455 FormRender ,
5556 FormResponse ,
@@ -295,7 +296,7 @@ async def _ask_form_questions(form_render: FormRender) -> FormResponse:
295296 ).execute_async ()
296297 form_values [field .id ] = CheckboxFieldValue (value = answer )
297298 console .print ()
298- return FormResponse (id = form_render . id , values = form_values )
299+ return FormResponse (values = form_values )
299300
300301
301302async def _run_agent (
@@ -360,7 +361,11 @@ async def _run_agent(
360361 else {}
361362 )
362363 | (
363- {FormExtensionSpec .URI : typing .cast (FormResponse , input ).model_dump (mode = "json" )}
364+ {
365+ FormServiceExtensionSpec .URI : {
366+ "form_fulfillments" : {"initial_form" : typing .cast (FormResponse , input ).model_dump (mode = "json" )}
367+ }
368+ }
364369 if isinstance (input , FormResponse )
365370 else {}
366371 )
@@ -446,7 +451,7 @@ async def _run_agent(
446451 raise ValueError ("Agent requires input but no input handler provided" )
447452
448453 if form_metadata := (
449- message .metadata .get (FormExtensionSpec .URI ) if message and message .metadata else None
454+ message .metadata .get (RequestFormExtensionSpec .URI ) if message and message .metadata else None
450455 ):
451456 stream = client .send_message (
452457 Message (
@@ -456,7 +461,7 @@ async def _run_agent(
456461 task_id = task_id ,
457462 context_id = context_token .context_id ,
458463 metadata = {
459- FormExtensionSpec .URI : (
464+ RequestFormExtensionSpec .URI : (
460465 await _ask_form_questions (FormRender .model_validate (form_metadata ))
461466 ).model_dump (mode = "json" )
462467 },
@@ -778,9 +783,9 @@ async def run_agent(
778783
779784 initial_form_render = next (
780785 (
781- FormRender .model_validate (ext .params )
786+ FormRender .model_validate (ext .params [ "form_demands" ][ "initial_form" ] )
782787 for ext in agent .capabilities .extensions or ()
783- if ext .uri == FormExtensionSpec .URI and ext .params
788+ if ext .uri == FormServiceExtensionSpec .URI and ext .params
784789 ),
785790 None ,
786791 )
0 commit comments