๐ŸŒOOBE-PROTOCOL + NEXTJS + LANGCHAIN

[NOT RELEASED YET]

OOBE Protocol Integration in Next.js

Integrate oobe-protocol within the Next.js framework to use the agent instance from the backend. Initialize the core using the predefined method. We'll employ Langchain to support specific integrated functions of the agent.

Steps

  1. Export a Handler: Define and export an asynchronous handler function as a backend route. This is essential for initializing the agent and obtaining responses from it.

  2. Verify Keys: Ensure the oobeKey = '' //empty string, openAiKey, and privateKey are present. Return a 400 status with an error message if any are missing.

  3. Create OOBE Instance: Use the OobeCore class with necessary parameters to create an OOBE instance. Set configurations using ConfigManager.

  4. Setup Streaming and Response: Use the TextEncoder to stream events, handle different events like "on_chat_model_stream", and write the encoded data to the response.

  5. Error Handling: Implement error handling mechanisms to catch and log errors, returning appropriate responses.

By following these steps, you can effectively run the agent and retrieve execution responses, ensuring smooth and integrated backend operations with Next.js and OOBE protocol.

Last updated