File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
python/samples/getting_started/agents/azure_ai Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1414Prerequisites:
15151. Set AZURE_AI_PROJECT_ENDPOINT and AZURE_AI_MODEL_DEPLOYMENT_NAME environment variables.
16162. Ensure you have an A2A connection configured in your Azure AI project
17- and set A2A_PROJECT_CONNECTION_ID environment variable.
17+ and set A2A_PROJECT_CONNECTION_ID environment variable.
18+ 3. (Optional) A2A_ENDPOINT - If the connection is missing target (e.g., "Custom keys" type),
19+ set the A2A endpoint URL directly.
1820"""
1921
2022
2123async def main () -> None :
24+ # Configure A2A tool with connection ID
25+ a2a_tool = {
26+ "type" : "a2a_preview" ,
27+ "project_connection_id" : os .environ ["A2A_PROJECT_CONNECTION_ID" ],
28+ }
29+
30+ # If the connection is missing a target, we need to set the A2A endpoint URL
31+ if os .environ .get ("A2A_ENDPOINT" ):
32+ a2a_tool ["base_url" ] = os .environ ["A2A_ENDPOINT" ]
33+
2234 async with (
2335 AzureCliCredential () as credential ,
2436 AzureAIClient (credential = credential ).create_agent (
2537 name = "MyA2AAgent" ,
2638 instructions = """You are a helpful assistant that can communicate with other agents.
2739 Use the A2A tool when you need to interact with other agents to complete tasks
2840 or gather information from specialized agents.""" ,
29- tools = {
30- "type" : "a2a_preview" ,
31- "project_connection_id" : os .environ ["A2A_PROJECT_CONNECTION_ID" ],
32- },
41+ tools = a2a_tool ,
3342 ) as agent ,
3443 ):
3544 query = "What can the secondary agent do?"
You can’t perform that action at this time.
0 commit comments