Octopus
Context Window
The context window is the full content sent to the LLM in one API call — the "prompt" in its entirety. Understanding what goes into the context window and how it is structured is fundamental to diagnosing agent behavior and optimizing response quality.
Context Window Structure
An Octopus context window is a structured list of messages, each with a role and content. The LLM processes them in order:
// Example context window for one agent turn:
[
{
"role": "system",
"content": "You are Aria, the HR specialist for Acme Corp. Your domain is..."
// ← SystemPrompt from AgentComposite
},
{
"role": "system",
"content": "[Procedure: vendor_onboarding]\nTo onboard a vendor, follow these steps: ..."
// ← Matched procedure from procedural memory
},
{
"role": "context", // treated as system in most LLM APIs
"content": "[Retrieved Knowledge]\nSource: HR Policy 2025.pdf\n..."
// ← Semantic memory retrieval results
},
{
"role": "context",
"content": "[Past Conversation Context]\n2025-03-14: User asked about leave balance..."
// ← Episodic memory snippets
},
{
"role": "user",
"content": "Hi, can you help me add a new supplier?"
// ← Turn 1 of message history
},
{
"role": "assistant",
"content": "Of course! To add a new supplier, I'll need the supplier name..."
// ← Turn 1 response (from history)
},
{
"role": "user",
"content": "Onboard TechCorp as a new vendor, contact is procurement@techcorp.com, contract CTR-2025-001"
// ← Current user message (turn 2)
}
]
Role Mapping per LLM Provider
| Octopus Role | Anthropic Claude | OpenAI/Azure |
|---|---|---|
| system | system | system |
| context | user (injected as context block) | system |
| user | user | user |
| assistant | assistant | assistant |
| tool | tool_result | tool |
Anthropic Context Blocks
Anthropic Claude does not support multiple system messages in the same call. Octopus handles this by merging all system-role content into a single system message for Anthropic providers, separated by \n---\n dividers.
Context Window Size Per Provider
| Provider | Model | Context Window | Recommended Working Budget |
|---|---|---|---|
| Anthropic | claude-sonnet-4-6 | 200,000 tokens | 150,000 tokens |
| Anthropic | claude-opus-4 | 200,000 tokens | 150,000 tokens |
| OpenAI | gpt-4o | 128,000 tokens | 100,000 tokens |
| Azure OpenAI | gpt-4o | 128,000 tokens | 100,000 tokens |
| Ollama | llama3:70b | 8,192 tokens | 6,000 tokens |