Mosaic AI Agent Framework: Author and deploy a simple OpenAI agent
This notebook demonstrates how to author a OpenAI agent that's compatible with Mosaic AI Agent Framework features. In this notebook you learn to:
- Author a OpenAI agent with
ChatAgent
- Manually test the agent's output
- Log and deploy the agent
To learn more about authoring an agent using Mosaic AI Agent Framework, see Databricks documentation (AWS | Azure).
Prerequisites
- Address all
TODO
s in this notebook.
Define the agent in code
Define the agent code in a single cell below. This lets you easily write the agent code to a local Python file, using the %%writefile
magic command, for subsequent logging and deployment.
Test the agent
Interact with the agent to test its output.
Since you manually traced methods within ChatAgent
, you can view the trace for each step the agent takes, with any LLM calls made via the OpenAI SDK automatically traced by autologging.
Replace this placeholder input with an appropriate domain-specific example for your agent.
Log the agent
as an MLflow model
Log the agent as code from the agent.py
file. See MLflow - Models from Code.
Pre-deployment agent validation
Before registering and deploying the agent, perform pre-deployment checks using the mlflow.models.predict() API. See Databricks documentation (AWS | Azure).
Register the model to Unity Catalog
Before you deploy the agent, you must register the agent to Unity Catalog.
- TODO Update the
catalog
,schema
, andmodel_name
below to register the MLflow model to Unity Catalog.