Customer context is knowledge stored at the CUSTOMER scope — shared across all users within a specific customer organization but invisible to users in other organizations. It represents the collective knowledge about a particular tenant: their policies, structure, preferences, projects, and domain-specific information. Customer context sits between organizational context (visible to everyone) and user-scoped memories (visible only to one person).
If organizational context is your product’s knowledge base, customer context is each customer’s internal wiki. Every user in the organization can access it, but outsiders cannot.
Customer context is created by ingesting documents with a customer_id but without a user_id. This causes Synap to store the resulting memories at the Customer scope, making them visible to all users within that customer organization.
SDK
API
from synap import Synapsdk = Synap(api_key="your_api_key")# Ingest company documentation for Acme Corpawait sdk.memories.create( document=""" Acme Corp Engineering Handbook ## Development Standards - All services must use Python 3.11 or later - PostgreSQL is the primary database for all services - Every PR requires two code review approvals - CI must pass before merge (linting, tests, type checking) ## Deployment Process - Deployments to staging: any time - Deployments to production: Tuesdays and Thursdays, 10am-2pm PT - Hotfix deployments: requires VP Engineering approval - Rollback policy: automatic rollback if error rate exceeds 1% ## Team Structure - Platform Team (8 engineers): infrastructure, CI/CD, observability - Product Team (12 engineers): core product features, API - Data Team (5 engineers): analytics, ML pipelines, data warehouse """, document_type="document", customer_id="acme_corp" # No user_id -- shared across all users at Acme Corp)
Be careful not to accidentally include a user_id when ingesting customer-wide documents. If you include a user_id, the memories will be stored at the User scope and will only be visible to that one user, defeating the purpose of shared organizational knowledge.
When retrieving context for a specific user, customer context is automatically included in the scope chain:
# Alice asks about deployment rulescontext = await sdk.user.context.fetch( user_id="user_alice", customer_id="acme_corp", search_query=["when can I deploy to production"])# Scope chain results:# USER: "Alice deployed the billing service last Tuesday" (highest priority)# CUSTOMER: "Production deployments: Tues/Thurs 10am-2pm PT" (high priority)# CLIENT: "Blue-green deployment support available" (medium priority)
The power of customer context is that it provides shared knowledge to every user in the organization. Consider a scenario with three users at Acme Corp:
# Alice (engineering lead) ingests team planning notesawait sdk.memories.create( document="Sprint planning: migrating auth service to OAuth 2.1 by end of Q2.", document_type="document", customer_id="acme_corp" # Shared with all Acme users)# Bob queries about current projectscontext = await sdk.user.context.fetch( user_id="user_bob", customer_id="acme_corp", search_query=["current engineering projects"])# Bob sees: "Migrating auth service to OAuth 2.1 by end of Q2"# Carol queries about team prioritiescontext = await sdk.user.context.fetch( user_id="user_carol", customer_id="acme_corp", search_query=["team priorities this quarter"])# Carol also sees: "Migrating auth service to OAuth 2.1 by end of Q2"
All three users benefit from the same customer-scoped knowledge, while each also has access to their own user-scoped memories. The result is an agent that understands both the shared organizational context and each individual’s personal situation.
How customer context differs from organizational context
Both customer context and organizational context provide shared knowledge, but they differ in scope and audience:
Aspect
Organizational context
Customer context
Scope level
CLIENT
CUSTOMER
Visibility
All customers, all users
All users in one customer
Who provides it
You (the application developer)
You or the customer’s data
What it contains
Product docs, announcements, domain knowledge
Company policies, team info, shared projects
Caching
30-minute TTL
No special caching
Changes how often
Infrequently (product releases)
Moderately (as org evolves)
Example
”Our API supports pagination via cursor"
"Acme Corp uses Jira for project tracking”
When both organizational and customer context are relevant to a query, customer context takes priority in ranking because it is the narrower scope. However, both are returned if token budget allows, giving the agent a complete picture.
Here is a complete example showing how to ingest customer-specific documentation and then use it in user conversations:
from synap import Synapsdk = Synap(api_key="your_api_key")# Step 1: Ingest customer-specific documentsasync def onboard_customer(customer_id: str, company_docs: list[str]): """Load company documents during customer onboarding.""" for doc in company_docs: await sdk.memories.create( document=doc, document_type="document", customer_id=customer_id ) print(f"Onboarded {len(company_docs)} documents for {customer_id}")# Step 2: Use customer context in conversationsasync def handle_message(user_id: str, customer_id: str, message: str): """Handle a user message with full context chain.""" # Fetch context across all applicable scopes context = await sdk.user.context.fetch( user_id=user_id, customer_id=customer_id, search_query=[message] ) # Build a rich prompt with scoped context prompt = f"""You are an AI assistant with knowledge about the userand their organization.Organizational knowledge (product-wide):{context.facts}User preferences:{context.preferences}User message: {message}Respond using all available context. Prioritize user-specific andorganization-specific information over general product knowledge.""" # Pass to your LLM...# Usageawait onboard_customer("acme_corp", [ "Acme Corp uses Slack for internal communication...", "Acme Corp's fiscal year runs April to March...", "Engineering team OKRs for Q2: migrate to microservices...",])await handle_message( user_id="user_alice", customer_id="acme_corp", message="When does our fiscal year end?")# Agent responds: "Acme Corp's fiscal year ends in March."