File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -579,6 +579,13 @@ func WithParentID(parentID string) Opt {
579579 }
580580}
581581
582+ // WithID sets the session ID. If not set, a UUID will be generated.
583+ func WithID (id string ) Opt {
584+ return func (s * Session ) {
585+ s .ID = id
586+ }
587+ }
588+
582589// WithExcludedTools sets tool names that should be filtered out of the agent's
583590// tool list for this session. This prevents recursive tool calls in skill
584591// sub-sessions.
@@ -647,11 +654,8 @@ func (s *Session) OwnCost() float64 {
647654
648655// New creates a new agent session
649656func New (opts ... Opt ) * Session {
650- sessionID := uuid .New ().String ()
651- slog .Debug ("Creating new session" , "session_id" , sessionID )
652-
653657 s := & Session {
654- ID : sessionID ,
658+ ID : uuid . New (). String () ,
655659 CreatedAt : time .Now (),
656660 SendUserMessage : true ,
657661 }
@@ -660,6 +664,7 @@ func New(opts ...Opt) *Session {
660664 opt (s )
661665 }
662666
667+ slog .Debug ("Creating new session" , "session_id" , s .ID )
663668 return s
664669}
665670
You can’t perform that action at this time.
0 commit comments