Skip to content

Commit 5a84cc2

Browse files
committed
fix(agents): possible crash
1 parent acb8dbd commit 5a84cc2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

agents/agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ func (a *Agent[I, O]) Run(ctx context.Context, userInput *I, output *O, apiResp
644644
if fn := a.startHook; fn != nil {
645645
fn(ctx, a, userInput)
646646
}
647+
if apiResp == nil {
648+
apiResp = new(components.LLMResponse)
649+
}
647650
if err := a.chat(ctx, userInput, output, apiResp); err != nil {
648651
if fn := a.errorHook; fn != nil {
649652
fn(ctx, a, userInput, apiResp, err)

0 commit comments

Comments
 (0)