Skip to main content

Prompts

The Prompt Library stores reusable, versioned prompt templates with {{variable}} substitution. Use this resource for CRUD, versioning, rendering, and sharing.

Access it as client.prompts on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: type, search, tags
for prompt in client.prompts.list():
print(prompt.id)

Methods​

Core​

list​

list(*, type: str | None = None, search: str | None = None, tags: str | None = None, limit: int | None = None) -> SyncPaginator[Prompt]

List prompts with pagination and filters.

Parameters

  • type (str | None, optional): Filter by type (system-prompt, user-prompt, template).
  • search (str | None, optional): Search by name or description.
  • tags (str | None, optional): Comma-separated tags to filter by.
  • limit (int | None, optional): Maximum number of items to return (default: all matching items).

create​

create(*, name: <class 'str'>, content: <class 'str'>, type: <class 'str'> = "system-prompt", description: str | None = None, variables: collections.abc.Sequence[collections.abc.Mapping[str, Any]] | None = None, tags: collections.abc.Sequence[str] | None = None, source: str | None = None, files: collections.abc.Sequence[collections.abc.Mapping[str, Any]] | None = None, github_url: str | None = None, linked_ids: collections.abc.Sequence[str] | None = None) -> <class 'Prompt'>

Create a new prompt. Auto-detects {{variables}} and creates version 1.

Parameters

  • name (str): Prompt name (required).
  • content (str): Prompt content text (required).
  • type (str, optional): system-prompt | user-prompt | template.
  • description (str | None, optional): Prompt description.
  • variables (Sequence[Mapping[str, Any]] | None, optional): Template variables, each a plain dict with camelCase wire keys, e.g. [{"name": "topic", "defaultValue": "AI"}].
  • tags (Sequence[str] | None, optional): Discoverability tags.
  • source (str | None, optional): Provenance label.
  • files (Sequence[Mapping[str, Any]] | None, optional): Free-form supporting files.
  • github_url (str | None, optional): Source GitHub URL.
  • linked_ids (Sequence[str] | None, optional): Agents and pools (ids) the prompt belongs to.

Returns

  • Prompt: The created Prompt.

retrieve​

retrieve(prompt_id: <class 'str'>) -> <class 'Prompt'>

Get a prompt by ID with full content.

Parameters

  • prompt_id (str): The prompt ID.

update​

update(prompt_id: <class 'str'>, *, name: str | None = None, description: str | None = None, content: str | None = None, variables: collections.abc.Sequence[collections.abc.Mapping[str, Any]] | None = None, tags: collections.abc.Sequence[str] | None = None, linked_ids: collections.abc.Sequence[str] | None = None, change_note: str | None = None) -> dict[str, Any]

Update a prompt. Content changes auto-create a new version.

Parameters

  • prompt_id (str): The prompt ID.
  • name (str | None, optional): Updated name.
  • description (str | None, optional): Updated description.
  • content (str | None, optional): Updated content (triggers a version snapshot).
  • variables (Sequence[Mapping[str, Any]] | None, optional): Updated template variables.
  • tags (Sequence[str] | None, optional): Updated tags.
  • linked_ids (Sequence[str] | None, optional): Replace the agents and pools the prompt belongs to.
  • change_note (str | None, optional): Note about this change.

delete​

delete(prompt_id: <class 'str'>)

Delete a prompt and all its versions.

Parameters

  • prompt_id (str): The prompt ID.

Other​

duplicate​

duplicate(prompt_id: <class 'str'>) -> dict[str, Any]

Duplicate a prompt (creates a copy owned by the current user).

Parameters

  • prompt_id (str): The prompt ID to duplicate.

Returns

  • dict[str, Any]: Dict with new promptId.

list_versions​

list_versions(prompt_id: <class 'str'>) -> list[PromptVersion]

List all versions of a prompt, newest first.

Parameters

  • prompt_id (str): The prompt ID.

record_usage​

record_usage(prompt_id: <class 'str'>) -> <class 'int'>

Record that the prompt was used; return how many times it has been used.

Parameters

  • prompt_id (str): The prompt ID.

render​

render(prompt_id: <class 'str'>, variables: collections.abc.Mapping[str, str]) -> <class 'PromptRenderResult'>

Render a prompt with variable substitution.

Parameters

  • prompt_id (str): The prompt ID.
  • variables (Mapping[str, str]): Mapping of variable names to substitution values.

Returns

  • PromptRenderResult: PromptRenderResult with rendered content.
  • A variable left out takes its default value; leaving out one with no
  • default (a required variable) is refused with a validation error
  • naming it.

restore_version​

restore_version(prompt_id: <class 'str'>, version_number: <class 'int'>) -> <class 'Prompt'>

Restore a previous version (creates a new version with restored content).

Parameters

  • prompt_id (str): The prompt ID.
  • version_number (int): Version number to restore.
search(*, q: <class 'str'>, type: str | None = None, tags: str | None = None, limit: int | None = None) -> dict[str, Any]

Search the prompts you may use by meaning and by words, best match first.

Each result carries score, its fused rank score (it orders the results; it is not a percentage). tags is comma-separated: only prompts with every tag.