2024-10-30 11:53:37 -07:00
// Copyright (c) Microsoft Corporation. All rights reserved.
// Program.cs
2024-10-23 14:23:36 -07:00
2024-11-19 11:00:48 -08:00
using Microsoft.Extensions.Hosting ;
2024-10-23 14:23:36 -07:00
var builder = DistributedApplication . CreateBuilder ( args ) ;
2025-01-24 19:24:00 -08:00
var backend = builder . AddProject < Projects . Microsoft_AutoGen_AgentHost > ( "backend" ) . WithExternalHttpEndpoints ( ) ;
2024-12-03 08:09:02 -08:00
var client = builder . AddProject < Projects . HelloAgent > ( "HelloAgentsDotNET" )
2024-11-19 11:00:48 -08:00
. WithReference ( backend )
2024-12-03 08:09:02 -08:00
. WithEnvironment ( "AGENT_HOST" , backend . GetEndpoint ( "https" ) )
. WithEnvironment ( "STAY_ALIVE_ON_GOODBYE" , "true" )
2024-11-19 11:00:48 -08:00
. WaitFor ( backend ) ;
2024-12-03 08:09:02 -08:00
#pragma warning disable ASPIREHOSTINGPYTHON001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
// xlang is over http for now - in prod use TLS between containers
2025-01-24 19:24:00 -08:00
builder . AddPythonApp ( "HelloAgentsPython" , "../../../../python/samples/core_xlang_hello_python_agent" , "hello_python_agent.py" , "../../.venv" )
. WithReference ( backend )
2024-12-03 08:09:02 -08:00
. WithEnvironment ( "AGENT_HOST" , backend . GetEndpoint ( "http" ) )
. WithEnvironment ( "STAY_ALIVE_ON_GOODBYE" , "true" )
. WithEnvironment ( "GRPC_DNS_RESOLVER" , "native" )
. WithOtlpExporter ( )
. WaitFor ( client ) ;
#pragma warning restore ASPIREHOSTINGPYTHON001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2024-11-19 11:00:48 -08:00
using var app = builder . Build ( ) ;
await app . StartAsync ( ) ;
var url = backend . GetEndpoint ( "http" ) . Url ;
Console . WriteLine ( "Backend URL: " + url ) ;
await app . WaitForShutdownAsync ( ) ;