Commit: f1d3cc5

Date: November 13, 2025 at 9:26 PM

Add nil check in Flow.callLLM() after BeforeModelCallbacks but before

accessing Model.GenerateContent(). This prevents a nil pointer dereference

panic when an llmagent is created without a Model configuration.

The check is positioned after BeforeModelCallbacks to allow callbacks that

return cached responses to short-circuit execution without requiring a Model.

This provides a clear error message instead of a cryptic segmentation fault:

'agent %q has no Model configured; ensure Model is set in llmagent.Config'

Preserves valid use cases:

  • Testing agent metadata/structure without running the agent
  • BeforeAgentCallbacks that short-circuit before agent execution
  • BeforeModelCallbacks that return cached responses

Fixes panic: runtime error: invalid memory address or nil pointer

dereference when sub-agents without Models were invoked.