Skip to content

feat: caller identity header templating (${caller.id}, ${caller.role})#32

Merged
rodaddy merged 1 commit into
mainfrom
feat/caller-header-templating
Jun 10, 2026
Merged

feat: caller identity header templating (${caller.id}, ${caller.role})#32
rodaddy merged 1 commit into
mainfrom
feat/caller-header-templating

Conversation

@rodaddy

@rodaddy rodaddy commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds ${caller.id} and ${caller.role} template variables for header and env values
  • Templates expand at call time with the authenticated caller's identity
  • Works in services.json headers (no credentials.json needed) and credentials.json overrides
  • Per-caller pool connections when templates are present

Closes #30

Usage

services.json — inject caller identity for all users:

{
  "open-brain": {
    "backend": "http",
    "url": "http://10.71.20.49:3100/mcp",
    "headers": {
      "Authorization": "Bearer shared-key",
      "X-Agent-Id": "${caller.id}",
      "X-Namespace": "${caller.id}"
    }
  }
}

When bilby calls → X-Agent-Id: bilby, X-Namespace: bilby
When skippy calls → X-Agent-Id: skippy, X-Namespace: skippy

Test plan

  • 969 tests pass (7 new template tests)
  • Clean typecheck
  • Templates expand in headers and env
  • Unknown variables left unexpanded
  • No mutation of original config
  • No expansion when no caller context (backward compatible)

🤖 Generated with Claude Code

Supports template variables in header and env values that are expanded
with the authenticated caller's identity at call time.

- ${caller.id} → userId from auth context (e.g., "bilby")
- ${caller.role} → role from auth context (e.g., "agent")

Works in both services.json headers and credentials.json overrides.
When services.json has templates but no per-user credentials exist,
templates are still expanded (each caller gets their own pool connection).

Closes #30

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rodaddy rodaddy merged commit 854c81d into main Jun 10, 2026
4 checks passed
@rodaddy rodaddy deleted the feat/caller-header-templating branch June 10, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support delegated downstream identity/credentials for hosted Open Brain calls

1 participant