How stakpak/agent works
Stakpak is a DevOps agent that runs locally, interactively or as an always-on autopilot, to investigate infrastructure and perform operational work under configurable guardrails. The main workflow is: a user starts a CLI or TUI session; the agent builds context, consults an AI provider, and uses tools to inspect or change the environment; session state and results are retained or delivered through configured channels. The graph also captures documented search, indexing, knowledge, and task-management capabilities. README claims guide unsampled feature branches; edges are limited to documented relationships and workspace structure.
Main entry points: tools.rs Agent tools · run/mod.rs Agent run · agent.rs Agent engine · autopilot/mod.rs Autopilot scheduler
Components 22
User interaction
- CLI commands
cli/src/main.rs - Terminal UI
tui/src/app.rs
Agent runtime
- Agent run
cli/src/commands/agent/run/mod.rs - Agent engine
libs/agent-core/src/agent.rs - Model dispatch
libs/ai/src/provider/dispatcher.rs - AI providers
libs/ai/src/providers/mod.rs - Session storage
libs/api/src/storage.rs - Session API
libs/server/src/routes.rs
Context and knowledge
- Local context
libs/server/src/context/builder.rs - Web research
libs/shared/src/models/integrations/search_service.rs - Code indexing
cli/src/code_index.rs - Knowledge store
libs/api/src/stakpak/knowledge/mod.rs
Operations and safety
- Agent tools
libs/agent-core/src/tools.rs - MCP tools
libs/mcp/server/src/tool_container.rs - Shell approvals
libs/shell-tool-approvals/src/lib.rs - Background tasks
libs/shared/src/task_manager.rs
Autopilot and delivery
- Autopilot scheduler
cli/src/commands/autopilot/mod.rs - Message routing
libs/gateway/src/dispatcher.rs - Chat channels
libs/gateway/src/channels/mod.rs
Other components
- Operator
- Model services
- Machine and cloud
Connections 22
- Operator → CLI commands: starts
- Operator → Terminal UI: interacts
- CLI commands → Agent run: dispatches
- Agent run → Agent engine: runs
- Agent engine → Model dispatch: requests completion
- Model dispatch → AI providers: dispatches
- AI providers → Model services: sends requests
- Agent engine → Agent tools: invokes tools
- Agent tools → MCP tools: uses MCP tools
- Agent tools → Shell approvals: checks policy
- Agent tools → Background tasks: manages tasks
- Agent run → Local context: builds context
- Agent tools → Web research: researches web
- Agent run → Code indexing: indexes projects
- Agent engine → Session storage: stores session state
- Session API → Session storage: reads and writes
- Autopilot scheduler → Agent run: starts agent runs
- Autopilot scheduler → Message routing: routes notifications
- Message routing → Chat channels: dispatches messages
- Chat channels → Operator: delivers updates
- Agent tools → Machine and cloud: operates on
- Agent run → Knowledge store: uses persistent knowledge