Agents#

For usage information and examples, please see Agents

class dataikuapi.dss.agent.DSSAgentListItem(client, data)#

An item in a list of agents

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.list_agents().

property project_key#
Returns:

The project

Return type:

string

property id#
Returns:

The id of the agent.

Return type:

string

property name#
Returns:

The name of the agent.

Return type:

string

as_llm()#

Returns this agent as a usable dataikuapi.dss.llm.DSSLLM for querying

class dataikuapi.dss.agent.DSSAgent(client, project_key, id)#

A handle to interact with a DSS-managed agent.

Important

Do not create this class directly, use dataikuapi.dss.project.DSSProject.get_agent() instead.

property id#
as_llm()#

Returns this agent as a usable dataikuapi.dss.llm.DSSLLM for querying

get_settings()#

Get the agent’s definition

Returns:

a handle on the agent definition

Return type:

dataikuapi.dss.agent.DSSAgentSettings

delete()#

Delete the agent

shutdown(version_id=None, force=False)#

Shutdown all instances of the given version of this agent

Parameters:
  • version_id (str | None) – If unspecified, uses the active version.

  • force (bool) – If True, cancel requests being processed and stop the instances. If False, let those active requests complete before stopping.

status(version_id=None)#

Query status of instances of the given version of this agent

Parameters:

version_id (str | None) – If unspecified, uses the active version.

Returns:

A dict holding the list of the status for each instance.

wake_up(version_id=None)#

Start an instance of an agent if none is started

Parameters:

version_id (str | None) – If unspecified, uses the active version.

class dataikuapi.dss.agent.DSSAgentSettings(client, settings)#

Settings for a agent

Important

Do not instantiate directly, use dataikuapi.dss.agent.DSSAgent.get_settings() instead

get_version_ids()#
property active_version#

Returns the active version of this agent. May return None if no version is declared as active

get_version_settings(version_id)#
property type#
get_raw()#

Returns the raw settings of the agent :return: the raw settings of the agent :rtype: dict

save()#

Saves the settings for this agent

class dataikuapi.dss.agent.DSSAgentVersionSettings(settings, version_settings)#
get_raw()#
property llm_id#

Only for Visual Agents :rtype: str

property tools#

Returns the list of tools of the agent. The list can be modified.

Each tool is a dict, containing at least “toolRef”, which is the identifier of the tool. The dict may also contain “additionalDescription” which is added to the description of the tool

add_tool(tool)#

Adds a tool to the agent

Parameters:

tool – a string (identifier of the tool), or a dataikuapi.dss.agent_tool.DSSAgentTool

property interaction_logging_selection#

Get the interaction logging selection for this version.

Before configuring interaction logging on an agent version, create the target dataset on the project:

project = client.get_project("MYPROJECT")
project.create_agent_interaction_logging_dataset(
    "agent_logs",
    connection_id="filesystem_managed",
    time_partitioning="DAY",
)

Example using inherited settings:

agent = project.get_agent("my_agent")
agent_settings = agent.get_settings()
version_settings = agent_settings.get_version_settings("v1")

agent_logging_selection = version_settings.interaction_logging_selection
agent_logging_selection.inherit()

agent_settings.save()

Example using explicit settings:

agent = project.get_agent("my_agent")
agent_settings = agent.get_settings()
version_settings = agent_settings.get_version_settings("v1")

agent_logging_selection = version_settings.interaction_logging_selection
agent_logging_selection.enable(
    "agent_logs",
    settings={
        "flushEveryS": 60,
        "flushEveryBytes": 1_000_000,
        "contentMode": "FULL",
    },
)

agent_settings.save()

Example disabling interaction logging:

agent = project.get_agent("my_agent")
agent_settings = agent.get_settings()
version_settings = agent_settings.get_version_settings("v1")

agent_logging_selection = version_settings.interaction_logging_selection
agent_logging_selection.disable()

agent_settings.save()
Return type:

dataikuapi.dss.agent.DSSAgentInteractionLoggingSelection

class dataikuapi.dss.agent.DSSAgentInteractionLoggingSettings(settings)#

Settings for agent interaction logging.

Important

Do not instantiate this class directly, use dataikuapi.dss.agent.DSSAgentInteractionLoggingSelection.settings instead.

CONTENT_MODE_FULL = 'FULL'#
CONTENT_MODE_NO_LOGS = 'NO_LOGS'#
CONTENT_MODE_NO_LOGS_NO_TRACE = 'NO_LOGS_NO_TRACE'#
get_raw()#

Returns the raw interaction logging settings.

Return type:

dict

get(key, default=None)#
property dataset_name#

