Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ func NewLocalRuntime(agents *team.Team, opts ...Opt) (*LocalRuntime, error) {

r.sessionCompactor = newSessionCompactor(model, r.sessionStore)

// Register runtime-managed tool handlers once during construction.
// This avoids concurrent map writes when multiple goroutines call
// RunStream on the same runtime (e.g. background agent sessions).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Background agent sessions are using the same runtime??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, yes. I'm still trying to improve the code

r.registerDefaultTools()

slog.Debug("Creating new runtime", "agent", r.currentAgent, "available_agents", agents.Size())

return r, nil
Expand Down