KB-646D
new integration
4 min read Revision 1
Playbook: New Integration
Use this playbook when connecting a new external service or API.
Before Starting
Load Context Packs
-
governance— No-code-new and SA rules -
infrastructure— Existing services inventory -
directus— Check if Directus handles this already
Pre-flight Questions
- Does Directus already provide this capability? (Check Flows, Extensions)
- Does Agent Data already expose this data? (Check MCP tools)
- Is there an Agency OS component for this?
- Do we ACTUALLY need a new integration, or can existing services handle it?
If the answer to any above is YES → use existing, don't integrate new.
Integration Assessment
Step 1: Evaluate Necessity
| Question | Answer |
|---|---|
| What does this integration provide? | |
| Can Directus Flows handle it? | YES/NO |
| Can Agent Data API handle it? | YES/NO |
| Is new code required? | YES/NO (should be NO) |
| What's the maintenance cost? |
Step 2: Choose Pattern
Priority order:
- Directus Flow — Webhook/schedule triggers, API calls, no code
- Agent Data endpoint — If it's a knowledge/document operation
- Cloud Function — Only if async processing is required
- Custom code — LAST RESORT, requires explicit approval
Step 3: Authentication
- Can we use existing SA? (
chatgpt-deployer@...) - Store credentials in Secret Manager (NEVER in code/env files)
- Test auth locally before deploying
Implementation
For Directus Flow Integration
- Open Directus Admin → Settings → Flows
- Create trigger (webhook, schedule, or event)
- Add operations (HTTP request, transform, condition)
- Test flow execution
- Document in
docs/status/connection-matrix.md
For Agent Data Integration
- Check if existing MCP tool handles the use case
- If not, add endpoint to
agent_data/server.py - Add corresponding MCP tool to
mcp_server/stdio_server.py - Deploy both local and cloud (hybrid!)
- Test via both endpoints
For Cloud Function (Rare)
- Check if Cloud Scheduler + existing endpoint works instead
- Write minimal function code
- Deploy with existing SA
- Add to system inventory
Testing Checklist
- Works locally (http://localhost:...)
- Works on cloud (https://...a.run.app)
- Error handling for service downtime
- Hybrid fallback if applicable
- No secrets exposed in logs or responses
After Integration
Documentation Required
- Update
docs/status/system-inventory.md - Update
docs/status/connection-matrix.md - Update relevant context pack
- Write session report
Monitoring
- Health check endpoint exists for the integration
- Error logging is in place
- Metrics/Prometheus counters if applicable
Red Flags
- "I need to create a new Service Account" → STOP (GC-LAW 1.3)
- "I need to install a new framework" → Almost certainly wrong
- "I need to write a custom OAuth flow" → Use Directus auth
- "This needs a new database" → Use Firestore/Directus collections
- "I need to set up a new Docker container" → Check existing services