-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
questionQuestion about using the SDKQuestion about using the SDK
Description
Question
- I'm using the
is_enabledparam within the @function_tool decorator to control the tools that are exposed to a user at runtime based on the callable function below to control the value foris_enabled
def _is_cm_enrolled(ctx: RunContextWrapper[AgentContext], agent: AgentBase) -> bool:
return ctx.context.is_cm_enrolled # by default is True
- I always bump into this error if the opening query for the session already calls a tool e.g. "what's my credit score?".
agents.exceptions.ModelBehaviorError: Tool fetch_latest_credit_report" /> not found in agent Agent
Implementation of tool as follows:
@function_tool(is_enabled=_is_cm_enrolled)
async def fetch_latest_credit_report(
wrapper: RunContextWrapper[AgentContext],
) -> dict | None:
"""
High level data points e.g.
- credit score
- credit utilization rate
- credit age
- credit inquiries
- payment history
"""
data = await _credit_report_retriever_client._fetch(
request={
"user_id": "",
"request_source": "",
},
)
return data
- However, if the opening query is something generic like "hello", this error doesn't bubble up.
Am I doing something wrong here?
Metadata
Metadata
Assignees
Labels
questionQuestion about using the SDKQuestion about using the SDK