Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a7ebe6e
Roll the multi-agent chatbot forward to the current Python AI SDK.
sattensil Sep 28, 2026
b87286a
Use current models, the AgentControl name, and OpenAlex for academic …
sattensil Nov 18, 2026
1c34f15
Keep the CI workflow as it is on main.
sattensil Nov 18, 2026
f68d4a5
Remove the unreachable disabled-config branches.
sattensil Nov 18, 2026
e1602dc
Say Python 3.12 in the README and AGENTS.md, matching pyproject.toml.
sattensil Nov 18, 2026
fef4750
Name the current models in the Part 3 bootstrap docstring.
sattensil Nov 18, 2026
c48838b
Remove unused modules
sattensil Nov 18, 2026
112982d
Share one chat-model factory across the agents and trim dead helpers
sattensil Nov 18, 2026
6a9fd70
Simplify the API, config manager, and tool layer
sattensil Nov 18, 2026
0ca9f45
Simplify the UI, bootstrap, and traffic scripts
sattensil Nov 18, 2026
04cdc83
Stop the support agent when it reaches max_tool_calls
sattensil Nov 18, 2026
b6e9d59
Keep PII out of the support agent and the logs, and keep history on t…
sattensil Nov 18, 2026
4dd503c
Refresh OpenAlex tokens on every search and retry MCP servers that fa…
sattensil Nov 18, 2026
5a99c91
Serve local defaults without waiting on every request, and keep conso…
sattensil Nov 18, 2026
1437cb0
Convert Anthropic model names to Bedrock inference profile IDs
sattensil Nov 18, 2026
097fb78
Send max_tool_calls and other custom parameters from the bootstrap sc…
sattensil Nov 18, 2026
8b661a3
Fix feedback in the traffic generators and read the API port in the s…
sattensil Nov 18, 2026
af9d041
Add unit tests for the tool limit, PII boundary, fallback, tracking, …
sattensil Nov 18, 2026
429c570
Match the three tutorials to the code and to real runs
sattensil Nov 18, 2026
f8458a0
Serialize OpenAlex token refresh and withhold input when the security…
sattensil Nov 18, 2026
e8cb7c3
Point README links at main and remove em dashes
sattensil Nov 18, 2026
8d4e67c
Use out-of-the-box AI SDK tool tracking, templates, parameter forward…
sattensil Nov 19, 2026
bf4ac54
Add LaunchDarkly dark theme, proud Albert mascot, and active KB indic…
sattensil Nov 19, 2026
07a30b0
Scale up header logo and Albert, highlight clickable query buttons, a…
sattensil Nov 19, 2026
40b38c8
Enable AI SDK OpenTelemetry traces, replace debug dropdowns with Laun…
sattensil Nov 19, 2026
7bb9500
Add provider and OpenAlex signup steps, Trace Waterfall docs, and ArX…
sattensil Nov 19, 2026
9e0bb9a
Address PR #29 review feedback and update UI stills
sattensil Nov 20, 2026
393f954
fix(review): use public init_client/shutdown in tests and align UI bu…
sattensil Nov 23, 2026
edbc79e
refactor(tracking): use root make_track_data export in ServedConfig
sattensil Nov 23, 2026
01fdf67
Harden dynamic tool schemas, normalize Part 3 Mistral provider keys, …
sattensil Nov 23, 2026
d462765
docs: clean up legacy frontmatter and add GitHub referral UTMs to Doc…
sattensil Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ai_config_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"security-agent": {
"enabled": true,
"model": {
"name": "claude-haiku-4-5-20251001",
"name": "claude-haiku-5-5",
"parameters": {}
},
"provider": {
Expand All @@ -20,7 +20,7 @@
"supervisor-agent": {
"enabled": true,
"model": {
"name": "claude-sonnet-4-6",
"name": "claude-haiku-5-5",
"parameters": {}
},
"provider": {
Expand All @@ -31,7 +31,7 @@
"support-agent": {
"enabled": true,
"model": {
"name": "claude-haiku-4-5-20251001",
"name": "claude-haiku-5-5",
"parameters": {
"tools": [
{
Expand Down
34 changes: 4 additions & 30 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,14 @@ BEDROCK_EMBEDDING_DIMENSIONS=1024 # Options: 256, 512, 1024
BEDROCK_EMBEDDING_MODEL=amazon.titan-embed-text-v2:0

# Optional: MCP Tool Configuration
# These are used for advanced research capabilities (leave blank if not using MCP tools)
# Used for research capabilities in Part 2 (leave blank if not using MCP tools)
# OpenAlex needs no setting here: sign in once with `uv run python tools_impl/openalex_auth.py`
ARXIV_MCP_SERVER_PATH=/Users/your_username/.local/bin/arxiv-mcp-server
SEMANTIC_SCHOLAR_SERVER_PATH=/tmp/semantic_scholar_server.py

# Optional: Database Configuration (if using database MCP tools)
# DATABASE_URL=postgresql://user:password@localhost:5432/your_database

# Optional: GitHub Integration (if using GitHub MCP server)
# GITHUB_TOKEN=your_github_personal_access_token

# Optional: Slack Integration (if using Slack MCP server)
# SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
# SLACK_SIGNING_SECRET=your_slack_signing_secret

# Application Configuration
# API Server Configuration
# API server the UI and traffic generators call
API_HOST=localhost
API_PORT=8000

# Streamlit UI Configuration
UI_HOST=localhost
UI_PORT=8501

# Vector Store Configuration
VECTOR_STORE_PATH=data/vector_store/
EMBEDDING_MODEL=amazon.titan-embed-text-v2:0 # Bedrock Titan V2
# EMBEDDING_MODEL=text-embedding-3-small # Default: OpenAI (backward compatible)
CHUNK_SIZE=1000
CHUNK_OVERLAP=200

# Optional: Override embedding provider auto-detection
# EMBEDDING_PROVIDER=bedrock # Force Bedrock embeddings
# EMBEDDING_PROVIDER=openai # Force OpenAI embeddings (requires OPENAI_API_KEY)

# Development Mode
DEBUG=true
LOG_LEVEL=INFO
# EMBEDDING_PROVIDER=openai # Force OpenAI embeddings (requires OPENAI_API_KEY)
45 changes: 15 additions & 30 deletions .github/workflows/ai-config-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ jobs:

- name: Install dependencies
run: |
uv venv
# Install dependencies without installing the package itself (to avoid dev dependency issues)
uv pip install langchain langgraph langchain-anthropic fastapi "uvicorn[standard]" pydantic launchdarkly-server-sdk launchdarkly-server-sdk-ai numpy openai faiss-cpu PyMuPDF tiktoken streamlit requests python-dotenv PyYAML langchain-openai langchain-mcp-adapters beautifulsoup4 mcp semanticscholar rank-bm25 langchain-mistralai httpx boto3 langchain-aws
# Force fresh clone by clearing all caches
rm -rf ~/.cache/uv ~/.cache/pip /tmp/pip-* || true
uv pip install --no-cache --force-reinstall git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1
uv sync --frozen || uv sync
uv tool install --no-cache --with "launchdarkly-server-sdk-ai<0.11" git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1

- name: Run unit tests
run: uv run pytest

- name: Validate required secrets
run: |
Expand All @@ -80,7 +79,7 @@ jobs:
LD_PROJECT_KEY: ${{ secrets.LD_PROJECT_KEY }}
run: |
# Use ld-aic-cicd framework to validate our AI configs
.venv/bin/ld-aic validate \
ld-aic validate \
--environment ${{ github.event.inputs.environment || 'production' }} \
--config-keys "supervisor-agent,support-agent,security-agent" \
--report validation-report.json \
Expand Down Expand Up @@ -161,12 +160,8 @@ jobs:

- name: Install dependencies
run: |
uv venv
# Install dependencies without installing the package itself (to avoid dev dependency issues)
uv pip install langchain langgraph langchain-anthropic fastapi "uvicorn[standard]" pydantic launchdarkly-server-sdk launchdarkly-server-sdk-ai numpy openai faiss-cpu PyMuPDF tiktoken streamlit requests python-dotenv PyYAML langchain-openai langchain-mcp-adapters beautifulsoup4 mcp semanticscholar rank-bm25 langchain-mistralai httpx boto3 langchain-aws
# Force fresh clone by clearing all caches
rm -rf ~/.cache/uv ~/.cache/pip /tmp/pip-* || true
uv pip install --no-cache --force-reinstall git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1
uv sync --frozen || uv sync
uv tool install --no-cache --with "launchdarkly-server-sdk-ai<0.11" git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1

- name: Validate required secrets
run: |
Expand All @@ -191,17 +186,11 @@ jobs:
echo "📚 Initializing vector embeddings for search tools..."
.venv/bin/python initialize_embeddings.py

- name: Install MCP servers for research-enhanced variation
- name: Install MCP server for research-enhanced variation
run: |
echo "📦 Installing MCP servers (ArXiv and Semantic Scholar)..."

# Install ArXiv MCP server
echo "📦 Installing ArXiv MCP server..."
uv tool install arxiv-mcp-server

# Clone and set up Semantic Scholar MCP server
git clone https://github.com/JackKuo666/semanticscholar-MCP-Server.git

echo "✅ MCP servers installed (available for research-enhanced variation)"
echo "✅ MCP server installed (available for research-enhanced variation)"

- name: Start API server
env:
Expand Down Expand Up @@ -299,7 +288,7 @@ jobs:
echo "🧹 Cleared old test artifacts to ensure fresh run"

# Run tests with HTTP evaluator (calls API endpoint to test full system)
.venv/bin/ld-aic test \
ld-aic test \
--config-keys "supervisor-agent,support-agent,security-agent" \
--environment production \
--evaluation-dataset test_data/ai_config_evaluation.yaml \
Expand Down Expand Up @@ -398,12 +387,8 @@ jobs:

- name: Install dependencies
run: |
uv venv
# Install dependencies without installing the package itself (to avoid dev dependency issues)
uv pip install langchain langgraph langchain-anthropic fastapi "uvicorn[standard]" pydantic launchdarkly-server-sdk launchdarkly-server-sdk-ai numpy openai faiss-cpu PyMuPDF tiktoken streamlit requests python-dotenv PyYAML langchain-openai langchain-mcp-adapters beautifulsoup4 mcp semanticscholar rank-bm25 langchain-mistralai httpx boto3 langchain-aws
# Force fresh clone by clearing all caches
rm -rf ~/.cache/uv ~/.cache/pip /tmp/pip-* || true
uv pip install --no-cache --force-reinstall git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1
uv sync --frozen || uv sync
uv tool install --no-cache --with "launchdarkly-server-sdk-ai<0.11" git+https://x-access-token:${{ secrets.GH_PAT }}@github.com/launchdarkly-labs/scarlett_ai_configs_ci_cd-.git@02cb9b1

- name: Validate required secrets
run: |
Expand All @@ -425,7 +410,7 @@ jobs:
run: |
echo "🔄 Syncing AI configs from LaunchDarkly production..."
mkdir -p configs
.venv/bin/ld-aic sync \
ld-aic sync \
--environment production \
--output-dir configs \
--format json \
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ env/
ehthumbs.db
Thumbs.db

# Tests
tests/

# Documentation
docs/

# Environment files
.env
.openalex_tokens.json

# Logs
logs/
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.12
7 changes: 7 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[theme]
base = "dark"
primaryColor = "#405BFF"
backgroundColor = "#191919"
secondaryBackgroundColor = "#232326"
textColor = "#F4F5F7"
font = "sans serif"
19 changes: 12 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# AGENTS.md

Companion code for the LaunchDarkly tutorial series *Chaos to Clarity: Defensible AI Systems*. A FastAPI service runs a LangGraph supervisor that routes to a security agent (PII detection) and a support agent (RAG over `kb/`), with every model, prompt, and tool selection delivered by LaunchDarkly AI Configs (AgentControl). The tutorials are the product; the code exists so a reader can follow them.
Companion code for the LaunchDarkly tutorial series *Chaos to Clarity: Defensible AI Systems*. A FastAPI service runs a LangGraph supervisor that routes to a security agent (PII detection) and a support agent (RAG over `kb/`), with every model, prompt, and tool selection delivered by LaunchDarkly AI configs. The tutorials are the product; the code exists so a reader can follow them.

## Setup and commands

- Python 3.11 via `uv`. `uv sync` installs runtime deps; `uv sync --group dev` adds pytest and ruff.
- Python 3.12 via `uv`. `uv sync` installs runtime deps; `uv sync --group dev` adds pytest and ruff.
- `cp .env.example .env`. `LD_SDK_KEY` is always required. Choose one model auth path: `AUTH_METHOD=sso` (AWS Bedrock, needs `AWS_PROFILE` + `AWS_REGION`) or `AUTH_METHOD=api-key` (`ANTHROPIC_API_KEY`/`OPENAI_API_KEY`). `OPENAI_API_KEY` is also needed to rebuild embeddings.
- API: `uv run uvicorn api.main:app --reload --port 8000`. Smoke check: `curl localhost:8000/health`, then POST `/chat`.
- UI: `uv run streamlit run ui/chat_interface.py --server.port 8501`.
Expand All @@ -14,13 +14,18 @@ Companion code for the LaunchDarkly tutorial series *Chaos to Clarity: Defensibl

## Verification

There is no unit-test suite in the repo (`tests/` is gitignored). Correctness is verified end to end:
Unit tests live in `tests/` and run offline without LaunchDarkly or LLM credentials:

1. API starts clean with your `.env` and `/health` returns 200.
2. A `/chat` request routes through supervisor → security/support and the response names the served config variation.
3. CI (`.github/workflows/ai-config-validation.yml`) runs the `ld-aic-cicd` validator and LLM judge against the live LaunchDarkly project on every PR. It needs org secrets, so expect it to run on the PR, not locally.
- Unit tests: `uv run pytest` (covers fallback config loading, tracking attribution, Bedrock inference-profile resolution, security boundary isolation, tool-call caps, and bootstrap payloads).

Done means steps 1 and 2 pass locally for the tutorial part you changed.
End-to-end verification:

1. `uv run pytest` passes.
2. API starts clean with your `.env` and `/health` returns 200.
3. A `/chat` request routes through supervisor → security/support and the response names the served config variation.
4. CI (`.github/workflows/ai-config-validation.yml`) runs `uv run pytest` plus the `ld-aic-cicd` validator and LLM judge against the live LaunchDarkly project on every PR. The live judge steps need org secrets, so expect those to run on the PR rather than locally.

Done means steps 1–3 pass locally for the tutorial part you changed.

## Names are contracts

Expand Down
Loading