"""
Boring-OS Python SDK.

Provides native access to Boring-OS tools, agents, models, and flows
with seamless integration with popular AI agent frameworks
(LangChain, Google ADK, AWS Bedrock, OpenAI).

Basic usage:
    from boring_os import BoringOS

    client = BoringOS(
        base_url="http://localhost:8080",
        api_key="your_api_key"
    )

    # Call a tool synchronously
    result = client.tools.call("get_customer_profile", customer_id="123")

    # Run an agent
    response = client.agents.run("billing_agent", message="Why overcharged?")

    # Direct model completion
    completion = client.models.complete(
        model="claude-sonnet-4",
        messages=[{"role": "user", "content": "Hello"}]
    )

    # Run a multi-agent flow
    result = client.flows.run("billing_resolution_flow", message="Refund please")

Tracing (requires: pip install boring-os[opik]):
    from boring_os import BoringOS

    # Enable Opik tracing
    client = BoringOS(
        api_key="...",
        enable_tracing=True,
        opik_project="my-agent"
    )

    # All tool calls are now traced to Opik
    result = client.tools.call("get_customer_profile", customer_id="123")
"""

from boring_os.client import BoringOS, Session
from boring_os.exceptions import (
    AgentError,
    AgentNotFoundError,
    AgentTimeoutError,
    AuthenticationError,
    BoringOSError,
    FlowError,
    FlowNotFoundError,
    FlowTimeoutError,
    ModelError,
    RateLimitError,
    SessionError,
    ToolError,
    ToolNotFoundError,
    ToolTimeoutError,
    ValidationError,
)
from boring_os.models import (
    ErrorInfo,
    Tool,
    ToolInfo,
    ToolListResponse,
    ToolResult,
    ToolResultMetadata,
)

# Agent models
from boring_os.agent_models import (
    AgentDefinition,
    AgentListResponse,
    AgentResponse,
    AgentSessionInfo,
    AgentStreamChunk,
)

# Model models
from boring_os.model_models import (
    ModelCompletion,
    ModelEmbedding,
    ModelInfo,
    ModelStreamChunk,
)

# Flow models
from boring_os.flow_models import (
    FlowDefinition,
    FlowListResponse,
    FlowResult,
    FlowStreamChunk,
)

# Session
from boring_os.sessions import AgentSession

__version__ = "0.2.0"

__all__ = [
    # Main client
    "BoringOS",
    "Session",
    # Agent session
    "AgentSession",
    # Exceptions -- base
    "BoringOSError",
    "AuthenticationError",
    "RateLimitError",
    "ValidationError",
    # Exceptions -- tools
    "ToolError",
    "ToolNotFoundError",
    "ToolTimeoutError",
    # Exceptions -- agents
    "AgentError",
    "AgentNotFoundError",
    "AgentTimeoutError",
    # Exceptions -- flows
    "FlowError",
    "FlowNotFoundError",
    "FlowTimeoutError",
    # Exceptions -- models & sessions
    "ModelError",
    "SessionError",
    # Tool models
    "Tool",
    "ToolInfo",
    "ToolListResponse",
    "ToolResult",
    "ToolResultMetadata",
    "ErrorInfo",
    # Agent models
    "AgentResponse",
    "AgentStreamChunk",
    "AgentDefinition",
    "AgentListResponse",
    "AgentSessionInfo",
    # Model models
    "ModelCompletion",
    "ModelStreamChunk",
    "ModelEmbedding",
    "ModelInfo",
    # Flow models
    "FlowResult",
    "FlowStreamChunk",
    "FlowDefinition",
    "FlowListResponse",
    # Tracing (lazy imports)
    "configure_tracing",
    "OpikTracer",
    "is_opik_available",
]


# Lazy imports for tracing to avoid requiring opik as a hard dependency
def __getattr__(name: str):
    """Lazy import tracing utilities."""
    if name in ("OpikTracer", "configure_tracing", "is_opik_available"):
        from boring_os import tracing
        return getattr(tracing, name)
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