The dataset name used for interaction logging.

Return type:

str | None

property write_as_user#

The DSS user used to write logs.

This value is read-only and is set automatically to the user who saves the agent settings.

Return type:

str | None

property flush_every_s#

The flush interval, in seconds.

Return type:

int | None

property flush_every_bytes#

The maximum buffered payload size before a flush.

Return type:

int | None

property content_mode#

The content logging mode.

Return type:

str | None

class dataikuapi.dss.agent.DSSAgentInteractionLoggingSelection(selection)#

Selection for agent interaction logging.

Important

Do not instantiate this class directly, use dataikuapi.dss.agent.DSSAgentVersionSettings.interaction_logging_selection instead.

MODE_INHERIT = 'INHERIT'#
MODE_EXPLICIT = 'EXPLICIT'#
MODE_NONE = 'NONE'#
get_raw()#

Returns the raw interaction logging selection.

Return type:

dict

get(key, default=None)#
property mode#

The interaction logging mode. One of INHERIT, EXPLICIT or NONE.

In INHERIT mode, settings are inherited from the project-level configuration.

Return type:

str | None

property settings#

The explicit interaction logging settings.

These settings are only used when the selection is in EXPLICIT mode.

Return type:

dataikuapi.dss.agent.DSSAgentInteractionLoggingSettings

enable(dataset_name, settings=None)#

Enable interaction logging on this agent version with explicit settings.

This only controls the agent version setting itself. Interaction logging can still be effectively unavailable if it is disabled at the instance level.

Parameters:
inherit()#

Enable interaction logging on this agent version in inherited mode.

In this mode, the version inherits the project-level interaction logging settings.

disable()#

Disable interaction logging on this agent version.

class dataikuapi.dss.agent_tool.DSSAgentToolListItem(client, project_key, data)#

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.list_agent_tools().

to_agent_tool()#

Convert the current item.

property id#
Returns:

The id of the tool.

Return type:

string

property type#
Returns:

The type of the tool

Return type:

string

property name#
Returns:

The name of the tool

Return type:

string

class dataikuapi.dss.agent_tool.DSSAgentTool(client, project_key, tool_id, descriptor=None)#

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.get_agent_tool().

property id#
Returns:

The id of the tool.

Return type:

string

get_descriptor()#

Get the descriptor of the tool

Returns:

a descriptor of the tool

Return type:

dict

get_settings()#

Get the agent tools’ settings

Returns:

a handle on the tool settings

Return type:

dataikuapi.dss.agent_tool.DSSAgentToolSettings or a subclass

delete()#

Delete the agent tool

as_langchain_structured_tool(context=None)#
run(input, context=None, subtool_name=None, memory_fragment=None, tool_validation_responses=None, tool_validation_requests=None)#

Execute a tool call

describe_tool_call(input, descriptor, context=None, subtool_name=None)#

Get a description for a tool call before it is executed

Returns:

a string description of the tool call

Return type:

Optional[str]

class dataikuapi.dss.agent_tool.DSSAgentToolCreator(project, type, name, id)#

Helper to create new agent tools

Important

Do not instantiate directly, use dataikuapi.dss.project.DSSProject.new_agent_tool() instead.

create()#

Creates the new agent tool in the project, and return a handle to interact with it.

Return type:

dataikuapi.dss.agent_tool.DSSAgentTool

class dataikuapi.dss.agent_tool.DSSAgentToolSettings(agent_tool, settings)#
get_raw()#
property params#

The parameters of the tool, as a dict. Changes to the dict will be reflected when saving

save()#

Saves the settings of the agent tool

property custom_fields#

The custom fields of the object as a dict. Returns None if there are no custom fields

property description#

The description of the object as a string

property short_description#

The short description of the object as a string

property tags#

The tags of the object, as a list of strings

class dataikuapi.dss.agent_tool.DSSVectorStoreSearchAgentToolCreator(project, type, name, id)#
with_knowledge_bank(kb)#
create()#

Creates the new agent tool in the project, and return a handle to interact with it.

Return type:

dataikuapi.dss.agent_tool.DSSAgentTool

class dataikuapi.dss.agent_tool.DSSVectorStoreSearchAgentToolSettings(agent_tool, settings)#
set_knowledge_bank(kb)#
property custom_fields#

The custom fields of the object as a dict. Returns None if there are no custom fields

property description#

The description of the object as a string

get_raw()#
property params#

The parameters of the tool, as a dict. Changes to the dict will be reflected when saving

save()#

Saves the settings of the agent tool

property short_description#

The short description of the object as a string

property tags#

The tags of the object, as a list of strings