Building and Deploying an Organization-Wide AI Agent with Production Security Challenges

daily.dev · Tech · 2026 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Organization-wide internal AI agent

daily.dev built Smith, a Slack-based organization-wide agent with access to production systems, then had to harden it against credential leakage, shared-runtime state bleed, memory exhaustion, and unverified autonomous behavior.

Constraints:

Architecture

Smith runs inside daily.dev's Slack workspace as a message-based agent. It uses GCP KMS-backed secrets with ACLs, per-turn credential injection, command sanitization, a Docker execution container with an environment allowlist, progressive tool disclosure, self-authored git-backed skills, scheduled jobs, and an MCP endpoint for delegation from local agents.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  slack-user[Slack User] --> smith-agent[Smith Agent]
  smith-agent --> tool-bundles[Tool Bundles]
  smith-agent --> secret-resolver[Secret Resolver]
  secret-resolver --> smith-exec-container[smith-exec Container]
  smith-agent --> smith-exec-container[smith-exec Container]
  smith-agent --> brain-repository[Brain Repository]
  smith-agent --> scheduler[Scheduler]
  mcp-endpoint[MCP Endpoint] --> smith-agent[Smith Agent]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Slack User daily.dev employee who requests work from Smith. Smith Agent
Smith Agent Organization-wide AI agent running inside Slack. Tool Bundles, Secret Resolver, smith-exec Container, Brain Repository, Scheduler, MCP Endpoint
Tool Bundles Progressively unlocked browser, cron, BigQuery, secrets, and Slack tools. Smith Agent
Secret Resolver ACL/KMS-backed credential resolution and redaction layer. smith-exec Container
smith-exec Container Docker sandbox for bash commands with allowlisted environment variables. Smith Agent
Brain Repository Git-backed docs, skills, and scripts authored by Smith. Smith Agent
Scheduler Cron-style autonomous tasks such as spam sweeps and A/B audits. Smith Agent
MCP Endpoint ask_smith bridge used by local coding agents. Smith Agent

Data flow

A user messages Smith in Slack. Smith unlocks the needed tool bundle, resolves permitted secrets through ACL/KMS, runs commands inside the smith-exec container, redacts secret values from outputs before the LLM sees them, writes learned knowledge to a git-backed brain, and can run scheduled jobs or expose capabilities through MCP.

“You message it, it does things: queries BigQuery, runs SQL against ClickHouse and Postgres, moderates content, generates sales reports, automates browser sessions, manages secrets, runs scheduled jobs.”article, stated
“The decrypted value gets injected as an environment variable, prepended to the bash command, then redacted from all output before the LLM sees the result.”article, stated

Why this architecture

daily.dev chose a message-first Slack agent because the bottleneck was secure access and knowledge, not dashboards. The production architecture then became defense-in-depth: ACL secrets, redaction, containers, tool gating, per-turn credentials, and memory limits, because broad internal access made security the dominant problem.

“Before Smith, getting data at daily.dev meant asking our data analyst. Engineers who needed logs or metrics across multiple databases had to write glue code. Sales couldn't pull campaign numbers without filing a request. The bottleneck was never the data. It was secure access and knowledge.”article, stated
“With Smith, the hard part was security. Not "we added auth middleware" security. More like "the agent keeps finding creative ways to leak credentials and we spent weeks playing whack-a-mole" security.”article, stated

Models used: Codex · Claude Code · LLM agent runtime

Scale

Alternatives considered (roads not taken)

Give Smith blanket GitHub organization access.

Rejected because: daily.dev instead created shared read-only, Smith-memory, and per-user OAuth tiers.

“We didn't want to give Smith blanket access to our GitHub org. Instead, we set up three tiers: a read-only shared token by default, a write token scoped to Smith's own memory repo, and per-user GitHub OAuth so Smith gets your access level when you explicitly link your account.”article, stated

Expose all 60 tools all the time.

Rejected because: Smith now starts with 18 always-on tools and unlocks bundles on demand.

“Now Smith starts each thread with 18 always-on tools and a single meta-tool that unlocks capability bundles on demand. When a task needs browser automation or BigQuery, the agent enables the relevant bundle.”article, stated

Let host environment variables enter the execution container.

Rejected because: Secrets and host configuration are stripped unless explicitly allowed.

“Everything not on the list gets stripped: API keys, database credentials, KMS configuration, anything from the host that the agent shouldn't see.”article, stated

Patterns

tool-use-orchestration (internal agent)

Smith coordinates database, browser, GitHub, Slack, cron, secrets, and internal API tools.

“Browser automation alone is 15. BigQuery is 6. Secrets management is 10.”article, stated

safety-policy-enforcement (security)

Command sanitization, ACL secrets, environment allowlists, and redaction constrain tool execution.

“defense-in-depth: the command sanitizer, the env allowlist, ACL-checked secrets”article, stated

context-compaction (runtime)

The runtime has compaction, but a power user's pattern still bypasses it.

“underlying agent runtime actually has conversation compaction built in”article, stated

agent-memory (skills)

Smith writes reusable skills and documentation to a git-backed brain.

“Smith has a git repository called the brain.”article, stated

Tradeoffs

Interaction model

Chose Slack message interface over Dashboards and forms.

Rationale: The goal was to make secure internal access available through the place people already work.

“No dashboard, no forms, no setup. You say what you want in Slack and you get it.”article, stated

Tool exposure

Chose Progressive tool disclosure over All tools in context at once.

Rationale: A smaller always-on tool set reduces cognitive/tool clutter while preserving capability bundles.

“single meta-tool that unlocks capability bundles on demand”article, stated

Execution isolation

Chose Docker container plus allowlisted environment over Running commands in the host process.

Rationale: The container boundary and env allowlist reduce accidental credential exposure.

“All bash commands run inside a Docker container called smith-exec.”article, stated

Gotchas (what bit them)

Credential leakage is a category, not a single bug.

Root cause: Shared runtimes, CLI state, environment variables, and agent reasoning can all expose secrets differently.

Resolution: Use per-turn credential injection, command sanitizers, ACL secret resolution, and output redaction.

“Not one bug, but a category of problems that kept resurfacing in different forms.”article, stated

Long analytical threads can exhaust the whole VM.

Root cause: Conversation memory and large tool results grew without bounds.

Resolution: Apply systemd cgroup limits and restart cleanly on OOM.

“The agent's memory grew unbounded until the 15GB VM froze entirely.”article, stated

Self-authored agent memory can drift without systematic audit.

Root cause: Smith writes its own skills and docs over time.

Resolution: Keep the brain in git and accept usage-driven correction while acknowledging the assumption.

“Whether every skill is well-structured or even accurate, honestly, we haven't checked carefully.”article, stated

Evaluation

daily.dev evaluates Smith through production incidents, security patches, usage by the whole team, tool-bundle adoption, crash recovery, and manual inspection of emergent skills rather than a formal benchmark.

Metrics: Production incidents · Tool count · Skill count · Crash recovery time · Credential leakage incidents · Scheduled task value

“Running in production, used daily by the whole team”article, stated

Outcomes

The source reports four-day initial build, 29k TypeScript lines, 10k test lines, 118 commits, 60 tools, 25 skills, 170+ message failure case, 25KB SQL statements, 15GB VM freeze, and daily whole-team usage.

“The data access use case worked as planned. But the cronjob system turned Smith from a query tool into an autonomous operator.”article, stated