Namaste Ji by Ayushman Dash

Every agent has the same anatomy; every model is a config value.

Open one up. Every agent in the production plane is the same shape — the Agent Kernel — with different prompts, tools and memory. Swap the model behind a role and nothing redeploys. Then the workbench: the actual tools (read from source), the actual prompts (full text, versioned in Langfuse), the manifests, and a real run, turn by turn.

The Kernel, exploded.

One loop every agent instantiates: recall → act (tools, subagents) → write back → calibrated stop — inside the Control DO gate.

CONTROL DO GATE — autonomy: observe · proposes · acts · autonomous — a human can pause any agent the looprecall → act → grade → write-backcheckpoint PER TURN (Workflows)calibrated stop · max_loops = backstop STM — working memoryorchestrator-owned · compacted on overflowprojected read-only to subagents LTM — MemoryPortD1 + Vectorize · scoped agent_id + domainlearn only from verified outcomes · playbook Prompts — Langfusename@label · versioned · per-env labelnever hardcoded Tools — Zod schemastool({ description, inputSchema, execute })typed contracts in @namaste-ji/shared Subagents — as toolsbehind a context firewallresearch · catalog · code-exec · memory ModelPort → AI GatewayOpenAI · Sarvam · Cohere · Workers AIroles from KV, never hardcoded Markdown artifacts with YAML frontmatter (briefs · strategy@vN · playbook) · single observability stream (Langfuse traces + run events → console)

The provider switchboard.

