|
24 | 24 | the "Models + endpoints" tab in your Microsoft Foundry project. |
25 | 25 | 3) A2A_PROJECT_CONNECTION_ID - The A2A project connection ID, |
26 | 26 | as found in the "Connections" tab in your Microsoft Foundry project. |
| 27 | + 4) (Optional) A2A_ENDPOINT - If the connection is missing target i.e. if it is of "Custom keys" type, we need to set the A2A |
| 28 | + endpoint on the tool. |
27 | 29 | """ |
28 | 30 |
|
29 | 31 | import os |
|
49 | 51 | tool = A2ATool( |
50 | 52 | project_connection_id=os.environ["A2A_PROJECT_CONNECTION_ID"], |
51 | 53 | ) |
| 54 | + # If the connection is missing target, we need to set the A2A endpoint URL. |
| 55 | + if os.environ.get("A2A_ENDPOINT"): |
| 56 | + tool.base_url = os.environ["A2A_ENDPOINT"] |
52 | 57 | # [END tool_declaration] |
53 | 58 |
|
54 | 59 | agent = project_client.agents.create_version( |
|
79 | 84 | print(f"\nFollow-up response done!") |
80 | 85 | elif event.type == "response.output_item.done": |
81 | 86 | item = event.item |
82 | | - if item.type == "remote_function_call": # TODO: support remote_function_call schema |
83 | | - print(f"Call ID: {getattr(item, 'call_id')}") |
84 | | - print(f"Label: {getattr(item, 'label')}") |
| 87 | + if item.type == "a2a_preview_call": |
| 88 | + print(f"Request ID: {getattr(item, 'id')}") |
| 89 | + if hasattr(item, 'model_extra'): |
| 90 | + extra = getattr(item, 'model_extra') |
| 91 | + if isinstance(extra, dict): |
| 92 | + print(f"Arguments: {extra['arguments']}") |
| 93 | + elif item.type == "a2a_preview_call_output": |
| 94 | + print(f"Response ID: {getattr(item, 'id')}") |
85 | 95 | elif event.type == "response.completed": |
86 | 96 | print(f"\nFollow-up completed!") |
87 | 97 | print(f"Full response: {event.response.output_text}") |
|
0 commit comments