To share a published prompt with your whole organization, see Share prompts with Registry.
weave.StringPrompt or weave.MessagesPrompt classes. If your needs are more complex, you can subclass those or the base class weave.Prompt and override the format method.
When you publish a prompt with weave.publish, it appears in your Weave project on the Prompts page, where you and your collaborators can browse and reuse it.
StringPrompt
StringPrompt logs single-string prompts that you might use for system messages, user queries, or any standalone text input to an LLM. Use StringPrompt to manage individual prompt strings that don’t require the complexity of multi-message conversations.
- Python
- TypeScript
MessagesPrompt
MessagesPrompt lets you log multi-turn conversations and chat-based prompts. It stores an array of message objects (with roles like system, user, and assistant) that represent a complete conversation flow. Use MessagesPrompt for chat-based LLMs where you need to maintain context across multiple messages, define specific conversation patterns, or create reusable conversation templates.
- Python
- TypeScript
Parameterize prompts
Once you can create static prompts, the next step is to make them reusable across different inputs. BothStringPrompt and MessagesPrompt support dynamic content through parameterization. This lets you create reusable prompt templates with placeholders (using {variable} syntax) that you fill with different values at runtime. Parameterization is useful when your prompts must adapt to different inputs, user data, or contexts while maintaining a consistent structure. The format() method accepts key-value pairs to replace these placeholders with actual values.
- Python
- TypeScript
MessagesPrompt when you need placeholders inside a multi-turn conversation.
- Python
- TypeScript
Share prompts with Registry
A published prompt belongs to the Weave project you published it to. To share a prompt version across your organization, link it to a collection in a registry. Linking moves the prompt version from a private, project-level scope to a shared, organization-level scope, where the registry’s visibility settings control who can access it. After you link a prompt version, you can:- Browse the prompt’s content, aliases, and tags in Registry alongside your organization’s other assets.
- Retrieve the prompt in application code with
weave.get()and aregistry:///URI that references either a fixed version or an alias.
v4 of the prompt. The second returns whichever version currently has the production alias, which you can reassign to a different version later:
ORG, REGISTRY_NAME, and COLLECTION_NAME with your organization, registry, and collection names.
Registry assigns version numbers for you, and they always take the form v followed by a number. A custom alias can’t use the same syntax. Any other name, including one that starts with v such as validated, is an alias. For details, see Alias limits.
To link a prompt version, call link_prompt_to_registry() in the Python SDK or linkPromptToRegistry() in the TypeScript SDK. For a complete Python example, including how to view and retrieve a linked prompt, see Link a Weave prompt to a collection.