-
Notifications
You must be signed in to change notification settings - Fork 374
Description
Please read this first
- Have you read the docs? Yes
- Have you searched for related issues? Yes
Describe the feature
An option to prevent the handoff to an agent, basically disabling the automatic agent loop offered by this package. Something like a pre-handoff hook, that we could conditionally choose if the request should be handed off or not.
Why?
I am looking to have a triage agent that hands off to other agents, but instead of utilizing the built-in agent loop orchestration, I would like to manually call the agent that the request needs to be handed off to. This will allow a UI to intercept the handoff, connect to the correct agent and initiate a specific flow for that particular agent.
Potential solutions?
This request seems very similar to the is_enabled option of the python hand off. If that's the case, then we can maybe just replicate it for js.
const triageAgent = Agent.create({
name: 'Triage agent',
handoffs: [billingAgent, handoff(refundAgent, {
isEnabled: (context, input) => {
return true; // condition
}
})],
});
Note
The triage agent's response should include the attempted handoff information (handoff agent name), so the request can be optionally redirected manually to that agent at a later time.