MCPcopy Index your code
hub / github.com/docker/docker-agent / Agent

Struct Agent

pkg/agent/agent.go:22–66  ·  view source on GitHub ↗

Agent represents an AI agent

Source from the content-addressed store, hash-verified

20
21// Agent represents an AI agent
22type Agent struct {
23 name string
24 description string
25 welcomeMessage string
26 instruction string
27 toolsets []*tools.StartableToolSet
28 models []provider.Provider
29 fallbackModels []provider.Provider // Fallback models to try if primary fails
30 fallbackRetries int // Number of retries per fallback model with exponential backoff
31 fallbackCooldown time.Duration // Duration to stick with fallback after non-retryable error
32 titleModel provider.Provider // Optional dedicated model for session-title generation
33 compactionModel provider.Provider // Optional dedicated model for session compaction (summary generation)
34 modelOverrides atomic.Pointer[[]provider.Provider] // Optional model override(s) set at runtime (supports alloy)
35 subAgents []*Agent
36 handoffs []*Agent
37 forceHandoff *Agent
38 parents []*Agent
39 addDate bool
40 addEnvironmentInfo bool
41 addDescriptionParameter bool
42 redactSecrets bool
43 saferShell bool
44 maxIterations int
45 maxConsecutiveToolCalls int
46 maxOldToolCallTokens int
47 numHistoryItems int
48 addPromptFiles []string
49 tools []tools.Tool
50 commands types.Commands
51 harness *latest.HarnessConfig
52 hooks *latest.HooksConfig
53 cache *cache.Cache
54
55 // warningsMu guards pendingWarnings. AddToolWarning and DrainWarnings
56 // may be called concurrently from the runtime loop, the MCP server,
57 // the TUI and session manager.
58 warningsMu sync.Mutex
59 pendingWarnings []string
60
61 // collisionsMu guards reportedCollisions, the once-per-streak guard for
62 // duplicate-tool-name warnings. collectTools may run concurrently from
63 // the runtime loop and MCP notification handlers.
64 collisionsMu sync.Mutex
65 reportedCollisions map[string]bool
66}
67
68// New creates a new agent
69func New(name, prompt string, opts ...Opt) *Agent {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected