@@ -7,6 +7,7 @@ use symbi_channel_adapter::{
77 AgentInvoker , BasicInteractionLogger , ChannelAdapterManager , ChannelConfig , ChatPlatform ,
88 MattermostConfig , PlatformSettings , SlackConfig , TeamsConfig ,
99} ;
10+ use symbi_runtime:: api:: server:: { HttpApiConfig , HttpApiServer } ;
1011use symbi_runtime:: http_input:: llm_client:: LlmClient ;
1112use symbi_runtime:: http_input:: { start_http_input, HttpInputConfig } ;
1213use symbi_runtime:: types:: AgentId ;
@@ -29,6 +30,9 @@ pub async fn run(matches: &ArgMatches) {
2930 let http_port = matches
3031 . get_one :: < String > ( "http-port" )
3132 . expect ( "http-port argument is required" ) ;
33+ let http_bind = matches
34+ . get_one :: < String > ( "http-bind" )
35+ . expect ( "http-bind argument has default value" ) ;
3236 let http_token = matches. get_one :: < String > ( "http-token" ) ;
3337 let cors_origins: Vec < String > = matches
3438 . get_one :: < String > ( "http-cors-origins" )
@@ -97,8 +101,8 @@ pub async fn run(matches: &ArgMatches) {
97101 // Scan agents directory
98102 let agents_found = scan_agents_directory ( ) ;
99103
100- println ! ( "✓ Runtime started on :{}" , port) ;
101- println ! ( "✓ HTTP Input enabled on :{}" , http_port) ;
104+ println ! ( "✓ Runtime API on {} :{}" , http_bind , port) ;
105+ println ! ( "✓ HTTP Input on {} :{}" , http_bind , http_port) ;
102106 println ! ( "✓ Authentication: ENABLED (Bearer token required)" ) ;
103107
104108 if let Some ( agent) = agents_found. first ( ) {
@@ -155,7 +159,7 @@ pub async fn run(matches: &ArgMatches) {
155159 } ;
156160
157161 let http_config = HttpInputConfig {
158- bind_address : "127.0.0.1" . to_string ( ) ,
162+ bind_address : http_bind . clone ( ) ,
159163 port : http_port_num,
160164 path : "/webhook" . to_string ( ) ,
161165 agent : agent_id,
@@ -433,7 +437,35 @@ pub async fn run(matches: &ArgMatches) {
433437 channel_manager = Some ( manager) ;
434438 }
435439
440+ // Parse the API port and configure the management API server
441+ let api_port_num = match port. parse :: < u16 > ( ) {
442+ Ok ( p) => p,
443+ Err ( e) => {
444+ eprintln ! ( "✗ Invalid API port number '{}': {}" , port, e) ;
445+ return ;
446+ }
447+ } ;
448+
449+ let api_config = HttpApiConfig {
450+ bind_address : http_bind. clone ( ) ,
451+ port : api_port_num,
452+ enable_cors : true ,
453+ enable_tracing : true ,
454+ enable_rate_limiting : true ,
455+ api_keys_file : None ,
456+ } ;
457+
458+ let mut api_server = HttpApiServer :: new ( api_config) ;
459+ if let Some ( ref rt) = runtime {
460+ api_server = api_server. with_runtime_provider ( rt. clone ( ) ) ;
461+ }
462+
436463 tokio:: select! {
464+ result = api_server. start( ) => {
465+ if let Err ( e) = result {
466+ eprintln!( "✗ API server error: {}" , e) ;
467+ }
468+ } ,
437469 _ = start_http_input( http_config, runtime. clone( ) , secrets_config) => { } ,
438470 _ = tokio:: signal:: ctrl_c( ) => { }
439471 }
0 commit comments