Skip to content

Export and Versioning

In practice, you often want to turn code-defined prompts into persistent configs or hand them to non‑engineering owners. Exporting makes this practical: convert prompt expressions to YAML/JSON so you can build config-driven services and UIs without changing business logic.

Export full prompt

python
prompt_yaml = agent.prompt.to_yaml_prompt(inherit=True)
prompt_json = agent.prompt.to_json_prompt(inherit=True)

inherit=True merges Agent Prompt and Request Prompt.

python
yaml_snapshot = agent.get_yaml_prompt()
json_snapshot = agent.get_json_prompt()

Layered exports help you trace whether issues come from Agent rules or Request input.

Save to disk

python
with open("prompt.snapshot.yaml", "w", encoding="utf-8") as f:
  f.write(prompt_yaml)

Typical usage

  • Convert code expressions into YAML configs
  • Build config-driven services + front-end editors
  • Enable non-engineering prompt ownership