Providers API Reference¶
Provider clients for interacting with observability backends.
Base Provider¶
Base provider interface for Shepherd MCP.
This module defines the abstract base classes and common exceptions for all provider implementations.
- exception shepherd_mcp.providers.base.AuthenticationError[source]¶
Bases:
ProviderErrorAuthentication failed.
- class shepherd_mcp.providers.base.BaseProvider[source]¶
Bases:
ABCAbstract base class for observability providers.
All provider implementations should inherit from this class and implement the required methods.
- exception shepherd_mcp.providers.base.NotFoundError[source]¶
Bases:
ProviderErrorResource not found.
- exception shepherd_mcp.providers.base.ProviderError[source]¶
Bases:
ExceptionBase exception for provider errors.
- exception shepherd_mcp.providers.base.RateLimitError[source]¶
Bases:
ProviderErrorRate limit exceeded.
AIOBS Client¶
Client for the Shepherd/AIOBS observability backend.
AIOBS provider client for Shepherd MCP.
- class shepherd_mcp.providers.aiobs.AIOBSClient(api_key=None, endpoint=None)[source]¶
Bases:
BaseProviderClient for AIOBS API.
- get_session(session_id)[source]¶
Get a specific session with its trace tree.
- Parameters:
session_id (str) – The session ID to fetch.
- Returns:
SessionsResponse with the session data.
- Return type:
- shepherd_mcp.providers.aiobs.eval_is_failed(evaluation)[source]¶
Check if an evaluation result indicates failure.
- shepherd_mcp.providers.aiobs.filter_sessions(response, query=None, labels=None, provider=None, model=None, function=None, after=None, before=None, has_errors=False, evals_failed=False)[source]¶
Filter sessions based on criteria.
- shepherd_mcp.providers.aiobs.session_has_errors(session, events, function_events)[source]¶
Check if a session has any errors.
- shepherd_mcp.providers.aiobs.session_has_failed_evals(session, events, function_events)[source]¶
Check if a session has any failed evaluations.
- shepherd_mcp.providers.aiobs.session_has_function(session, function_events, function_name)[source]¶
Check if a session has calls to the specified function.
- Parameters:
session (Session)
function_events (list[FunctionEvent])
function_name (str)
- Return type:
- shepherd_mcp.providers.aiobs.session_has_model(session, events, model)[source]¶
Check if a session has events using the specified model.
- shepherd_mcp.providers.aiobs.session_has_provider(session, events, function_events, provider)[source]¶
Check if a session has events from the specified provider.
Langfuse Client¶
Client for the Langfuse observability platform.
Langfuse provider client for Shepherd MCP.
- class shepherd_mcp.providers.langfuse.LangfuseClient(public_key=None, secret_key=None, host=None)[source]¶
Bases:
BaseProviderClient for Langfuse API.
Uses Basic Auth with public_key:secret_key. API Reference: https://api.reference.langfuse.com/
- DEFAULT_HOST = 'https://cloud.langfuse.com'¶
- get_observation(observation_id)[source]¶
Get a specific observation.
- Parameters:
observation_id (str) – The observation ID to fetch.
- Returns:
LangfuseObservation with observation data.
- Return type:
- get_score(score_id)[source]¶
Get a specific score.
- Parameters:
score_id (str) – The score ID to fetch.
- Returns:
LangfuseScore with score data.
- Return type:
- get_session(session_id)[source]¶
Get a specific session.
- Parameters:
session_id (str) – The session ID to fetch.
- Returns:
LangfuseSession with session data.
- Return type:
- get_trace(trace_id)[source]¶
Get a specific trace with its observations.
- Parameters:
trace_id (str) – The trace ID to fetch.
- Returns:
LangfuseTrace with full trace data including observations.
- Return type:
- list_observations(limit=50, page=1, name=None, user_id=None, trace_id=None, obs_type=None, from_timestamp=None, to_timestamp=None)[source]¶
List observations with pagination and filters.
- Parameters:
limit (int) – Maximum number of results per page.
page (int) – Page number (1-indexed).
name (str | None) – Filter by observation name.
user_id (str | None) – Filter by user ID.
trace_id (str | None) – Filter by trace ID.
obs_type (str | None) – Filter by type (GENERATION, SPAN, EVENT).
from_timestamp (str | None) – Filter by start timestamp.
to_timestamp (str | None) – Filter by end timestamp.
- Returns:
LangfuseObservationsResponse with observations data.
- Return type:
- list_scores(limit=50, page=1, name=None, user_id=None, trace_id=None, from_timestamp=None, to_timestamp=None)[source]¶
List scores with pagination and filters.
- Parameters:
limit (int) – Maximum number of results per page.
page (int) – Page number (1-indexed).
name (str | None) – Filter by score name.
user_id (str | None) – Filter by user ID.
trace_id (str | None) – Filter by trace ID.
from_timestamp (str | None) – Filter by start timestamp.
to_timestamp (str | None) – Filter by end timestamp.
- Returns:
LangfuseScoresResponse with scores data.
- Return type:
- list_sessions(limit=50, page=1, from_timestamp=None, to_timestamp=None)[source]¶
List sessions with pagination.
- Parameters:
- Returns:
LangfuseSessionsResponse with sessions data and pagination meta.
- Return type:
- list_traces(limit=50, page=1, user_id=None, name=None, session_id=None, tags=None, from_timestamp=None, to_timestamp=None)[source]¶
List traces with pagination and filters.
- Parameters:
limit (int) – Maximum number of results per page.
page (int) – Page number (1-indexed).
user_id (str | None) – Filter by user ID.
name (str | None) – Filter by trace name.
session_id (str | None) – Filter by session ID.
from_timestamp (str | None) – Filter by start timestamp.
to_timestamp (str | None) – Filter by end timestamp.
- Returns:
LangfuseTracesResponse with traces data and pagination meta.
- Return type: