Mastering Claude’s Company Context: How to Build Brand-Aware AI Agents
Learn how to inject company-specific context into Claude API calls to build brand-aware, accurate AI agents. Includes Python code examples and best practices.
This guide teaches you how to structure system prompts and API calls so Claude understands your company’s voice, products, and policies—making your AI agents more accurate and on-brand.
Introduction
When you integrate Claude into your product, one of the biggest challenges is making sure the AI understands your company. Without proper context, Claude might answer with generic information, miss your brand’s tone, or even hallucinate facts about your business. This guide shows you how to inject company-specific context into Claude API calls, so your AI agents become brand-aware, accurate, and trustworthy.
Why Company Context Matters
Claude’s base knowledge is broad but not specific to your organization. If you’re building a customer support bot, an internal knowledge assistant, or a sales enablement tool, you need Claude to:
- Use your company’s exact product names and terminology
- Follow your brand voice (friendly, professional, technical, etc.)
- Reference your internal policies, pricing, or documentation
- Avoid making up information about your company
The Two Main Approaches
There are two primary ways to give Claude company context:
- System Prompt Injection – Embed company information directly in the system message.
- Retrieval-Augmented Generation (RAG) – Dynamically fetch relevant company documents and include them in the prompt.
Approach 1: System Prompt with Company Profile
Start by writing a concise company profile that Claude reads at the beginning of every conversation. This works well for static information like brand voice, product names, and core policies.
Example system prompt:You are an AI assistant for AcmeCorp, a SaaS company that sells project management software.
Company details:
- Product name: AcmePlan
- Target audience: Small to medium businesses (10-500 employees)
- Brand voice: Friendly, professional, and solution-oriented. Use "we" and "our".
- Key features: Gantt charts, time tracking, team collaboration, integrations with Slack and Jira
- Pricing: Free tier (up to 10 users), Pro ($29/user/month), Enterprise (custom)
- Support hours: 9 AM – 9 PM EST, Monday–Friday
Always answer based on this information. If you don’t know something, say “I don’t have that information” rather than guessing.
Approach 2: RAG with Company Documents
For dynamic or large amounts of context (e.g., your entire knowledge base), use RAG. Here’s a minimal Python example using Claude API and a simple vector search:
import anthropic
from sentence_transformers import SentenceTransformer
import numpy as np
Initialize Claude client
client = anthropic.Anthropic(api_key="YOUR_API_KEY")
Sample company documents (in reality, you'd load from a database)
documents = [
"AcmePlan integrates with Slack, Jira, and Google Calendar.",
"Our refund policy: full refund within 30 days of purchase.",
"Enterprise plan includes SSO, dedicated support, and custom integrations.",
"To reset your password, go to Settings > Account > Security."
]
Simple embedding search (use a proper vector DB in production)
model = SentenceTransformer('all-MiniLM-L6-v2')
doc_embeddings = model.encode(documents)
def search_docs(query, top_k=2):
query_embedding = model.encode([query])
scores = np.dot(doc_embeddings, query_embedding.T).flatten()
top_indices = np.argsort(scores)[-top_k:][::-1]
return [documents[i] for i in top_indices]
User question
user_query = "How do I reset my password?"
relevant_docs = search_docs(user_query)
context = "\n\n".join(relevant_docs)
Call Claude with context
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
system="You are an AcmeCorp assistant. Use the provided context to answer accurately.",
messages=[
{"role": "user", "content": f"Context:\n{context}\n\nQuestion: {user_query}"}
]
)
print(response.content[0].text)
Structuring Company Context for Best Results
To maximize accuracy, follow these guidelines:
1. Be Specific and Factual
Bad: “We have good customer support.” Good: “Our support team is available 9 AM – 9 PM EST, Monday–Friday, with an average response time of 2 hours.”
2. Use a Consistent Format
Create a template for your company context block:
## Company Identity
- Name: [Company Name]
- Industry: [Industry]
- Target audience: [Description]
Products/Services
- [Product 1]: [Brief description]
- [Product 2]: [Brief description]
Brand Voice
- Tone: [e.g., Professional, Friendly, Technical]
- Pronouns: [e.g., We/Our, You/Your]
- Do not: [e.g., Use slang, Make jokes]
Key Policies
- [Policy 1]: [Detail]
- [Policy 2]: [Detail]
3. Update Context Regularly
Company information changes. Set a reminder to review and update your system prompt or document store every month.
Advanced: Dynamic Context Injection
For more sophisticated agents, you can dynamically inject context based on the user’s intent. Here’s a TypeScript example:
import Anthropic from '@anthropic-ai/sdk';
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
interface CompanyContext {
product: string;
voice: string;
policies: string[];
}
async function getContextForIntent(intent: string): Promise<CompanyContext> {
// Mock: in reality, query a context database
if (intent.includes('billing')) {
return {
product: 'AcmePlan',
voice: 'Professional, reassuring',
policies: [
'Refund policy: full refund within 30 days',
'Billing cycle: monthly or annual',
'Late payment: 5-day grace period'
]
};
}
// Default context
return {
product: 'AcmePlan',
voice: 'Friendly and helpful',
policies: ['Standard SLA: 99.9% uptime']
};
}
async function handleUserMessage(userMessage: string) {
const context = await getContextForIntent(userMessage);
const response = await anthropic.messages.create({
model: 'claude-3-5-sonnet-20241022',
max_tokens: 1024,
system: You are an assistant for ${context.product}. Voice: ${context.voice}. Policies: ${context.policies.join('; ')},
messages: [{ role: 'user', content: userMessage }]
});
return response.content[0].text;
}
Common Pitfalls to Avoid
- Overloading the system prompt – Keep it under 2000 tokens. For more context, use RAG.
- Contradictory information – Ensure your context doesn’t conflict with itself (e.g., saying “24/7 support” and “9-5 support” in the same prompt).
- Outdated information – If you change pricing, update your context immediately.
- Ignoring user privacy – Never include sensitive customer data in the system prompt.
Testing Your Company Context
Before deploying, test with a set of sample questions:
- “What is your refund policy?” → Should match your actual policy
- “Tell me about your product” → Should use your product name and features
- “How do I contact support?” → Should give correct hours and channels
- “What’s your pricing?” → Should match your current pricing table
Key Takeaways
- Inject company context via system prompts for static information (brand voice, product names, policies).
- Use RAG for dynamic or large amounts of context, fetching relevant documents per query.
- Keep context specific, factual, and up-to-date to avoid hallucinations and outdated answers.
- Test your context with a set of sample questions before deploying to production.
- Combine both approaches for the best results: a system prompt with core identity + RAG for detailed knowledge.