1
- use std:: process:: { Child , Command } ;
2
- use std:: time:: Duration ;
3
- use std:: thread:: sleep;
4
-
5
1
use ag_ui_client:: HttpAgent ;
6
2
use ag_ui_client:: agent:: { Agent , RunAgentParams } ;
7
3
use ag_ui_core:: types:: message:: { Message , Role } ;
@@ -11,45 +7,11 @@ use reqwest::header::{HeaderMap, HeaderValue};
11
7
use serde_json:: json;
12
8
use uuid:: Uuid ;
13
9
14
- struct ServerProcess {
15
- process : Child ,
16
- }
17
-
18
- impl ServerProcess {
19
- fn new ( ) -> Self {
20
- // Start the Python server
21
- println ! ( "Starting pydantic_ai_server.py..." ) ;
22
-
23
- // Get the current directory
24
- let current_dir = std:: env:: current_dir ( ) . expect ( "Failed to get current directory" ) ;
25
- let script_path = current_dir. join ( "scripts" ) . join ( "pydantic_ai_server.py" ) ;
26
-
27
- println ! ( "Script path: {:?}" , script_path) ;
28
-
29
-
30
- let process = Command :: new ( "uv" )
31
- . args ( [ "run" , & script_path. to_str ( ) . unwrap ( ) ] )
32
- . spawn ( )
33
- . expect ( "Failed to start pydantic_ai_server.py" ) ;
34
-
35
- // Give the server some time to start up
36
- sleep ( Duration :: from_secs ( 5 ) ) ;
37
-
38
- Self { process }
39
- }
40
- }
41
-
42
- impl Drop for ServerProcess {
43
- fn drop ( & mut self ) {
44
- println ! ( "Stopping pydantic_ai_server.py..." ) ;
45
- let _ = self . process . kill ( ) ;
46
- }
47
- }
48
10
49
11
#[ tokio:: test]
50
12
async fn test_http_agent_basic_functionality ( ) {
51
13
env_logger:: init ( ) ;
52
-
14
+
53
15
// Create an HttpAgent
54
16
let mut headers = HeaderMap :: new ( ) ;
55
17
headers. insert ( "Content-Type" , HeaderValue :: from_static ( "application/json" ) ) ;
@@ -105,9 +67,6 @@ async fn test_http_agent_basic_functionality() {
105
67
106
68
#[ tokio:: test]
107
69
async fn test_http_agent_tool_calls ( ) {
108
- // Start the server
109
- let _server = ServerProcess :: new ( ) ;
110
-
111
70
// Create an HttpAgent
112
71
let mut headers = HeaderMap :: new ( ) ;
113
72
headers. insert ( "Content-Type" , HeaderValue :: from_static ( "application/json" ) ) ;
0 commit comments