MLflow API Reference
This page provides an index of important MLflow APIs used in agents, with direct links to the official MLflow documentation.
MLflow features marked as "Databricks only" are only available on Databricks-managed MLflow.
Quick links
Some of the APIs referenced on this page are currently in the Beta or Experimental stages. These APIs are subject to change or removal in future releases. Experimental APIs are available to all customers, and Beta APIs are available to most customers automatically. If you do not have access to a Beta API and need to request access, contact your Databricks support representative.
Experiment management
Manage MLflow experiments and runs for tracking agent development:
SDK
mlflow.search_runs()- Search and filter runs by criteriamlflow.set_experiment()- Set the active MLflow experimentmlflow.start_run()- Start a new MLflow run for tracking
Entities
mlflow.entities.Experiment- Experiment metadata and configurationmlflow.entities.Run- Run metadata, metrics, and parameters
Tracing
Instrument and capture execution traces from agents:
SDK
mlflow.delete_trace_tag()- Remove a tag from a tracemlflow.get_current_active_span()- Get the currently active spanmlflow.get_last_active_trace()- Retrieve the most recently completed tracemlflow.get_last_active_trace_id()- Get ID of the last active tracemlflow.get_trace()- Retrieve a trace by IDmlflow.search_traces()- Search and filter tracesmlflow.set_trace_tag()- Add a tag to a tracemlflow.start_span()- Manually start a new spanmlflow.trace- Decorator to automatically trace function executionmlflow.traceName- Context manager to set trace namemlflow.traceOutputs- Context manager to set trace outputsmlflow.tracing- Tracing module with configuration functionsmlflow.tracing.disable- Disable tracing globallymlflow.tracing.disable_notebook_display()- Disable trace display in notebooksmlflow.tracing.enable- Enable tracing globallymlflow.tracing.enable_notebook_display()- Enable trace display in notebooksmlflow.update_current_trace()- Update metadata for the current trace
Entities
mlflow.entities.Trace- Complete trace with all spans and metadatamlflow.entities.TraceData- Trace execution datamlflow.entities.TraceInfo- Trace metadata and summary informationmlflow.entities.Span- Individual span within a tracemlflow.entities.SpanEvent- Event occurring within a spanmlflow.entities.SpanType- Span type classification enummlflow.entities.Document- Document entity for RAG applications
Tracing integrations
Auto-instrumentation for GenAI frameworks and libraries that provide a dedicated autolog() function. For the complete list of supported integrations — including those traced through an OpenAI-compatible client — see MLflow Tracing Integrations.
mlflow.ag2.autolog- AG2 integrationmlflow.agno.autolog- Agno integrationmlflow.anthropic.autolog- Anthropic Claude integrationmlflow.autogen.autolog- Microsoft AutoGen integrationmlflow.bedrock.autolog- AWS Bedrock integrationmlflow.crewai.autolog- CrewAI integrationmlflow.dspy.autolog- DSPy integrationmlflow.gemini.autolog- Google Gemini integrationmlflow.groq.autolog- Groq integrationmlflow.haystack.autolog- Haystack integrationmlflow.langchain.autolog- LangChain integrationmlflow.litellm.autolog- LiteLLM integrationmlflow.llama_index.autolog- LlamaIndex integrationmlflow.mistral.autolog- Mistral AI integrationmlflow.openai.autolog- OpenAI integrationmlflow.pydantic_ai.autolog- PydanticAI integrationmlflow.smolagents.autolog- Smolagents integrationmlflow.strands.autolog- Strands Agents integration
Evaluation and monitoring
Core evaluation SDK
Core APIs for offline evaluation and production monitoring:
mlflow.genai.evaluate()- Evaluation harness to orchestrate offline evaluation with scorers and datasetsmlflow.genai.to_predict_fn()- Convert model output to standardized prediction function formatmlflow.genai.Scorer- Custom scorer class for object-oriented implementation with state managementmlflow.genai.scorer()- Scorer decorator for scorer creation and evaluation logic
Built-in scorers
Quality assessment scorers ready for immediate use. See Built-in LLM judges for what each one evaluates.
Single-turn scorers:
mlflow.genai.scorers.Safety- Content safety evaluationmlflow.genai.scorers.Correctness- Answer accuracy assessmentmlflow.genai.scorers.RelevanceToQuery- Query relevance scoringmlflow.genai.scorers.Guidelines- Custom guideline compliancemlflow.genai.scorers.ExpectationsGuidelines- Guideline evaluation with expectationsmlflow.genai.scorers.RetrievalGroundedness- RAG grounding assessmentmlflow.genai.scorers.RetrievalRelevance- Retrieved context relevancemlflow.genai.scorers.RetrievalSufficiency- Context sufficiency evaluation
Tool-call scorers:
mlflow.genai.scorers.ToolCallCorrectness- Correct tool calls and arguments for the requestmlflow.genai.scorers.ToolCallEfficiency- Efficient, non-redundant tool usage
Multi-turn (conversation) scorers:
mlflow.genai.scorers.ConversationCompleteness- All user questions addressed across the conversationmlflow.genai.scorers.UserFrustration- User frustration detection and resolutionmlflow.genai.scorers.KnowledgeRetention- Retention of information from earlier turnsmlflow.genai.scorers.ConversationalGuidelines- Guideline compliance across the conversationmlflow.genai.scorers.ConversationalRoleAdherence- Adherence to the assigned rolemlflow.genai.scorers.ConversationalSafety- Safe responses throughout the conversationmlflow.genai.scorers.ConversationalToolCallEfficiency- Efficient tool usage across the conversation
Helpers:
mlflow.genai.scorers.get_all_scorers()- Retrieve all built-in scorers
Production monitoring scorer lifecycle SDK
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Databricks previews.
Scorer lifecycle management for continuous quality tracking in production:
Scorer instance methods
Scorer.register()- Register custom scorer with serverScorer.start()- Begin online evaluation with samplingScorer.update()- Modify sampling configurationScorer.stop()- Stop online evaluation
Scorer registry functions
mlflow.genai.scorers.get_scorer()- Retrieve registered scorer by namemlflow.genai.scorers.list_scorers()- List all registered scorersmlflow.genai.scorers.delete_scorer()- Delete registered scorers by name
Scorer properties
Scorer.sample_rate- Current sampling rate (0.0-1.0)Scorer.filter_string- Current trace filter
Configuration classes
mlflow.genai.ScorerSamplingConfig- Sampling configuration data class
Assessment entities
Data structures for storing evaluation results and feedback:
mlflow.entities.Assessment- Evaluation result containermlflow.entities.AssessmentError- Assessment error detailsmlflow.entities.AssessmentSource- Source of the assessmentmlflow.entities.AssessmentSourceType- Assessment source type enummlflow.entities.Expectation- Expected ground truth outcomemlflow.entities.Feedback- Scorer output with value and rationale
Evaluation datasets
Create and manage versioned test datasets for systematic evaluation:
SDK
mlflow.genai.create_dataset()- Create a new evaluation datasetmlflow.genai.delete_dataset()- Delete an evaluation datasetmlflow.genai.get_dataset()- Retrieve an existing evaluation dataset
Entities
mlflow.genai.datasets.EvaluationDataset- Versioned test data containermerge_records()- Combine records from multiple sourcesset_profile()- Configure dataset profile settingsto_df()- Convert dataset to pandas DataFrameto_evaluation_dataset()- Convert to evaluation dataset format
Human labeling and review app (Databricks only)
Human feedback collection and review workflows for systematic quality assessment:
Labeling session SDK
mlflow.genai.create_labeling_session()- Create a new labeling sessionmlflow.genai.delete_labeling_session()- Delete a labeling sessionmlflow.genai.get_labeling_session()- Retrieve labeling session by IDmlflow.genai.get_labeling_sessions()- List all labeling sessionsmlflow.genai.get_review_app()- Retrieve review app instance
Label schema types
mlflow.genai.label_schemas.InputCategorical- Categorical input field typemlflow.genai.label_schemas.InputCategoricalList- Multi-select categorical inputmlflow.genai.label_schemas.InputNumeric- Numeric input field typemlflow.genai.label_schemas.InputText- Text input field typemlflow.genai.label_schemas.InputTextList- Multi-text input field typemlflow.genai.label_schemas.LabelSchema- Label schema definitionmlflow.genai.label_schemas.LabelSchemaType- Schema type enummlflow.genai.label_schemas.LabelSchemaType.EXPECTATION- Expectation schema typemlflow.genai.label_schemas.LabelSchemaType.FEEDBACK- Feedback schema type
Label schema SDK
mlflow.genai.label_schemas.create_label_schema()- Create a new label schemamlflow.genai.label_schemas.delete_label_schema()- Delete an existing label schemamlflow.genai.label_schemas.get_label_schema()- Retrieve label schema by name
Entities
-
mlflow.genai.Agent- Agent configuration for review app testing -
mlflow.genai.LabelingSession- Human labeling workflow manageradd_dataset()- Add evaluation dataset to labeling sessionadd_traces()- Add traces for human reviewset_assigned_users()- Assign reviewers to sessionsync()- Synchronize session state
-
mlflow.genai.ReviewApp- Interactive review applicationadd_agent()- Add agent for testingremove_agent()- Remove agent from review app
Prompt management
Version control and lifecycle management for prompts used in agents:
SDK
mlflow.genai.load_prompt()- Load a versioned prompt from the registrymlflow.genai.optimize_prompts()- Automatically improve prompts using optimization algorithmsmlflow.genai.register_prompt()- Register a new prompt to the registrymlflow.genai.search_prompts()- Search for prompts by name or tagsmlflow.genai.delete_prompt_alias()- Remove an alias from a prompt versionmlflow.genai.set_prompt_alias()- Assign an alias to a prompt version
Entities
mlflow.entities.Prompt- Prompt metadata and version information
Prompt optimization
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Databricks previews.
Automated prompt improvement using data-driven optimization algorithms:
SDK
mlflow.genai.optimize_prompts()- Run prompt optimization process
Optimizers
mlflow.genai.optimize.GepaPromptOptimizer- Iterative optimizer that refines prompts using LLM-driven reflectionmlflow.genai.optimize.MetaPromptOptimizer- Single-pass optimizer that applies metapromptingmlflow.genai.optimize.BasePromptOptimizer- Base class for implementing a custom optimizer
Entities
mlflow.genai.optimize.PromptOptimizationResult- Optimization results and metricsmlflow.genai.optimize.PromptOptimizerOutput- Output returned by a custom optimizer'soptimize()method
App version tracking
Track and manage agent versions in production:
SDK
mlflow.set_active_model()- Set the active model for version trackingmlflow.clear_active_model()- Clear the active model contextmlflow.get_active_model_id()- Get the current active model IDmlflow.create_external_model()- Register an external model deploymentmlflow.delete_logged_model_tag()- Remove a tag from logged modelmlflow.finalize_logged_model()- Finalize a logged modelmlflow.get_logged_model()- Retrieve logged model by IDmlflow.initialize_logged_model()- Initialize a new logged modelmlflow.last_logged_model()- Get the most recently logged modelmlflow.search_logged_models()- Search for logged modelsmlflow.set_logged_model_tags()- Add tags to logged modelmlflow.log_model_params()- Log parameters for a model
Entities
mlflow.entities.LoggedModel- Logged model metadata and informationmlflow.entities.LoggedModelStatus- Logged model status enummlflow.ActiveModel- Active model context manager