Skip to content

Reflect: Reasoning Over Memories

Fresh

Source: docs.hindsight.vectorize.io/reflect

Overview

The Reflect operation performs agentic reasoning over stored memories, guided by the bank's mission, directives, and disposition traits. Unlike Recall which returns raw memories, Reflect synthesizes information and draws conclusions with confidence scores.

Reflect enables:

  • Synthesis of insights from stored memories
  • Reasoning influenced by disposition traits (skepticism, literalism, empathy)
  • Confidence scores based on evidence strength
  • Cited sources for transparency
  • Automatic incorporation of relevant mental models as context

Basic Usage

python
response = client.reflect(
    bank_id="your-bank-id",
    query="What are the key priorities for the project?"
)

print(response.text)
print("Based on:", response.based_on)
typescript
const response = await client.reflect(
  'your-bank-id',
  'What are the key priorities for the project?'
);

console.log(response.text);
console.log('Based on:', response.based_on);
bash
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/{bank_id}/reflect \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"query": "What are the key priorities for the project?"}'

How It Works

Request Parameters

ParameterTypeRequiredDescription
bank_idstringYesMemory bank to query (in URL path)
querystringYesQuestion to answer
contextstringNoAdditional context for the question
budgetstringNoSearch depth: low, mid, high (default: low)
max_tokensintegerNoMax tokens in response (default: 4096)
response_schemaobjectNoJSON Schema for structured output

Response

json
{
  "text": "Based on the stored memories, the key priorities are...",
  "based_on": [],
  "mental_models": [
    {
      "id": "mm_abc123",
      "text": "The project is focused on building a modern web application..."
    }
  ],
  "structured_output": null,
  "usage": {
    "input_tokens": 3352,
    "output_tokens": 806,
    "total_tokens": 4158
  }
}

Reflect vs. Recall

AspectRecallReflect
OutputRaw memoriesSynthesized answer
ProcessingSearch onlyAI reasoning
Best forGetting contextAnswering questions
Token usageLowerHigher
SourcesThe result IS the sourcesSources cited separately

When to Use Recall

  • You need raw data to process yourself
  • Building prompts for another AI system
  • Debugging or inspecting stored memories
  • Minimizing token usage

When to Use Reflect

  • Answering user questions directly
  • Generating summaries or insights
  • Need synthesized information from multiple memories
  • Want automatic source citation

Advanced Patterns

With Context

python
response = client.reflect(
    bank_id=bank_id,
    query="What should I know before our meeting?",
    context="We're meeting with the client to discuss the Q2 roadmap"
)

Conversational Context

python
resp1 = client.reflect(
    bank_id=bank_id,
    query="Who are the key stakeholders?"
)

resp2 = client.reflect(
    bank_id=bank_id,
    query="What are their main concerns?",
    context=f"We identified these stakeholders: {resp1.text}"
)

Structured Output

bash
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/{bank_id}/reflect \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Summarize the key points about this user",
    "response_schema": {
      "type": "object",
      "properties": {
        "summary": {"type": "string"},
        "key_points": {"type": "array", "items": {"type": "string"}}
      },
      "required": ["summary", "key_points"]
    }
  }'

Error Handling

ErrorCauseSolution
401 UnauthorizedInvalid API keyCheck your API key
402 Payment RequiredInsufficient creditsAdd credits to your account
404 Not FoundInvalid bank_idVerify the bank exists
400 Bad RequestEmpty questionProvide a question

Performance Considerations

  1. Reflect is more expensive — Uses more tokens than Recall
  2. Limit sources — Use budget control to manage token consumption
  3. Cache when possible — Store answers for frequently asked questions
  4. Consider Recall first — If raw memories suffice, prefer Recall