agentleFS
agno-agiagno-agi/scout/AGENTS.md

scout

AGENTS.md738 starsChanged 8 months agoApache-2.0View on GitHub

Scout is an enterprise context agent — a single agno.Agent with N ContextProviders. Ships with WebContextProvider, WorkspaceContextProvider (local files via agno.tools.Workspace), DatabaseContextProvider (the CRM — user's contacts/projects/notes/follow-ups), two WikiContextProviders (a writable knowledge wiki and a read-only voice wiki), SlackContextProvider, GDriveContextProvider, and MCPContextProvider (any MCP server → one query_mcp_<slug> tool on Scout). GitHub, Gmail, and Calendar land in the next release (were built and verified on the feat/slack-interface branch; dropped from the ship slice until we can test end-to-end with real…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every source is a ContextProvider.

    line 14
  2. Very specific:

    Use get_postgres_db() from the db module for agent session storage.

    line 226
  3. Very specific:

    Use get_sql_engine() for tools that need to write to the scout schema (CRM write sub-agent, migrations).

    line 227
  4. Very specific:

    Use get_readonly_engine() for tools that should never write (CRM read sub-agent).

    line 228

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Project Overview

Scout is an enterprise context agent — a single agno.Agent with N ContextProviders. Ships with WebContextProvider, WorkspaceContextProvider (local files via agno.tools.Workspace), DatabaseContextProvider (the CRM — user's contacts/projects/notes/follow-ups), two WikiContextProviders (a writable knowledge wiki and a read-only voice wiki), SlackContextProvider, GDriveContextProvider, and MCPContextProvider (any MCP server → one query_mcp_<slug> tool on Scout). GitHub, Gmail, and Calendar land in the next release (were built and verified on the feat/slack-interface branch; dropped from the ship slice until we can test end-to-end with real tokens).

Architecture

Scout (single Agent — one LLM hop per turn)
  tools = <query_|update_ tools from every registered ContextProvider> + list_contexts

Every source is a ContextProvider. The database is a provider too: DatabaseContextProvider exposes query_crm (reads) + update_crm (writes), each backed by a dedicated sub-agent so the read path never sees the write engine.

ContextProvider

agno.context.provider defines the base. Every external source subclasses ContextProvider and implements:

  • query(question) -> Answer / aquery(question) -> Answer — natural-language read
  • status() -> Status / astatus() -> Status — is the source reachable?

Providers that support writes override aupdate(instruction) -> Answer (and optionally update). The base raises NotImplementedError; _update_tool() translates that into a readable "<name> is read-only" error so calling agents see a clean failure. Today only DatabaseContextProvider overrides it.

mode controls how the provider surfaces itself to the calling agent:

ModeExposure
defaultThe provider's recommended exposure. Each subclass decides.
agentOne query_<id> tool wrapping a sub-agent.
toolsThe underlying tools directly.

model swaps the model used by the internal sub-agent (when one is built). instructions() returns mode-aware usage guidance for the calling agent.

The full type set:

  • Status(ok: bool, detail: str = "")
  • Document(id, name, uri=None, source=None, snippet=None) — a piece of content
  • Answer(results: list[Document] = [], text: str | None = None) — what query() returns

One write surface

Write surfaceOwnerCall
scout_* user-data tablesDatabaseContextProvider write sub-agentupdate_crm(instruction) — SQL DDL + DML, scoped to the scout schema (get_sql_engine())

Everything else reads. The CRM read sub-agent uses get_readonly_engine() (PostgreSQL's default_transaction_read_only). The scout engine has a before_cursor_execute hook that rejects any DDL/DML targeting public or ai — so even if Scout is tricked into calling update_crm with an out-of-schema statement, the engine rejects it.

Interfaces

Chat surfaces beyond AgentOS's built-in UI. Wired in app/main.py and passed to AgentOS(interfaces=...).

InterfaceTriggerNotes
SlackSLACK_BOT_TOKEN and SLACK_SIGNING_SECRET setWebhook at /slack/events; each Slack thread → a persistent session. resolve_user_identity=True maps Slack user IDs to names. Setup: docs/SLACK_CONNECT.md.

Both Slack env vars must be set for the interface to light up; otherwise interfaces=[] and Scout runs headless + on AgentOS. We explicitly pass token=SLACK_BOT_TOKEN because agno's default env-var read is SLACK_TOKEN — keeping the _BOT_ name is intentional.

Structure

scout/
├── __init__.py
├── __main__.py                     # CLI: chat | contexts
├── agent.py                        # The single `scout` Agent
├── instructions.py                 # Scout-tuned prompts: SCOUT_INSTRUCTIONS + CRM read/write
├── settings.py                     # Runtime objects: agent_db + default_model() factory
└── contexts.py                     # create/get/update/close_context_providers + list_contexts tool + status row helpers

# The ContextProvider library (base ABC + shipped providers) lives in `agno.context`
# as of agno 2.6 — see `agno.context.{database,gdrive,mcp,slack,web,wiki,workspace}`.

app/
├── main.py                         # AgentOS entry (lifespan wires contexts; Slack interface if env set)
├── router.py                       # /contexts/* endpoints
└── config.yaml

db/
├── session.py                      # get_sql_engine (guarded) / get_readonly_engine / get_postgres_db / create_knowledge
├── url.py                          # DB URL builder
└── tables.py                       # Canonical DDL: scout_contacts / projects / notes / followups

wiki/
├── knowledge/                      # Prose memory Scout files into (gitignored except README)
└── voice/                          # Code-managed style guide (committed, read-only to Scout)

evals/
├── cases.py                        # Behavioral Case dataclass + CASES tuple
├── runner.py                       # In-process transport + fixtures
├── wiring.py                       # Code-level invariants, no LLM (W1-W6)
├── judges.py                       # LLM-scored quality tier
└── __main__.py                     # CLI dispatch

Commands

./scripts/venv_setup.sh && source .venv/bin/activate
./scripts/format.sh                   # Format code
./scripts/validate.sh                 # ruff + mypy

# CLI
python -m scout                       # Chat
python -m scout contexts              # List contexts + status

# Tables (also run automatically on app startup)
python -m db.tables

# Evals
python -m evals wiring                # Code-level invariants (no LLM)
python -m evals                       # Behavioral cases, in-process
python -m evals --case <id>           # Single case
python -m evals --verbose             # Response + tool previews
python -m evals judges                # LLM-scored quality tier

Environment loading for CLI work

Secrets live in .env. Anything that hits OpenAI / Parallel from the host (python -m evals, etc.) needs .env loaded:

  1. Prefer direnv: direnv allow . once per repo.
  2. Fallback: set -a; source .env; set +a; python -m evals
  3. Per-invocation (Bash tool): set -a && source .env && set +a && ...

Docker picks up .env automatically via docker compose, so code inside scout-api has everything. Only direct host-shell invocations need the explicit source.

Testing & Evals

Static checks — ./scripts/validate.sh runs ruff + mypy. Both run even if one fails; the script exits non-zero if either reports problems, warns if no virtualenv is active.

Three eval tiers under python -m evals:

TierCommandSpeedLLM?What it catches
Wiringpython -m evals wiring<1sNoScout's tool shape drifts (bare SQL on Scout, CRM provider loses update_crm, schema guard removed, default user_id sentinel regresses, GDrive backend drops shared-drive coverage, MCP lifecycle breaks, voice gains a write tool, scout_followups falls out of canonical DDL)
Behavioralpython -m evals~3minYes (gpt-5.6-sol)Scout picks the wrong tool, over-tools, responses miss expected substrings
Judgespython -m evals judges~1min/caseYesAnswer quality a regex can't express

Flags: --case <id> narrows to one case; --verbose prints response + tool previews. Details: docs/EVALS.md.

Fixing a failing case — paste docs/EVAL_AND_IMPROVE.md into a fresh agent session. It runs the suite, diagnoses each failure (agent bug vs. stale assertion vs. runner bug), fixes what's in scope, and flags what isn't.

Contexts

scout/contexts.py::create_context_providers() is the env-driven factory. The app lifespan calls it at startup to warm a module-level cache; get_context_providers() lazy-builds on first access. update_context_providers() swaps the cached list in place (used by eval fixtures). The web provider is always on; others opt-in via env.

Registered provider set (in order):

ProviderTriggerNotes
WebContextProvideralwaysBackend picked below
WorkspaceContextProvideralwaysRead-only; Workspace scoped to SCOUT_FS_ROOT in scout/contexts.py (the scout repo — Scout answers questions about itself). One query_workspace tool that routes through a tuned sub-agent.
DatabaseContextProvideralwaysCRM — the user's contacts/projects/notes/follow-ups. Exposes query_crm + update_crm; read path uses get_readonly_engine(), write path uses get_sql_engine() (scout-schema-guarded).
WikiContextProvider (knowledge)alwaysProse memory — runbooks, design notes, learnings. FileSystemBackend on wiki/knowledge/ by default; swap to GitBackend for durability + audit trail (see docs/WIKI_GIT.md). Tools: query_knowledge + update_knowledge.
WikiContextProvider (voice)alwaysRead-only (write=False) style guide for external content. Filesystem-backed on wiki/voice/; rules are code-managed (PR, not agent edits). Tool: query_voice only — no update_voice.
SlackContextProviderSLACK_BOT_TOKENRead-only; search + channel history + threads. Sending is disabled (Slack interface handles posting). Setup: docs/SLACK_CONNECT.md
GDriveContextProviderGOOGLE_SERVICE_ACCOUNT_FILERead-only; Scout authenticates as its own service account (no user impersonation). Setup: docs/GDRIVE_CONNECT.md or ./scripts/google_setup.sh
MCPContextProviderwired in scout/contexts.pyOne per server; transports stdio/sse/streamable-http. Sub-agent instructions rebuilt from list_tools() at connect. aclose() closes the session on shutdown. Setup: docs/MCP_CONNECT.md

create_context_providers() dedupes by id globally (first wins, warns on collision) so Scout never ends up with two query_<id> tools sharing a name.

Web backend selection:

TriggerBackend
PARALLEL_API_KEY setParallelBackend (Parallel SDK — web_search + web_extract)
unsetParallelMCPBackend (keyless, via Parallel's public MCP — web_search + web_fetch)

User Data Tables

Shipped tables under the scout schema (created on first startup via db/tables.py). All carry id SERIAL PK, user_id TEXT NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW().

TablePurposeDomain columns
scout_contactsPeoplename, emails TEXT[], phone, tags TEXT[], notes
scout_projectsThings in motionname, status, tags TEXT[]
scout_notesFree-form notestitle, body, tags TEXT[], source_url
scout_followupsThings to come back totitle, notes, due_at TIMESTAMPTZ, status (pending / done / dropped), tags TEXT[]

Beyond these four, the CRM provider's write sub-agent creates new scout_* tables on demand — always in the scout schema, always with the standard columns. scout_followups is the closed-loop primitive: a future scheduled cron reads due_at <= NOW() AND status = 'pending' to surface what needs attention each morning.

Tools on Scout

SurfaceTools
Scout (single Agent)query_<id> + update_<id> for each registered provider (provider.get_tools()), list_contexts
CRM read sub-agentSQLTools (read-only engine, scout schema)
CRM write sub-agentSQLTools (scout engine, schema-guarded to scout)

Per-provider tools are built by the registry. scout.contexts.create_context_providers() builds the provider list and caches it on the module; get_context_providers() reads it (lazy-builds on first access). Scout's tools=scout_tools is a callable (cache_callables=False), so agno resolves the tool list from the current registry on every run. The app lifespan calls create_context_providers() once at startup to warm the cache and log which backend was selected; eval fixtures swap providers via update_context_providers.

API Endpoints

On top of AgentOS's defaults (/agents/scout/runs, /health, …):

EndpointMethodPurpose
/contextsGETList every registered context + status
/contexts/{id}/statusGETOne context's status
/contexts/{id}/queryPOSTDebug: ask one context directly

Model

Scout and every provider sub-agent run on OpenAIResponses(id="gpt-5.6-sol") via agno.models.openai, built through the default_model() factory in scout/settings.py (fresh instance per agent — avoids shared-state footguns). Each provider takes a model= kwarg so agno.context stays portable — no hard OpenAI dep inside the library.

Environment Variables

VariableRequiredDescription
OPENAI_API_KEYYesGPT-5.6-sol for every agent
PARALLEL_API_KEYNoSelects ParallelBackend (Parallel SDK). Without it, web falls back to ParallelMCPBackend (keyless).
SLACK_BOT_TOKENNoBot User OAuth Token. Pair with SLACK_SIGNING_SECRET to enable Slack interface.
SLACK_SIGNING_SECRETNoSlack request signing secret. Pair with SLACK_BOT_TOKEN.
GOOGLE_SERVICE_ACCOUNT_FILENoPath to Scout's Google service-account JSON key. Activates the Drive context provider.
DB_HOST / PORT / USER / PASS / DATABASENoPostgreSQL config. Compose defaults work locally.
RUNTIME_ENVNodev for hot reload (compose sets this); prd enables JWT-gated endpoints.
AGENTOS_URLNoScheduler base URL; defaults to http://127.0.0.1:8000.

Conventions

ContextProvider

Every external source subclasses ContextProvider (in agno.context.provider). Each provider lives in its own module under agno.context.<kind> — the class is in provider.py, pluggable backends are flat modules in the same folder (e.g. agno.context.web.parallel). Implementation is agentic by default — _build_agent() wraps a sub-agent with backend tools when needed (lazy). Each provider exposes its tools via .get_tools(); Scout wires them directly via the scout_tools() callable factory.

Database

  • Use get_postgres_db() from the db module for agent session storage.
  • Use get_sql_engine() for tools that need to write to the scout schema (CRM write sub-agent, migrations). This engine has a guard that rejects writes to public / ai.
  • Use get_readonly_engine() for tools that should never write (CRM read sub-agent). PostgreSQL's default_transaction_read_only enforces this at the DB level.
  • db/tables.py runs at startup; safe to rerun.

Imports

from db import db_url, get_postgres_db, get_sql_engine, get_readonly_engine, SCOUT_SCHEMA
from scout.agent import scout
from scout.settings import agent_db
from scout.contexts import create_context_providers, get_context_providers, update_context_providers, list_contexts, status_row, astatus_row
from agno.context import ContextBackend, ContextProvider, ContextMode, Answer, Document, Status
from agno.context.database import DatabaseContextProvider
from agno.context.workspace import WorkspaceContextProvider
from agno.context.wiki import FileSystemBackend, GitBackend, WikiContextProvider
from agno.context.gdrive import GDriveContextProvider
from agno.context.mcp import MCPContextProvider
from agno.context.slack import SlackContextProvider
from agno.context.web import WebContextProvider
from agno.context.web.parallel import ParallelBackend
from agno.context.web.parallel_mcp import ParallelMCPBackend

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.