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
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
| Argument | Default | Meaning |
|---|---|---|
slug | — | Prompt identifier |
label | "production" | Deploy-by-label (Langfuse pattern) |
version | latest by label | Pin a specific version |
project_id / projectId | AGENKO_PROJECT_ID | Project scope; required if the env var is unset |
cache_ttl_seconds / cacheTtlSeconds | 60 | Stale-while-revalidate TTL; 0 disables cache, null uses default |
fallback | none | Local 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:
p = agenko.get_prompt("greeting", fallback="Hello {{name}}")How it resolves
- Reads
AGENKO_HOST(defaulthttp://localhost:8000). - GET
/api/v1/prompts/by-slug/{project_id}/{slug}?label=productionwithX-API-Key. - SWR-caches the result for
cache_ttl_seconds. - Stamps
prompt.slug/prompt.versiononto the active span.
Next
- Environment —
AGENKO_PROJECT_ID,AGENKO_HOST - Python SDK · TypeScript SDK
- OpenTelemetry — what gets stamped on spans
- What we reuse — Langfuse extraction map
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
- Full index: docs.agenko.app/llms.txt · sections: llms-docs.txt, llms-sdk.txt, llms-integrations.txt
- This page as markdown: docs.agenko.app/prompts.md
- Search API:
curl -sG "https://docs.agenko.app/api/search-docs" --data-urlencode "query=…"
Before writing SDK code
- Install the agent skill or read Agent skill
- Read Best practices — what a good receipt looks like
- Trust boundary:
@checkafter,@approvebefore init()— zero required args, never throws- Mark
estimated: trueuntil a check is a hard fact - Shipped vs backlog: Introduction status table