from importlib.metadata import version as _metadata_version

from ._cancel import CancellationToken
from .agent import (
    Agent,
    AgentModelSettings,
    AgentRetries,
    AgentRunEvents,
    CallToolsNode,
    EndStrategy,
    InstrumentationSettings,
    ModelRequestNode,
    UserPromptNode,
    capture_run_messages,
)
from .agent.spec import AgentSpec
from .capabilities import AgentCapability, Capability, CapabilityFunc
from .concurrency import (
    AbstractConcurrencyLimiter,
    AnyConcurrencyLimit,
    ConcurrencyLimit,
    ConcurrencyLimiter,
)
from .embeddings import (
    Embedder,
    EmbeddingModel,
    EmbeddingResult,
    EmbeddingSettings,
)
from .exceptions import (
    AgentRunError,
    ApprovalRequired,
    CallDeferred,
    ConcurrencyLimitExceeded,
    CostCalculationFailedWarning,
    CostNotFoundWarning,
    FallbackExceptionGroup,
    IncompleteToolCall,
    MessageHistoryMutatedWarning,
    ModelAPIError,
    ModelHTTPError,
    ModelRetry,
    PydanticAIDeprecationWarning,
    RunCancelled,
    SkipModelRequest,
    SkipToolExecution,
    SkipToolValidation,
    ToolFailed,
    UndrainedPendingMessagesError,
    UnexpectedModelBehavior,
    UsageLimitExceeded,
    UserError,
)
from .format_prompt import format_as_xml
from .messages import (
    AgentStreamEvent,
    AudioFormat,
    AudioMediaType,
    AudioUrl,
    BaseToolCallPart,
    BaseToolReturnPart,
    BinaryAudio,
    BinaryContent,
    BinaryImage,
    CachePoint,
    CompactionPart,
    DeferredToolRequestsEvent,
    DeferredToolResultsEvent,
    DocumentFormat,
    DocumentMediaType,
    DocumentUrl,
    EnqueuedMessagesEvent,
    FilePart,
    FileUrl,
    FinalResultEvent,
    FinishReason,
    FunctionToolCallEvent,
    FunctionToolResultEvent,
    HandleResponseEvent,
    ImageFormat,
    ImageMediaType,
    ImageUrl,
    InstructionPart,
    ModelMessage,
    ModelMessagesTypeAdapter,
    ModelRequest,
    ModelRequestPart,
    ModelRequestState,
    ModelResponse,
    ModelResponsePart,
    ModelResponsePartDelta,
    ModelResponseState,
    ModelResponseStreamEvent,
    MultiModalContent,
    NativeToolCallPart,
    NativeToolReturnPart,
    OutputToolCallEvent,
    OutputToolResultEvent,
    PartDeltaEvent,
    PartEndEvent,
    PartStartEvent,
    RetryPromptPart,
    SpeechPart,
    SpeechPartDelta,
    SystemPromptPart,
    TextContent,
    TextPart,
    TextPartDelta,
    ThinkingPart,
    ThinkingPartDelta,
    ToolAvailabilityDeltaEvent,
    ToolAvailabilityDeltaPart,
    ToolCallEvent,
    ToolCallPart,
    ToolCallPartDelta,
    ToolResultEvent,
    ToolReturn,
    ToolReturnPart,
    UploadedFile,
    UserContent,
    UserPromptPart,
    VideoFormat,
    VideoMediaType,
    VideoUrl,
)
from .models import AbstractModel, ModelRequestContext, ModelResolutionContext, ModelSelectionContext
from .models.concurrency import ConcurrencyLimitedModel, limit_model_concurrency
from .native_tools import (
    AdvisorTool,
    CodeExecutionTool,
    FileSearchTool,
    ImageGenerationTool,
    MCPServerTool,
    MemoryTool,
    WebFetchTool,
    WebSearchTool,
    WebSearchUserLocation,
    XSearchTool,
)
from .output import NativeOutput, PromptedOutput, StructuredDict, TextOutput, ToolOutput
from .profiles import (
    DEFAULT_PROFILE,
    InlineDefsJsonSchemaTransformer,
    JsonSchemaTransformer,
    ModelProfile,
    ModelProfileSpec,
)
from .run import AgentRun, AgentRunResult, AgentRunResultEvent
from .settings import ModelSettings, ToolChoice, ToolOrOutput
from .template import TemplateStr
from .tools import (
    AgentNativeTool,
    DeferredToolRequests,
    DeferredToolResults,
    RunContext,
    Tool,
    ToolApproved,
    ToolDefinition,
    ToolDenied,
)
from .toolsets import (
    AbstractToolset,
    AgentToolset,
    ApprovalRequiredToolset,
    CombinedToolset,
    DeferredLoadingToolset,
    ExternalToolset,
    FilteredToolset,
    FunctionToolset,
    IncludeReturnSchemasToolset,
    PrefixedToolset,
    PreparedToolset,
    RenamedToolset,
    SetMetadataToolset,
    ToolsetFunc,
    ToolsetTool,
    WrapperToolset,
)
from .usage import RequestUsage, RunUsage, UsageLimits

