Skip to content

Commit 640d97b

Browse files
committed
small fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 2334456 commit 640d97b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/agent/agent.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ func (a *Agent) SharedState() *types.AgentSharedState {
180180
return a.sharedState
181181
}
182182

183+
// SetStreamCallback sets (or replaces) the stream callback on a live agent.
184+
// This allows callers to wire streaming events after agent creation,
185+
// e.g. in distributed mode where the callback routes to NATS.
186+
func (a *Agent) SetStreamCallback(fn func(cogito.StreamEvent)) {
187+
a.options.streamCallback = fn
188+
}
189+
183190
// StartConversationConsumer starts the goroutine that dispatches new conversation
184191
// messages to subscribers. This must be called when using AskDirect() without Run(),
185192
// otherwise the ConversationAction handler will deadlock on the newConversations channel.

0 commit comments

Comments
 (0)