register_function

register_function(
    f: Callable[..., Any],
    *,
    caller: ConversableAgent,
    executor: ConversableAgent,
    name: str | None = None,
    description: str
) -> None

Register a function to be proposed by an agent and executed for an executor.
This function can be used instead of function decorators @ConversationAgent.register_for_llm and @ConversationAgent.register_for_execution.

Parameters:
NameDescription
fthe function to be registered.

Type: Callable[…, Any]
callerthe agent calling the function, typically an instance of ConversableAgent.

Type: ConversableAgent
executorthe agent executing the function, typically an instance of UserProxy.

Type: ConversableAgent
namename of the function.

If None, the function name will be used (default: None).

Type: str | None

Default: None
descriptiondescription of the function.

The description is used by LLM to decode whether the function is called.

Make sure the description is properly describing what the function does or it might not be called by LLM when needed.

Type: str