A role (e.g. the orchestrator's text model) is wired to a provider in KV. Flip it — the KV diff and the Gateway route are all that change. Nothing redeploys. This is not hypothetical: the Creative Head's run below actually ran on Sarvam.

 

KV key agent:<id>.model_roles → the agent's ModelPort resolves provider + model at run time; the AI Gateway route is …/namaste-ji-gateway-staging/<provider>. Text roles run on Sarvam; image and vision roles on OpenAI (gpt-image-1 + multimodal); embeddings on Cohere — each is one KV value.

Proof — a real run on Sarvam

creative-head · run-1787417764342 · provider sarvam · model sarvam-105b · 281,984 tokens · 28 tool calls

Creative Head run: 4 loops, 6 briefs (proposes, 0 approved) — sarvam/sarvam-105b, 2026-08-22

The workbench — how each agent is actually built.

Tools are read from the source at build time; prompts are the full text served from Langfuse (production label); manifests are the live documents; the run is a real one with its trace. Nothing here is paraphrased.

Kernel loop

Creative Head

reads events · strategy · catalog · its playbook → emits Content Briefs + strategy@vN

Agent Hub ↗

Tools 10 · from agents/creative-head/src/agent.ts

  • read_playbook

    Recall the agent's own durable playbook — what past runs learned about what gets forwarded and how to diversify.

    z.object({ objective: OBJECTIVE })
  • query_past_briefs

    List briefs from PAST runs and their execution feedback (the gen agent's subjective analysis of how each went). Use it to avoid repeats, push novelty, and double down on what worked. May be empty early on.

    z.object({ objective: OBJECTIVE, limit: z.number().optional() })
  • read_catalog

    Get a coverage map of content that already exists, by variety axis. (Currently EMPTY — cold start.)

    z.object({ objective: OBJECTIVE })
  • query_events

    Read the events calendar: upcoming Indian festivals/observances with VALIDATED dates. The ONLY source of dates — never invent a festival date. Params: days (window), type, religion.…

    z.object({ objective: OBJECTIVE, days: z.number().optional(), type: eventTypeSchema, religion: eventReligionSchema })
  • diversity_audit

    Audit coverage + intra-list diversity across the briefs you have proposed so far. Returns distinct counts per variety axis and flags thin spread. Call before finishing to find redundancy and uncovered axes.

    z.object({ objective: OBJECTIVE })
  • historical_coverage

    Analyze the HISTORICAL catalog + ALL past briefs (not just this run's proposals): how often each variety cell (deity · festival · region · cohort · art-style · emotion · temporal_class) has been produced over time, the most recent themes, and what's over-repeated vs uncovered — so you propose UNIQUE-yet-precise briefs that avoid repetition and fill real gaps. Call this BEFORE proposing.

    z.object({ objective: OBJECTIVE, limit: z.number().optional() })
  • note_lesson

    Record a DURABLE, REUSABLE lesson for FUTURE runs — a forward-driver, a diversity tactic, or a regional/scheduling gotcha. NEVER a one-off date or a specific brief.

    z.object({ objective: OBJECTIVE, lesson: z.string() })
  • propose_brief

    Emit ONE fully-specified Content Brief (the write path). It must be self-contained: the downstream generator gets NO strategy context. Time-bound briefs need per-region schedule.geo_windows with dates from query_events; evergreen briefs need schedule.cadence + deliver_local_time. Ground iconography/dates — never guess.

    z.object({ objective: OBJECTIVE, brief: proposeBriefInput })
  • finish

    Call this when the brief portfolio has good coverage + diversity and every load-bearing claim is grounded.

    z.object({ objective: OBJECTIVE.optional(), summary: z.string(), confidence: z.number().optional() })
  • analyzeImage

    SEE and analyze up to 4 images (e.g. URLs from tavily_search image results) with a vision model. mode="analyze": structured visual read (motifs, palette, composition, emotional register, forward-appeal per cohort) to ground a brief's variety_axes/metadata_spec/forward_hypothesis. mode="iconography": check whether the image correctly depicts a deity/festival (vahana, attributes, colors) — a cultural-veto guardrail. mode="diversity": judge how visually DISTINCT the set is (saturated cliché vs whitespace). Bounded + costly — use deliberately.

    z.object({ objective: OBJECTIVE, image_urls: z.array(z.string()).min(1).max(MAX_IMAGES), mode: z.enum(['analyze', 'iconography', 'diversity']).default('analyze'), question: z.string().describe('The hypothesis/rubric to evaluate, or what the image should depict (for iconography).'), })

Manifest v2

{
  "id": "creative-head",
  "name": "VP, Creative Content Strategy & Product",
  "description": "Researches what content to make next — across deities, festivals, regions and audience cohorts — and emits a portfolio of executable Content Briefs that maximize forwards. Diversity is the primary lever; geography and scheduling are first-class. Reads the events calendar.",
  "icon": "Sparkles",
  "kind": "pipeline",
  "autonomy": "acts",
  "schedule": null,
  "surfaces": [
    "briefs",
    "strategy"
  ],
  "scopes": [
    "brief:read",
    "brief:create",
    "brief:approve"
  ]
}

Prompts 4 · Langfuse, label production · full text

creative-head/orchestrator @production · v2 · 4,998 chars
You are the Creative Head — VP of Creative Content Strategy & Product — for Namaste Ji, a devotional & greeting app for the next billion Indian internet users. Users forward "Good Morning", festival and devotional images to family and friends on WhatsApp.

Today is {{current_date}}.

## Your single objective: MAXIMIZE FORWARDS.
People forward content that is uplifting, devotionally resonant (deities, festivals, rising sun, flowers), carries an inspirational line, and lets them signal care to their groups. Cohorts differ: seniors forward devotional, younger users forward fresh/contemporary. So you win with a DIVERSE PORTFOLIO across share-drivers and cohorts — never one winning style. This is the "amplify the recipe, not the dish" principle: your lever is the VARIETY of distinct content you commission, not repetition.

## What you produce
A portfolio of executable Content Briefs for the next {{planning_horizon_months}} months. A downstream Content-Generation agent will pick up ONE brief at a time and generate `count` assets from it with ZERO strategy context — so every brief must be FULLY SPECIFIED and self-contained. You are ALSO the VP of Product: each brief says where (feature), for whom (geo + cohort), and WHEN it should surface (schedule).

## How you work
Each turn you may call several tools (each needs a one-sentence "objective"). After each turn your working memory (STM) is rewritten and shown back — read it to pick the next gap. Never repeat work the STM shows as done.

## Tools
- `read_playbook` — recall what past runs learned about what gets forwarded and how to diversify.
- `query_past_briefs` — see every brief made before AND the gen agent's analysis of how it went. Avoid repeats; push novelty; double down on what worked.
- `read_catalog` — what content already exists (currently EMPTY — cold start).
- `query_events` — the events calendar: upcoming festivals/observances with VALIDATED dates. This is the ONLY source of dates — never invent a festival date.
- `research` — delegate web research for a hypothesis or theme (trends, iconography correctness, image-style inspiration; it can SEE images). Returns a distilled, sourced finding.
- `propose_brief` — emit ONE fully-specified Content Brief (the write path).
- `diversity_audit` — assess coverage + intra-list diversity across your proposed briefs so far (deity · festival · geo/region · art-style · cohort · emotion · temporal_class). Call it before finishing to find redundancy and uncovered axes.
- `note_lesson` — record a durable, reusable lesson for future runs (a forward-driver, a diversity tactic, a regional gotcha) — NEVER a one-off date or a specific brief.
- `finish` — only when the portfolio has good coverage + diversity and every load-bearing claim is grounded.

## Geography & scheduling (first-class)
Geography matters as much as language: regional deities, aesthetics, language pockets, and festival-date VARIANCE. For TIME-BOUND briefs, set a per-region `schedule.geo_windows` entry with the validated `instance_date` from `query_events` plus prebuild_by / promote_from / peak / decay_until. For EVERGREEN briefs, set `schedule.cadence` + `deliver_local_time` (Good-Morning content peaks before 08:00 local). Languages for now: hi (Devanagari), en, hi-Latn (Hinglish).

## Typography (first-class — fonts drive likability & forwards)
When a brief has a text overlay, the FONT is a deliberate choice, not an afterthought — it strongly affects engagement. Pick a font from the global strategy font taxonomy that suits the SCRIPT (Devanagari for hi; Latin for en/hi-Latn), the EMOTIONAL register, and the COHORT (e.g. clean/legible for elders, modern/geometric for younger audiences, handwritten for a personal note, traditional serif for devotional gravitas). If a brief renders multiple scripts, set `font_by_script` so each script gets a font that supports it. Always fill `text_overlay.typography.font` and a short `rationale`, and mirror the chosen font into `metadata_spec.font`.

## Grounding (a wrong deity or date is brand-ending)
Iconography and festival dates are cultural-veto claims: ground them in `query_events` or `research`, never guess. If you cannot ground a load-bearing claim, drop that brief and note why.

## Approach
1. `read_playbook` + `query_past_briefs` + `read_catalog` to orient (cold start ⇒ bootstrap breadth).
2. `query_events` for the upcoming window; pick the occasions worth a batch.
3. For each promising theme/occasion/cohort/region, optionally `research` to validate, then `propose_brief` with full WHAT/WHERE/WHEN + variety_axes + typography + forward_hypothesis + grounding.
4. Spread across the variety axes deliberately; `diversity_audit`; fill gaps until coverage + diversity are good (aim for at least {{brief_floor}} briefs), then `note_lesson` for anything reusable and `finish`.

## Global strategy (weigh this)
{{global_strategy}}

## What you've learned (apply it)
{{playbook}}

## Operator directive (optional steer)
{{directive}}
kernel/stm-writer @production · v1 · 1,089 chars
You maintain an agent's WORKING MEMORY: one coherent Markdown document that anyone can read to instantly understand the objective, plan, reasoning, and outcomes so far.

Here is the current working memory:

{{stm}}

The agent just completed an action with this objective:
"{{objective}}"

The action returned this result:
{{result}}

Rewrite the ENTIRE working memory document, integrating this outcome:
- Keep the exact section headings: ## Objective, ## Plan / TODO, ## Findings, ## Reasoning & progress, ## Coverage & confidence.
- In Plan / TODO, mark items this action completed as done ("- [x] … — outcome") and add new items if needed.
- In Findings, add the distilled facts/events (with date + source + confidence) — never paste raw search results.
- In Reasoning & progress, update the short narrative (including failures and what to do next).
- In Coverage & confidence, assess whether the objective is solved and what gaps remain.
- Preserve everything still relevant; remove only what is now obsolete; keep it concise and coherent.

Output ONLY the rewritten Markdown document.
creative-head/research @production · v2 · 1,512 chars
You are a research subagent for the Namaste Ji Creative Head. You get ONE objective: validate a content hypothesis, find what's trending/forwarded, confirm correct iconography for a deity/festival, or gather visual-style inspiration.

Today is {{current_date}}.

Work efficiently:
- One or two `tavily_search` calls usually suffice. Image results are valuable for visual-style inspiration — note recurring motifs, palettes, compositions. Use `tavily_extract` only when you need a specific page in detail.
- You can SEE images: pass image URLs (from search results) to `analyze_image` to get a real visual read. Use mode="analyze" to test a visual hypothesis, mode="iconography" to verify a deity/festival is depicted CORRECTLY (a cultural-veto check), or mode="diversity" to judge how distinct a set of references is. It's bounded and costly — use it deliberately on the images that matter.
- For cultural correctness (a deity's attributes, a festival's meaning/iconography), prefer reputable cultural/temple/encyclopedic sources over generic SEO blogs, and confirm with `analyze_image` mode="iconography" when a visual is load-bearing.

Return — via `finish`, the ONLY thing the caller receives — a concise, self-contained finding:
- The hypothesis and whether evidence SUPPORTS or REFUTES it (with a rough confidence).
- 2–5 concrete, actionable notes (motifs, palettes, tones, do/don't for iconography, cohort appeal).
- Source URLs.
Keep it tight. `note_lesson` for anything durable and reusable across runs.
creative-head/playbook-writer @production · v1 · 845 chars
You maintain the Creative Head's PLAYBOOK: one coherent Markdown document of DURABLE lessons that make future runs better at maximizing forwards through diverse, well-targeted content.

Here is the current playbook:

{{playbook}}

This run staged these new lessons / observations:

{{lessons}}

Rewrite the ENTIRE playbook, integrating the new lessons:
- Keep these sections: ## Forward-drivers (what makes content get shared), ## Diversity tactics (how to spread the portfolio), ## Geography & scheduling (regional/timing gotchas), ## What worked / what didn't (from executed briefs), ## Open questions.
- Merge duplicates; strengthen a lesson when this run reinforced it; drop anything contradicted or obsolete.
- Be specific and reusable — never a one-off date or a single brief. Keep it concise.

Output ONLY the rewritten Markdown document.

A real run run-1787417764342 · completed · sarvam / sarvam-105b · 281,984 tokens · 28 tool calls

Creative Head run: 4 loops, 6 briefs (proposes, 0 approved) — sarvam/sarvam-105b, 2026-08-22

  1. orchestrate · llmmodel callSelected tool: read_playbook
  2. orchestrate · toolread_playbook{"playbook":"## Forward-drivers (what makes content get shared)\n\n- **Memory-triggered copy beats generic greetings.** Short, emotionally direct lines usually forward best.\n- **O
  3. orchestrate · llmmodel callSelected tool: query_events
  4. orchestrate · toolquery_events{"events":[],"hint":"No events matched these filters. Re-query using the available filter values below, or drop the filters.","available_filters":{"types":[{"value":"devotional","c
  5. orchestrate · llmmodel callSelected tool: query_events
  6. orchestrate · toolquery_events{"events":[{"id":"shravana-putrada-ekadashi-2026-08-23-india","name":"Shravana Putrada Ekadashi","name_hi":"श्रावण पुत्रदा एकादशी","name_regional":null,"date":"2026-08-23","end_dat
  7. orchestrate · llmmodel callSelected tool: propose_brief
  8. orchestrate · toolpropose_brief{"objective":"Create a time‑bound Shravana Putrada Ekadashi brief targeting North Indian seniors and millennials with mixed traditional‑modern art style, focusing on family blessin
  9. orchestrate · llmmodel callSelected tool: propose_brief
  10. orchestrate · toolpropose_brief{"rejected":true,"reason":"Call `research` first to ground your themes/iconography before proposing briefs."}
  11. subagent:research · llmmodel callSelected tool: tavily_search
  12. subagent:research · tooltavily_search{"answer":"Shravana Putrada Ekadashi is a Hindu festival honoring Lord Vishnu, celebrated on the 11th day of the Hindu month of Shravana. It's known for wishing new sons. A Vishnu
  13. subagent:research · llmmodel callSelected tool: tavily_search
  14. subagent:research · tooltavily_search{"answer":"Shravana Putrada Ekadashi is a Hindu observance dedicated to Lord Vishnu. It features greeting cards and images depicting Lord Vishnu. The date for 2026 is August 22.","
  15. subagent:research · llmmodel callSelected tool: tavily_extract
  16. subagent:research · tooltavily_extract{"results":[{"url":"https://brands.live/template/shravan-putrada-ekadashi-lord-vishnu-97394","content":"Loading...\n\nLoading...\n\nLoading...\n\nLoading...\n\nLoading...\n\nLoadin
  17. subagent:research · llmmodel callSelected tool: tavily_extract
  18. subagent:research · tooltavily_extract{"results":[{"url":"https://brands.live/template/shravan-putrada-ekadashi-lord-vishnu-97394","content":"Loading...\n\nLoading...\n\nLoading...\n\nLoading...\n\nLoading...\n\nLoadin
  19. subagent:research · llmmodel callSelected tool: tavily_search
  20. subagent:research · tooltavily_search{"answer":"Shravana Putrada Ekadashi is observed in August; Vishnu greeting cards in JPG or PNG are available online. Common themes include Lord Vishnu and festive decorations. Car
  21. subagent:research · llmmodel callSelected tool: tavily_extract
  22. subagent:research · tooltavily_extract{"results":[{"url":"https://www.pinterest.com/ideas/vaikunta-ekadasi-images-wishes/919009664350","content":"Vaikunta Ekadasi Images Wishes\n\n[Skip to content](#)\n\nWhen autocompl
  23. subagent:research · llmstm-writer# Working memory ## Objective Validate iconography and visual motifs for Shravana Putrada Ekadashi (Vishnu) devotional greeting images. ## Plan / TODO - [x] Explore and research re
  24. subagent:research · llmmodel callSelected tool: tavily_search
  25. … 36 more steps
Langfuse trace run-1787417764342 · 16 event
  1. EVENT · tool/finish{"objective":"Complete the pilot run by submitting three diverse, high‑quality content briefs for the next weeks to maximize forwards.","args":{"objective":"Complete the pilot run by submitting three diverse, high‑quality content briefs for
  2. EVENT · tool/propose_brief{"objective":"Submit the pending Varalakshmi Vrat content brief for production to complete the pilot run.","args":{"objective":"Submit the pending Varalakshmi Vrat content brief for production to complete the pilot run.","brief":{"theme":"V
  3. EVENT · tool/propose_brief{"objective":"Finalize and submit three diverse content briefs for August 2026 devotional events to maximize forwards.","args":{"objective":"Finalize and submit three diverse content briefs for August 2026 devotional events to maximize forw
  4. EVENT · tool/propose_brief{"objective":"Finalize and submit three diverse content briefs for August 2026 devotional events to maximize forwards.","args":{"objective":"Finalize and submit three diverse content briefs for August 2026 devotional events to maximize forw
  5. EVENT · tool/propose_brief{"objective":"Create a Gen‑Z focused, South‑India devotional brief for Varalakshmi Vrat featuring Lakshmi in Tanjore style with vibrant colors and Hinglish greeting.","args":{"objective":"Create a Gen‑Z focused, South‑India devotional brief
  6. EVENT · tool/diversity_audit{"objective":"Audit coverage and intra-list diversity of proposed briefs across deity, festival, region, art style, cohort, emotion, temporal class.","args":{"objective":"Audit coverage and intra-list diversity of proposed briefs across dei
  7. EVENT · tool/propose_brief{"objective":"Create a millennial‑focused, North‑India devotional brief for Fourth Sawan Somwar featuring Shiva in modern flat illustration style.","args":{"objective":"Create a millennial‑focused, North‑India devotional brief for Fourth Sa
  8. EVENT · tool/propose_brief{"objective":"Create a senior‑focused, North‑India devotional brief for Shravana Putrada Ekadashi featuring Vishnu in Madhubani style.","args":{"objective":"Create a senior‑focused, North‑India devotional brief for Shravana Putrada Ekadashi
  9. EVENT · tool/query_events{"objective":"Get validated dates for Shravana Putrada Ekadashi, Fourth Sawan Somwar, Bhauma Pradosh Vrat, and Varalakshmi Vrat in 2026.","args":{"objective":"Get validated dates for Shravana Putrada Ekadashi, Fourth Sawan Somwar, Bhauma Pr
  10. EVENT · tool/historical_coverage{"objective":"Identify past content briefs across deity, festival, region, cohort, art style, emotion, and temporal class to avoid repetition and uncover gaps.","args":{"objective":"Identify past content briefs across deity, festival, regio
  11. EVENT · tool/research{"objective":"Validate iconography and visual motifs for Shravana Putrada Ekadashi (Vishnu) devotional greeting images.","args":{"objective":"Validate iconography and visual motifs for Shravana Putrada Ekadashi (Vishnu) devotional greeting
  12. EVENT · tool/propose_brief{"objective":"Create a time‑bound Shravana Putrada Ekadashi brief targeting seniors in North India with mixed traditional‑modern art style, focusing on family blessings.","args":{"objective":"Create a time‑bound Shravana Putrada Ekadashi br
  13. EVENT · tool/propose_brief{"objective":"Create a time‑bound Shravana Putrada Ekadashi brief targeting North Indian seniors and millennials with mixed traditional‑modern art style, focusing on family blessings.","args":{"objective":"Create a time‑bound Shravana Putra
  14. EVENT · tool/query_events{"objective":"List upcoming devotional observances in India for the next 30 days.","args":{"objective":"List upcoming devotional observances in India for the next 30 days.","days":30,"type":"devotional","religion":"hindu"},"result":{"events
  15. EVENT · tool/query_events{"objective":"Get upcoming Indian festivals and observances for the next 30 days from 2026-08-22.","args":{"objective":"Get upcoming Indian festivals and observances for the next 30 days from 2026-08-22.","days":30,"type":"festival","religi
  16. EVENT · tool/read_playbook{"objective":"Recall forward-drivers and diversity tactics for maximizing forwards.","args":{"objective":"Recall forward-drivers and diversity tactics for maximizing forwards."},"result":{"playbook":"## Forward-drivers (what makes content g