Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNPY-1544] Synapse Agent OOP Model #1152

Merged
merged 64 commits into from
Jan 28, 2025
Merged

Conversation

BWMac
Copy link
Contributor

@BWMac BWMac commented Jan 8, 2025

Description:

This PR is the implementation of an OOP model for interacting with the new Synapse Agent API endpoints. The design for the model implementation can be found in Confluence.

The core implementation includes (from "bottom to top"):

  • synapseclient.api.agent_services:
    • Low-level functions for interacting with the API endpoints that are specific to using Synapse Agents.
  • synapseclient.models.AgentPrompt:
  • synapseclient.models.AgentSession:
    • a dataclass representing a chat session with a Synapse Agent.
    • Includes functionality for directly interacting with chat sessions with a Synapse Agent.
    • The AgentSession logic is used in the Agent class, and we will generally recommend that users utilize the Agent class as the primary interface.
    • Asynchronous and Synchronous interfaces are available.
  • synapseclient.models.Agent:
    • a dataclass representing a Synapse Agent you can interact with.
    • Includes functionality for registering a custom agent, starting sessions with agents, sending prompts and also managing more than one session at a time.
    • The basic use case includes one session at a time where a session started by a user (either explicitly with start_session or implicitly by just calling prompt) becomes the default for prompting, but examples for conducting more than one session at a time can be found in the POC script and class docstring.

Notes:

  • All needed unit and integration tests for synchronous and asynchronous implementations are included.
  • Example usage of the models can be found in the class docstrings and in the POC script included in the PR.
  • I took the opportunity to refactor the Experimental section of the documentation, breaking up each model into it's own markdown script which makes maintaining the docs for OOP models a little easier.

@pep8speaks

This comment was marked as outdated.

@BWMac BWMac changed the title WIP [SYNPY-1544] Synapse Agent OOP Model [SYNPY-1544] Synapse Agent OOP Model Jan 8, 2025
@BryanFauble
Copy link
Contributor

@BWMac A bunch of tests seem to be failing with:

FAILED tests/integration/synapseclient/models/async/test_agent_async.py::TestAgentPrompt::test_send_job_and_wait_async_with_post_exchange_args - synapseclient.core.exceptions.SynapseHTTPError: 400 Client Error: AgentRegistrationId='29' does not exist

Since the integration tests run against the DEV Instance of Synapse, does this agent need to be created there, and tests updated with this config?

@BWMac
Copy link
Contributor Author

BWMac commented Jan 22, 2025

@BryanFauble Ah yes the agent will need to be registered in Synapse Dev.

mkdocs.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@BryanFauble BryanFauble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome changes! This all looks good to me.

When all the tests are passing we can move forward on merging the changes.

@BWMac BWMac merged commit aaa9c50 into develop Jan 28, 2025
24 of 25 checks passed
@BWMac BWMac deleted the synpy-1544-synapse-agent-oop-model branch January 28, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants