Skip to content

Agents

Agents are the core building blocks of the Video Agent system. They are responsible for processing input messages and generating output messages.

Agent Interface

Base Agent is the base class for all agents. It provides a common interface for all agents to follow.

Base Agent

director.agents.base.BaseAgent

BaseAgent(session, **kwargs)

Bases: ABC

Interface for all agents. All agents should inherit from this class.

Source code in backend/director/agents/base.py
def __init__(self, session: Session, **kwargs):
    self.session: Session = session
    self.output_message: OutputMessage = self.session.output_message

get_parameters

get_parameters()

Return the automatically inferred parameters for the function using the dcstring of the function.

Source code in backend/director/agents/base.py
def get_parameters(self):
    """Return the automatically inferred parameters for the function using the dcstring of the function."""
    function_inferrer = FunctionInferrer.infer_from_function_reference(self.run)
    function_json = function_inferrer.to_json_schema()
    parameters = function_json.get("parameters")
    if not parameters:
        raise Exception(
            "Failed to infere parameters, please define JSON instead of using this automated util."
        )
    return parameters

to_llm_format

to_llm_format()

Convert the agent to LLM tool format.

Source code in backend/director/agents/base.py
def to_llm_format(self):
    """Convert the agent to LLM tool format."""
    return {
        "name": self.agent_name,
        "description": self.description,
        "parameters": self.parameters,
    }

Agent Response

director.agents.base.AgentResponse pydantic-model

Bases: BaseModel

Data model for respones from agents.