Skip to content

Temporal: allow cross agent tool registration #3768

@darugar

Description

@darugar

Description

In scenarios where agents need to be defined dynamically (example), the list of agent tools cannot be registered by the agent when the temporal worker is created, since the agent is not yet created.

Please decouple tool registration and naming from agent definition and naming in order to allow multiple agents (and dynamically created agents) within a temporal workflow to use the same set of registered tools. A master list of tools would be registered with the temporal workflow at the time of workflow creation, and dynamically created agents could refer to and use the subset of those tools as needed.

For example, if the tool naming (currently something like agent__{name}__tool__{tool_name}) were to not include the agent name and instead be a workflow-wide tool, then dynamic agents could refer to the tool by its name/slug.

It would be nice to have a helper function for temporal workflow tool registration as well.

References

From the slack conversation with @DouweM :

That would be pretty easy to make work -- you can already create a FunctionToolset and then manually wrap it in a TemporalFunctionToolset (currently private) and then pass the temporal_function_toolset.temporal_activities to the worker. The only part that isn't done yet is letting you pass those TemporalFunctionToolsets to TemporalAgent.run(toolsets=...), which would require replacing this error with a check that all the toolsets are properly wrapped for Temporal:

if toolsets is not None:
raise UserError(
'Toolsets cannot be set at agent run time inside a Temporal workflow, it must be set at agent creation time.'
)

Related to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions