11
11
# The Bedrock agent is hosted on Sage Bionetworks AWS infrastructure.
12
12
# CFN Template:
13
13
# https://raw.githubusercontent.com/Sage-Bionetworks-Workflows/dpe-agents/refs/heads/main/client_integration_test/template.json
14
- CLOUD_AGENT_ID = "QOTV3KQM1X"
15
- AGENT_REGISTRATION_ID = "29"
14
+ AGENT_AWS_ID = "QOTV3KQM1X"
16
15
17
16
18
17
class TestAgentSession :
@@ -21,10 +20,14 @@ class TestAgentSession:
21
20
@pytest .fixture (autouse = True , scope = "function" )
22
21
def init (self , syn : Synapse ) -> None :
23
22
self .syn = syn
23
+ if syn .repoEndpoint == "https://repo-dev.dev.sagebase.org/repo/v1" :
24
+ self .AGENT_REGISTRATION_ID = "7"
25
+ else :
26
+ self .AGENT_REGISTRATION_ID = "29"
24
27
25
28
async def test_start (self ) -> None :
26
29
# GIVEN an agent session with a valid agent registration id
27
- agent_session = AgentSession (agent_registration_id = AGENT_REGISTRATION_ID )
30
+ agent_session = AgentSession (agent_registration_id = self . AGENT_REGISTRATION_ID )
28
31
29
32
# WHEN the start method is called
30
33
result_session = agent_session .start (synapse_client = self .syn )
@@ -38,13 +41,13 @@ async def test_start(self) -> None:
38
41
assert result_session .started_on is not None
39
42
assert result_session .started_by is not None
40
43
assert result_session .modified_on is not None
41
- assert result_session .agent_registration_id == str (AGENT_REGISTRATION_ID )
44
+ assert result_session .agent_registration_id == str (self . AGENT_REGISTRATION_ID )
42
45
assert result_session .etag is not None
43
46
assert result_session .chat_history == []
44
47
45
48
async def test_get (self ) -> None :
46
49
# GIVEN an agent session with a valid agent registration id
47
- agent_session = AgentSession (agent_registration_id = AGENT_REGISTRATION_ID )
50
+ agent_session = AgentSession (agent_registration_id = self . AGENT_REGISTRATION_ID )
48
51
# WHEN I start a session
49
52
agent_session .start (synapse_client = self .syn )
50
53
# THEN I expect to be able to get the session with its id
@@ -54,7 +57,7 @@ async def test_get(self) -> None:
54
57
async def test_update (self ) -> None :
55
58
# GIVEN an agent session with a valid agent registration id and access level set
56
59
agent_session = AgentSession (
57
- agent_registration_id = AGENT_REGISTRATION_ID ,
60
+ agent_registration_id = self . AGENT_REGISTRATION_ID ,
58
61
access_level = AgentSessionAccessLevel .PUBLICLY_ACCESSIBLE ,
59
62
)
60
63
# WHEN I start a session
@@ -71,7 +74,7 @@ async def test_update(self) -> None:
71
74
72
75
async def test_prompt (self ) -> None :
73
76
# GIVEN an agent session with a valid agent registration id
74
- agent_session = AgentSession (agent_registration_id = AGENT_REGISTRATION_ID )
77
+ agent_session = AgentSession (agent_registration_id = self . AGENT_REGISTRATION_ID )
75
78
# WHEN I start a session
76
79
agent_session .start (synapse_client = self .syn )
77
80
# THEN I expect to be able to prompt the agent
@@ -89,37 +92,43 @@ async def test_prompt(self) -> None:
89
92
class TestAgent :
90
93
"""Integration tests for the synchronous methods of the Agent class."""
91
94
92
- def get_test_agent (self ) -> Agent :
93
- return Agent (
94
- cloud_agent_id = CLOUD_AGENT_ID ,
95
+ @pytest .fixture (autouse = True , scope = "function" )
96
+ def init (self , syn : Synapse ) -> None :
97
+ self .syn = syn
98
+
99
+ if syn .repoEndpoint == "https://repo-dev.dev.sagebase.org/repo/v1" :
100
+ self .AGENT_REGISTRATION_ID = "7"
101
+ registered_on = "2025-08-11T20:39:35.355Z"
102
+ else :
103
+ self .AGENT_REGISTRATION_ID = "29"
104
+ registered_on = "2025-01-16T18:57:35.680Z"
105
+
106
+ self .agent = Agent (
107
+ cloud_agent_id = AGENT_AWS_ID ,
95
108
cloud_alias_id = "TSTALIASID" ,
96
- registration_id = AGENT_REGISTRATION_ID ,
97
- registered_on = "2025-01-16T18:57:35.680Z" ,
109
+ registration_id = self . AGENT_REGISTRATION_ID ,
110
+ registered_on = registered_on ,
98
111
type = "CUSTOM" ,
99
112
sessions = {},
100
113
current_session = None ,
101
114
)
102
115
103
- @pytest .fixture (autouse = True , scope = "function" )
104
- def init (self , syn : Synapse ) -> None :
105
- self .syn = syn
106
-
107
116
async def test_register (self ) -> None :
108
117
# GIVEN an Agent with a valid agent AWS id
109
- agent = Agent (cloud_agent_id = CLOUD_AGENT_ID )
118
+ agent = Agent (cloud_agent_id = AGENT_AWS_ID )
110
119
# WHEN I register the agent
111
120
agent .register (synapse_client = self .syn )
112
121
# THEN I expect the agent to be registered
113
- expected_agent = self .get_test_agent ()
122
+ expected_agent = self .agent
114
123
assert agent == expected_agent
115
124
116
125
async def test_get (self ) -> None :
117
126
# GIVEN an Agent with a valid agent registration id
118
- agent = Agent (registration_id = AGENT_REGISTRATION_ID )
127
+ agent = Agent (registration_id = self . AGENT_REGISTRATION_ID )
119
128
# WHEN I get the agent
120
129
agent .get (synapse_client = self .syn )
121
130
# THEN I expect the agent to be returned
122
- expected_agent = self .get_test_agent ()
131
+ expected_agent = self .agent
123
132
assert agent == expected_agent
124
133
125
134
async def test_get_no_registration_id (self ) -> None :
@@ -131,7 +140,7 @@ async def test_get_no_registration_id(self) -> None:
131
140
132
141
async def test_start_session (self ) -> None :
133
142
# GIVEN an Agent with a valid agent registration id
134
- agent = Agent (registration_id = AGENT_REGISTRATION_ID ).get (
143
+ agent = Agent (registration_id = self . AGENT_REGISTRATION_ID ).get (
135
144
synapse_client = self .syn
136
145
)
137
146
# WHEN I start a session
@@ -143,7 +152,7 @@ async def test_start_session(self) -> None:
143
152
144
153
async def test_get_session (self ) -> None :
145
154
# GIVEN an Agent with a valid agent registration id
146
- agent = Agent (registration_id = AGENT_REGISTRATION_ID ).get (
155
+ agent = Agent (registration_id = self . AGENT_REGISTRATION_ID ).get (
147
156
synapse_client = self .syn
148
157
)
149
158
# WHEN I start a session
@@ -157,11 +166,11 @@ async def test_get_session(self) -> None:
157
166
158
167
async def test_prompt_with_session (self ) -> None :
159
168
# GIVEN an Agent with a valid agent registration id
160
- agent = Agent (registration_id = AGENT_REGISTRATION_ID ).get (
169
+ agent = Agent (registration_id = self . AGENT_REGISTRATION_ID ).get (
161
170
synapse_client = self .syn
162
171
)
163
172
# AND a session started separately
164
- session = AgentSession (agent_registration_id = AGENT_REGISTRATION_ID ).start (
173
+ session = AgentSession (agent_registration_id = self . AGENT_REGISTRATION_ID ).start (
165
174
synapse_client = self .syn
166
175
)
167
176
# WHEN I prompt the agent with a session
@@ -177,7 +186,7 @@ async def test_prompt_with_session(self) -> None:
177
186
178
187
async def test_prompt_no_session (self ) -> None :
179
188
# GIVEN an Agent with a valid agent registration id
180
- agent = Agent (registration_id = AGENT_REGISTRATION_ID ).get (
189
+ agent = Agent (registration_id = self . AGENT_REGISTRATION_ID ).get (
181
190
synapse_client = self .syn
182
191
)
183
192
# WHEN I prompt the agent without a current session set
0 commit comments