Skip to content

agent_dao

Agent data access object (DAO) module.

Attributes

Classes

AgentDao

AgentDao(session: Session)

Bases: BaseDao

AI Agent data access object (DAO)

Attributes

model_class property
model_class: Type[Agent]

Functions

get_agent_ref
get_agent_ref(
    agent_pkid: str,
    namespace_pkid: str | None = None,
    filter_deleted: bool = True,
    filter_disabled: bool = True,
) -> Optional[Agent]

Retrieve the reference to an agent based on the provided agent_pkid.

Parameters:

  • agent_pkid (str) –

    The primary key of the agent.

  • filter_deleted (bool, default: True ) –

    Whether to filter out deleted agents. Defaults to True.

  • filter_disabled (bool, default: True ) –

    Whether to filter out disabled agents. Defaults to True.

Returns:

  • Optional[Agent]

    Optional[Agent]: The reference to the agent if found, otherwise None.

get_by_name
get_by_name(
    name: str,
    filter_deleted: bool = True,
    filter_disabled: bool = True,
    namespaces_name_filter: str | None = None,
) -> Optional[Agent]

Retrieve an Agent by its name.

Parameters:

  • name (str) –

    The name of the Agent to retrieve.

  • filter_deleted (bool, default: True ) –

    Whether to filter out deleted Agents. Defaults to True.

  • filter_disabled (bool, default: True ) –

    Whether to filter out disabled Agents. Defaults to True.

  • namespaces_name_filter (str, default: None ) –

    The name of the Namespace to filter by. Defaults to None.

Returns:

  • Optional[Agent]

    Optional[Agent]: The retrieved Agent, or None if not found.

get_in_namespace
get_in_namespace(
    *,
    namespace_key: str,
    resource_key: str,
    filter_deleted: bool = True,
    filter_disabled: bool = True
) -> Agent | None

Retrieve an Agent in a specified namespace by its primary key ID or name.

Parameters:

  • namespace_key (str) –

    The primary key ID of the namespace.

  • resource_key (str) –

    The primary key ID or name of the agent.

  • filter_deleted (bool, default: True ) –

    Whether to filter out deleted activity sessions. Defaults to True.

  • filter_disabled (bool, default: True ) –

    Whether to filter out disabled activity sessions. Defaults to True.

Returns:

  • Agent | None

    Agent | None: The matching Agent or None if not found.

hard_delete_by_agent_pkid
hard_delete_by_agent_pkid(agent_pkid: str) -> int

Hard delete a specific agent.

Parameters:

  • agent_pkid (str) –

    The pkid of the agent.

Returns:

  • int ( int ) –

    The number of deleted rows.