Skip to content

Commit a037c3b

Browse files
Lingling PengLingling Peng
authored andcommitted
change the string id to 7 if in dev environment
1 parent 18999b8 commit a037c3b

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

tests/integration/synapseclient/models/async/test_agent_async.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
# The Bedrock agent is hosted on Sage Bionetworks AWS infrastructure.
1818
# CFN Template:
1919
# https://raw.githubusercontent.com/Sage-Bionetworks-Workflows/dpe-agents/refs/heads/main/client_integration_test/template.json
20+
2021
AGENT_AWS_ID = "QOTV3KQM1X"
21-
AGENT_REGISTRATION_ID = "29"
2222

2323

2424
class TestAgentPrompt:
@@ -27,6 +27,10 @@ class TestAgentPrompt:
2727
@pytest.fixture(autouse=True, scope="function")
2828
def init(self, syn: Synapse) -> None:
2929
self.syn = syn
30+
if syn.repoEndpoint == "https://repo-dev.dev.sagebase.org/repo/v1":
31+
self.AGENT_REGISTRATION_ID = "7"
32+
else:
33+
self.AGENT_REGISTRATION_ID = "29"
3034

3135
async def test_send_job_and_wait_async_with_post_exchange_args(self) -> None:
3236
# GIVEN an AgentPrompt with a valid concrete type, prompt, and enable_trace
@@ -37,7 +41,7 @@ async def test_send_job_and_wait_async_with_post_exchange_args(self) -> None:
3741
)
3842
# AND the ID of an existing agent session
3943
test_session = await AgentSession(
40-
agent_registration_id=AGENT_REGISTRATION_ID
44+
agent_registration_id=self.AGENT_REGISTRATION_ID
4145
).start_async(synapse_client=self.syn)
4246
test_prompt.session_id = test_session.id
4347
# WHEN I send the job and wait for it to complete
@@ -59,7 +63,7 @@ def init(self, syn: Synapse) -> None:
5963

6064
async def test_start(self) -> None:
6165
# GIVEN an agent session with a valid agent registration id
62-
agent_session = AgentSession(agent_registration_id=AGENT_REGISTRATION_ID)
66+
agent_session = AgentSession(agent_registration_id=self.AGENT_REGISTRATION_ID)
6367

6468
# WHEN the start method is called
6569
result_session = await agent_session.start_async(synapse_client=self.syn)
@@ -73,13 +77,13 @@ async def test_start(self) -> None:
7377
assert result_session.started_on is not None
7478
assert result_session.started_by is not None
7579
assert result_session.modified_on is not None
76-
assert result_session.agent_registration_id == AGENT_REGISTRATION_ID
80+
assert result_session.agent_registration_id == self.AGENT_REGISTRATION_ID
7781
assert result_session.etag is not None
7882
assert result_session.chat_history == []
7983

8084
async def test_get(self) -> None:
8185
# GIVEN an agent session with a valid agent registration id
82-
agent_session = AgentSession(agent_registration_id=AGENT_REGISTRATION_ID)
86+
agent_session = AgentSession(agent_registration_id=self.AGENT_REGISTRATION_ID)
8387
# WHEN I start a session
8488
await agent_session.start_async(synapse_client=self.syn)
8589
# THEN I expect to be able to get the session with its id
@@ -92,7 +96,7 @@ async def test_update(self) -> None:
9296
# GIVEN an agent session with a valid agent
9397
# registration id and access level set
9498
agent_session = AgentSession(
95-
agent_registration_id=AGENT_REGISTRATION_ID,
99+
agent_registration_id=self.AGENT_REGISTRATION_ID,
96100
access_level=AgentSessionAccessLevel.PUBLICLY_ACCESSIBLE,
97101
)
98102
# WHEN I start a session
@@ -111,7 +115,7 @@ async def test_update(self) -> None:
111115

112116
async def test_prompt(self) -> None:
113117
# GIVEN an agent session with a valid agent registration id
114-
agent_session = AgentSession(agent_registration_id=AGENT_REGISTRATION_ID)
118+
agent_session = AgentSession(agent_registration_id=self.AGENT_REGISTRATION_ID)
115119
# WHEN I start a session
116120
await agent_session.start_async(synapse_client=self.syn)
117121
# THEN I expect to be able to prompt the agent
@@ -133,7 +137,7 @@ def get_test_agent(self) -> Agent:
133137
return Agent(
134138
cloud_agent_id=AGENT_AWS_ID,
135139
cloud_alias_id="TSTALIASID",
136-
registration_id=AGENT_REGISTRATION_ID,
140+
registration_id=self.AGENT_REGISTRATION_ID,
137141
registered_on="2025-01-16T18:57:35.680Z",
138142
type="CUSTOM",
139143
sessions={},
@@ -155,7 +159,7 @@ async def test_register(self) -> None:
155159

156160
async def test_get(self) -> None:
157161
# GIVEN an Agent with a valid agent registration id
158-
agent = Agent(registration_id=AGENT_REGISTRATION_ID)
162+
agent = Agent(registration_id=self.AGENT_REGISTRATION_ID)
159163
# WHEN I get the agent
160164
await agent.get_async(synapse_client=self.syn)
161165
# THEN I expect the agent to be returned
@@ -171,7 +175,7 @@ async def test_get_no_registration_id(self) -> None:
171175

172176
async def test_start_session(self) -> None:
173177
# GIVEN an Agent with a valid agent registration id
174-
agent = Agent(registration_id=AGENT_REGISTRATION_ID)
178+
agent = Agent(registration_id=self.AGENT_REGISTRATION_ID)
175179
# WHEN I start a session
176180
await agent.start_session_async(synapse_client=self.syn)
177181
# THEN I expect a current session to be set
@@ -181,7 +185,7 @@ async def test_start_session(self) -> None:
181185

182186
async def test_get_session(self) -> None:
183187
# GIVEN an Agent with a valid agent registration id
184-
agent = Agent(registration_id=AGENT_REGISTRATION_ID)
188+
agent = Agent(registration_id=self.AGENT_REGISTRATION_ID)
185189
# WHEN I start a session
186190
await agent.start_session_async(synapse_client=self.syn)
187191
# THEN I expect to be able to get the session with its id
@@ -193,12 +197,12 @@ async def test_get_session(self) -> None:
193197

194198
async def test_prompt_with_session(self) -> None:
195199
# GIVEN an Agent with a valid agent registration id
196-
agent = await Agent(registration_id=AGENT_REGISTRATION_ID).get_async(
200+
agent = await Agent(registration_id=self.AGENT_REGISTRATION_ID).get_async(
197201
synapse_client=self.syn
198202
)
199203
# AND a session started separately
200204
session = await AgentSession(
201-
agent_registration_id=AGENT_REGISTRATION_ID
205+
agent_registration_id=self.AGENT_REGISTRATION_ID
202206
).start_async(synapse_client=self.syn)
203207
# WHEN I prompt the agent with a session
204208
await agent.prompt_async(prompt="hello", enable_trace=True, session=session)
@@ -213,7 +217,7 @@ async def test_prompt_with_session(self) -> None:
213217

214218
async def test_prompt_no_session(self) -> None:
215219
# GIVEN an Agent with a valid agent registration id
216-
agent = await Agent(registration_id=AGENT_REGISTRATION_ID).get_async(
220+
agent = await Agent(registration_id=self.AGENT_REGISTRATION_ID).get_async(
217221
synapse_client=self.syn
218222
)
219223
# WHEN I prompt the agent without a current session set

0 commit comments

Comments
 (0)