diff --git a/synapseclient/models/agent.py b/synapseclient/models/agent.py index 8a74a3d61..be5cf2f75 100644 --- a/synapseclient/models/agent.py +++ b/synapseclient/models/agent.py @@ -320,6 +320,7 @@ async def prompt_async( synapse_client: Optional[Synapse] = None, ) -> None: """Sends a prompt to the agent and adds the response to the AgentSession's chat history. + A session must be started before sending a prompt. Arguments: prompt: The prompt to send to the agent. @@ -368,7 +369,7 @@ class Agent(AgentSynchronousProtocol): syn = Synapse() syn.login() - my_agent = Agent().start_session(synapse_client=syn) + my_agent = Agent() my_agent.prompt( prompt="Can you tell me about the AD Knowledge Portal dataset?", enable_trace=True, diff --git a/tests/integration/synapseclient/models/synchronous/test_agent.py b/tests/integration/synapseclient/models/synchronous/test_agent.py index c3391b098..bce7b3fe6 100644 --- a/tests/integration/synapseclient/models/synchronous/test_agent.py +++ b/tests/integration/synapseclient/models/synchronous/test_agent.py @@ -5,8 +5,8 @@ from synapseclient import Synapse from synapseclient.models.agent import Agent, AgentSession, AgentSessionAccessLevel -AGENT_AWS_ID = "QOTV3KQM1X" -AGENT_REGISTRATION_ID = "29" +CLOUD_AGENT_ID = "QOTV3KQM1X" +AGENT_REGISTRATION_ID = 29 class TestAgentSession: @@ -32,7 +32,7 @@ def test_start(self) -> None: assert result_session.started_on is not None assert result_session.started_by is not None assert result_session.modified_on is not None - assert result_session.agent_registration_id == AGENT_REGISTRATION_ID + assert result_session.agent_registration_id == str(AGENT_REGISTRATION_ID) assert result_session.etag is not None assert result_session.chat_history == [] @@ -98,7 +98,7 @@ def init(self, syn: Synapse) -> None: def test_register(self) -> None: # GIVEN an Agent with a valid agent AWS id - agent = Agent(cloud_agent_id=AGENT_AWS_ID) + agent = Agent(cloud_agent_id=CLOUD_AGENT_ID) # WHEN I register the agent agent.register(synapse_client=self.syn) # THEN I expect the agent to be registered