SAA is a Python CLI project exploring a simple idea: an agent should manage its own context.
Instead of blindly injecting all chat history, tool schemas, and skill docs into every model call, SAA treats context as an inventory:
- everything has provenance (where it came from)
- everything has a cost (token budget)
- inclusion is intentional (policy + justification)
Start here:
docs/SPIRIT.md— the “why” and design principlesdocs/IMPLEMENTATION_PLAN.md— concrete milestones + CLI surfacedocs/FRAMEWORK_EVALUATION.md— framework tradeoffs for this goaldocs/RELATED_WORK.md— similar work and references
This repo uses a local conda environment at ./env (do not commit it).
conda activate ./env
python -m pip install -e ".[openai]"
saa init
saa doctorIf you just want to smoke-test the scaffold without installing:
PYTHONPATH=src python3 -m saa doctorSet your API key and run a task:
cp .env.example .env
# edit .env, then:
saa run "Summarize docs/SPIRIT.md in 5 bullets"Environment variables (loaded automatically from ./.env if present):
SAA_API_KEY(recommended) orOPENAI_API_KEYSAA_ENDPOINT/SAA_BASE_URL(for OpenAI-compatible providers) orOPENAI_BASE_URLSAA_MODELorOPENAI_MODELSAA_DEBUG(set1/true/on) to print tool calls and context-pool snapshots to stderrSAA_TIMEOUT_S(default: 30) andSAA_MAX_RETRIES(default: 0) to fail fast on bad endpoints
Note: SAA uses the Responses API tool loop by default, and automatically falls back to Chat Completions tool-calling on providers that 404 on /responses.
Use --dry-run to inspect the exact prompt payload (including selected context ids) without making a network call.
The current code is a scaffold: it implements a minimal “context registry” and a deterministic selection report so the design can be exercised end-to-end before adding an LLM backend.