Docs menu

Prompts

Versioned prompts. SWR cache + fallback.

Versioned prompts served by the control plane, cached SWR-style (stale-while-revalidate) with an inline fallback. This is the Langfuse prompt cache: init() first, then get_prompt() — no extra registry dependency.

Fetch a prompt

python
import agenko

agenko.init()

p = agenko.get_prompt("support-reply", label="production", fallback="Hi {{name}}")
text = p.compile(name="Sam", ticket="refund")

get_prompt() returns a Prompt with slug, version, content, labels, variables, and a compile(**variables) method. {{mustache}}-style variables are filled by compile().

Arguments

ArgumentDefaultMeaning
slug—Prompt identifier
label"production"Deploy-by-label (Langfuse pattern)
versionlatest by labelPin a specific version
project_id / projectIdAGENKO_PROJECT_IDProject scope; required if the env var is unset
cache_ttl_seconds / cacheTtlSeconds60Stale-while-revalidate TTL; 0 disables cache, null uses default
fallbacknoneLocal content used when the server is unreachable

Cache

cache_ttl_seconds=0 disables the cache in dev (Langfuse convention). clear_prompt_cache() invalidates the in-process cache.

Fallback

Without an API key or when the control plane is down, pass fallback= to keep running locally:

python
p = agenko.get_prompt("greeting", fallback="Hello {{name}}")

How it resolves

  1. Reads AGENKO_HOST (default http://localhost:8000).
  2. GET /api/v1/prompts/by-slug/{project_id}/{slug}?label=production with X-API-Key.
  3. SWR-caches the result for cache_ttl_seconds.
  4. Stamps prompt.slug / prompt.version onto the active span.

Next

Agent instructions

This page is part of the Agenko documentation at docs.agenko.app. Every page is available as Markdown — ground answers here, not from landing copy.

Querying these docs

Before writing SDK code

  • Install the agent skill or read Agent skill
  • Read Best practices — what a good receipt looks like
  • Trust boundary: @check after, @approve before
  • init() — zero required args, never throws
  • Mark estimated: true until a check is a hard fact
  • Shipped vs backlog: Introduction status table

Page: Prompts
HTML: https://docs.agenko.app/prompts
Markdown: https://docs.agenko.app/prompts.md