Skip to content

Agents API

This section provides detailed API documentation for the specialized agent types and multi-agent systems in Scoras.

Specialized Agents

ExpertAgent

class ExpertAgent(Agent):
    def __init__(
        self, 
        model: str, 
        expertise: str,
        knowledge_base: Optional[List[Document]] = None,
        temperature: float = 0.3,
        max_tokens: Optional[int] = None,
        tools: Optional[List[Tool]] = None,
        enable_scoring: bool = True,
        metadata: Optional[Dict[str, Any]] = None
    ):
        """
        Initialize an Expert Agent specialized in a specific domain.

        Args:
            model: Model identifier in format "provider:model_name" (e.g., "openai:gpt-4o")
            expertise: Domain of expertise (e.g., "mathematics", "physics", "medicine")
            knowledge_base: Optional specialized knowledge documents
            temperature: Sampling temperature (0.0-1.0), defaults to lower for experts
            max_tokens: Maximum tokens to generate in responses
            tools: Optional list of tools available to the agent
            enable_scoring: Whether to track complexity scoring
            metadata: Optional metadata for the agent
        """

CreativeAgent

class CreativeAgent(Agent):
    def __init__(
        self, 
        model: str, 
        creative_domain: str,
        style_guide: Optional[str] = None,
        temperature: float = 0.8,
        max_tokens: Optional[int] = None,
        tools: Optional[List[Tool]] = None,
        enable_scoring: bool = True,
        metadata: Optional[Dict[str, Any]] = None
    ):
        """
        Initialize a Creative Agent specialized in generating creative content.

        Args:
            model: Model identifier in format "provider:model_name" (e.g., "anthropic:claude-3-opus")
            creative_domain: Creative domain (e.g., "writing", "design", "music")
            style_guide: Optional style guidelines for content generation
            temperature: Sampling temperature (0.0-1.0), defaults to higher for creativity
            max_tokens: Maximum tokens to generate in responses
            tools: Optional list of tools available to the agent
            enable_scoring: Whether to track complexity scoring
            metadata: Optional metadata for the agent
        """

RAGAgent

class RAGAgent(Agent):
    def __init__(
        self, 
        model: str, 
        documents: List[Document],
        retriever_type: str = "semantic",
        chunk_size: int = 1000,
        chunk_overlap: int = 200,
        temperature: float = 0.5,
        max_tokens: Optional[int] = None,
        tools: Optional[List[Tool]] = None,
        enable_scoring: bool = True,
        metadata: Optional[Dict[str, Any]] = None
    ):
        """
        Initialize a RAG Agent with built-in retrieval capabilities.

        Args:
            model: Model identifier in format "provider:model_name"
            documents: List of documents for the knowledge base
            retriever_type: Type of retriever ("semantic", "keyword", "hybrid", "contextual")
            chunk_size: Size of document chunks for indexing
            chunk_overlap: Overlap between chunks
            temperature: Sampling temperature (0.0-1.0)
            max_tokens: Maximum tokens to generate in responses
            tools: Optional list of tools available to the agent
            enable_scoring: Whether to track complexity scoring
            metadata: Optional metadata for the agent
        """

Multi-Agent Systems

MultiAgentSystem

class MultiAgentSystem:
    def __init__(
        self,
        agents: Dict[str, Agent],
        coordinator: Optional[Agent] = None,
        enable_scoring: bool = True
    ):
        """
        Initialize a Multi-Agent System with multiple specialized agents.

        Args:
            agents: Dictionary mapping agent names to Agent instances
            coordinator: Optional coordinator agent to manage task delegation
            enable_scoring: Whether to track complexity scoring
        """

    async def run(self, query: str) -> Dict[str, Any]:
        """
        Run the multi-agent system asynchronously.

        Args:
            query: User query to process

        Returns:
            Dictionary containing the final response and agent contributions
        """

    def run_sync(self, query: str) -> Dict[str, Any]:
        """
        Run the multi-agent system synchronously.

        Args:
            query: User query to process

        Returns:
            Dictionary containing the final response and agent contributions
        """

    async def stream(self, query: str) -> AsyncIterator[Dict[str, Any]]:
        """
        Stream the multi-agent system's response asynchronously.

        Args:
            query: User query to process

        Yields:
            Dictionaries containing partial responses and agent contributions
        """

    def get_complexity_score(self) -> Dict[str, Any]:
        """
        Get the complexity score for the multi-agent system.

        Returns:
            Dictionary containing complexity score information
        """

AgentTeam

class AgentTeam:
    def __init__(
        self,
        agents: List[Agent],
        team_strategy: str = "collaborative",
        enable_scoring: bool = True
    ):
        """
        Initialize an Agent Team with a specific collaboration strategy.

        Args:
            agents: List of Agent instances in the team
            team_strategy: Collaboration strategy ("collaborative", "competitive", "debate")
            enable_scoring: Whether to track complexity scoring
        """

    async def run(self, query: str) -> str:
        """
        Run the agent team asynchronously.

        Args:
            query: User query to process

        Returns:
            Team's consensus response
        """

    def run_sync(self, query: str) -> str:
        """
        Run the agent team synchronously.

        Args:
            query: User query to process

        Returns:
            Team's consensus response
        """

    def get_complexity_score(self) -> Dict[str, Any]:
        """
        Get the complexity score for the agent team.

        Returns:
            Dictionary containing complexity score information
        """

Agent Factories

create_agent

def create_agent(
    agent_type: str,
    model: str,
    **kwargs
) -> Agent:
    """
    Factory function to create different types of agents.

    Args:
        agent_type: Type of agent to create ("standard", "expert", "creative", "rag")
        model: Model identifier in format "provider:model_name"
        **kwargs: Additional arguments specific to the agent type

    Returns:
        Instantiated Agent of the specified type
    """

create_multi_agent_system

def create_multi_agent_system(
    system_type: str,
    agents: Dict[str, Agent],
    **kwargs
) -> Union[MultiAgentSystem, AgentTeam]:
    """
    Factory function to create different types of multi-agent systems.

    Args:
        system_type: Type of system to create ("system", "team")
        agents: Dictionary mapping agent names to Agent instances
        **kwargs: Additional arguments specific to the system type

    Returns:
        Instantiated multi-agent system of the specified type
    """