__all__ = (
    '__version__',
    # agent
    'Agent',
    'CancellationToken',
    'AgentModelSettings',
    'AgentRetries',
    'AgentSpec',
    'EndStrategy',
    'CallToolsNode',
    'ModelRequestNode',
    'UserPromptNode',
    'capture_run_messages',
    'InstrumentationSettings',
    # embeddings
    'Embedder',
    'EmbeddingModel',
    'EmbeddingSettings',
    'EmbeddingResult',
    # concurrency
    'AbstractConcurrencyLimiter',
    'AnyConcurrencyLimit',
    'ConcurrencyLimit',
    'ConcurrencyLimitedModel',
    'ConcurrencyLimiter',
    'limit_model_concurrency',
    # exceptions
    'AgentRunError',
    'CallDeferred',
    'ApprovalRequired',
    'ConcurrencyLimitExceeded',
    'CostCalculationFailedWarning',
    'CostNotFoundWarning',
    'ModelRetry',
    'ToolFailed',
    'ModelAPIError',
    'ModelHTTPError',
    'FallbackExceptionGroup',
    'IncompleteToolCall',
    'RunCancelled',
    'MessageHistoryMutatedWarning',
    'PydanticAIDeprecationWarning',
    'SkipModelRequest',
    'SkipToolExecution',
    'SkipToolValidation',
    'UndrainedPendingMessagesError',
    'UnexpectedModelBehavior',
    'UsageLimitExceeded',
    'UserError',
    # messages
    'AgentStreamEvent',
    'AudioFormat',
    'AudioMediaType',
    'AudioUrl',
    'SpeechPart',
    'SpeechPartDelta',
    'BaseToolCallPart',
    'BaseToolReturnPart',
    'BinaryAudio',
    'BinaryContent',
    'NativeToolCallPart',
    'NativeToolReturnPart',
    'CachePoint',
    'CompactionPart',
    'DocumentFormat',
    'DocumentMediaType',
    'DocumentUrl',
    'EnqueuedMessagesEvent',
    'FileUrl',
    'FilePart',
    'DeferredToolRequestsEvent',
    'DeferredToolResultsEvent',
    'FinalResultEvent',
    'FinishReason',
    'FunctionToolCallEvent',
    'FunctionToolResultEvent',
    'HandleResponseEvent',
    'ImageFormat',
    'ImageMediaType',
    'ImageUrl',
    'BinaryImage',
    'InstructionPart',
    'ModelMessage',
    'ModelMessagesTypeAdapter',
    'ModelRequest',
    'ModelRequestPart',
    'ModelRequestState',
    'ModelResponse',
    'ModelResponsePart',
    'ModelResponsePartDelta',
    'ModelResponseState',
    'ModelResponseStreamEvent',
    'MultiModalContent',
    'OutputToolCallEvent',
    'OutputToolResultEvent',
    'PartDeltaEvent',
    'PartEndEvent',
    'PartStartEvent',
    'RetryPromptPart',
    'SystemPromptPart',
    'TextContent',
    'TextPart',
    'TextPartDelta',
    'ThinkingPart',
    'ToolAvailabilityDeltaEvent',
    'ToolAvailabilityDeltaPart',
    'ThinkingPartDelta',
    'ToolCallEvent',
    'ToolCallPart',
    'ToolCallPartDelta',
    'ToolResultEvent',
    'ToolReturn',
    'ToolReturnPart',
    'UploadedFile',
    'UserContent',
    'UserPromptPart',
    'VideoFormat',
    'VideoMediaType',
    'VideoUrl',
    # profiles
    'ModelProfile',
    'ModelProfileSpec',
    'DEFAULT_PROFILE',
    'InlineDefsJsonSchemaTransformer',
    'JsonSchemaTransformer',
    # tools
    'AgentNativeTool',
    'Tool',
    'ToolDefinition',
    'RunContext',
    'DeferredToolRequests',
    'DeferredToolResults',
    'ToolApproved',
    'ToolDenied',
    # toolsets
    'AbstractToolset',
    'AgentToolset',
    'ApprovalRequiredToolset',
    'CombinedToolset',
    'DeferredLoadingToolset',
    'ExternalToolset',
    'FilteredToolset',
    'FunctionToolset',
    'IncludeReturnSchemasToolset',
    'PrefixedToolset',
    'PreparedToolset',
    'RenamedToolset',
    'SetMetadataToolset',
    'ToolsetFunc',
    'ToolsetTool',
    'WrapperToolset',
    # builtin_tools
    'AdvisorTool',
    'CodeExecutionTool',
    'FileSearchTool',
    'ImageGenerationTool',
    'MCPServerTool',
    'MemoryTool',
    'WebFetchTool',
    'WebSearchTool',
    'WebSearchUserLocation',
    'XSearchTool',
    # capabilities
    'AgentCapability',
    'Capability',
    'CapabilityFunc',
    # output
    'ToolOutput',
    'NativeOutput',
    'PromptedOutput',
    'TextOutput',
    'StructuredDict',
    # template
    'TemplateStr',
    # format_prompt
    'format_as_xml',
    # models
    'AbstractModel',
    'ModelRequestContext',
    'ModelResolutionContext',
    'ModelSelectionContext',
    # settings
    'ModelSettings',
    'ToolChoice',
    'ToolOrOutput',
    # usage
    'RunUsage',
    'RequestUsage',
    'UsageLimits',
    # run
    'AgentRun',
    'AgentRunEvents',
    'AgentRunResult',
    'AgentRunResultEvent',
)
__version__ = _metadata_version('pydantic_ai_slim')
