kestrel-feature-visual
Visual identity for Kestrel Sovereign agents — avatar generation, selfies, and LoRA training for character consistency. Uses Replicate for image generation with optional LoRA training for consistent visual identity across generated images.
Installation
uv pip install kestrel-feature-visual
The feature is auto-discovered by Kestrel Sovereign via the kestrel_sovereign.features entry point — install it alongside kestrel-sovereign and the VisualIdentityFeature registers itself at startup.
Configuration
| Variable | Description |
|---|---|
REPLICATE_API_TOKEN |
Replicate API token for image generation (required for avatar/selfie tools) |
Tools provided
generate_avatar— Create a portrait avatar from a descriptiongenerate_selfie— Generate a selfie in various scenes (casual, portrait, glamour, flirty, cozy, adventure, mysterious, romantic, playful, dreamy, confident)train_lora— Kick off LoRA training for character consistency (requireskestrel-feature-loraor another training provider installed alongside)
Canonical LoRA selfie specification
Queue-backed providers must use resolve_lora_selfie_spec() when a selfie is
quoted and bind_lora_selfie_spec() immediately before dispatch. Both paths
produce the same content-free spec_sha256 over the final prompt hash,
generation parameters, and immutable promoted-LoRA identity. The plaintext
prompt remains transient and is never part of the persisted evidence object.
scene and style are caller-owned. This package normalizes them (whitespace
collapsed, lowercased) and bounds their length, but never rejects one for failing to
appear in its own tables — frinz forwards both unvalidated from an HTTP body and from
LLM tool arguments, and deliberately supports free-form prose scenes such as
stargazing at night with aurora borealis.
SELFIE_SCENE_PROMPTS and the style prefixes therefore govern only the descriptive
prompt text: an unrecognized scene contributes no description rather than silently
rendering as casual, and an unrecognized style adds no prefix. The scene reads the
same on the resolved prompt, the generation config, the returned result, and
spec_sha256, so two different scenes can never share a digest.
An absent scene or style — None, "", or whitespace — means "use the default"
(casual / photorealistic), not "fail". frinz forwards style completely raw from
both an unvalidated body field and an LLM tool argument.
On the no-LoRA reference route, when there is neither a custom prompt nor a known
scene description this package sends no prompt override, so the catalog worker's
own scene template is used instead of a subjectless stub. Otherwise the route uses
prompt_without_trigger(), which derives the trigger-free text from the resolved
prompt itself — rebuilding it in the caller silently dropped the style prefix.
The public ResolvedSelfiePrompt object carries the exact values that must be
sent to the image worker, including seed, dimensions, inference steps, and
guidance scale. Providers must reject a reconstructed digest that differs from
the accepted quote.
The object re-validates its own invariants on construction, not only inside
resolve_selfie_prompt(), because downstream consumers treat the type itself
as the trust boundary. It therefore carries the plaintext trigger_word
alongside trigger_word_sha256 and verifies that the digest matches the
trigger and that prompt binds that trigger exactly once as a whole token.
A directly constructed instance attesting a trigger the prompt never binds — or
binds twice — is rejected, so a valid spec_sha256 can never describe a prompt
that does not match it. Carrying the trigger in plaintext discloses nothing
further: it is already contained verbatim in prompt.
Dependencies
kestrel-sovereign-sdk>=0.25.0,<1— baseFeature,tool, andToolCategoryinterfacesreplicate>=1.0.4— Replicate API clienthttpx>=0.27.0— HTTP transport
Development
uv pip install -e '.[test]'
uv run pytest
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kestrel_feature_visual-0.4.0.tar.gz.
File metadata
- Download URL: kestrel_feature_visual-0.4.0.tar.gz
- Upload date:
- Size: 48.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a08f7cbdb5effa0f6bd8d68aa824bbbe03468361d7e83df5df7c22e112d48cd0
|
|
| MD5 |
48530b8b4faedfa07183daedbcd6592c
|
|
| BLAKE2b-256 |
b84d4b709d7c0299367f5f75bf7810e64b5835648f04735071b34dca898466be
|
Provenance
The following attestation bundles were made for kestrel_feature_visual-0.4.0.tar.gz:
Publisher:
publish.yml on KestrelSovereignAI/kestrel-feature-visual
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrel_feature_visual-0.4.0.tar.gz -
Subject digest:
a08f7cbdb5effa0f6bd8d68aa824bbbe03468361d7e83df5df7c22e112d48cd0 - Sigstore transparency entry: 2340489536
- Sigstore integration time:
-
Permalink:
KestrelSovereignAI/kestrel-feature-visual@b2bcb5e3dff63cff7d1d89891b1809513c27eea2 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/KestrelSovereignAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2bcb5e3dff63cff7d1d89891b1809513c27eea2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kestrel_feature_visual-0.4.0-py3-none-any.whl.
File metadata
- Download URL: kestrel_feature_visual-0.4.0-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7de99a8f66deaa006db8f638d53cc90ae930b004964b8e4720bc079d61a5b6b
|
|
| MD5 |
a450cff1d98f45808412963056460cf3
|
|
| BLAKE2b-256 |
545c1a383adeaf77fcbbf2fde2479dad957cd6b768ec61423ae3a218e6c62b2a
|
Provenance
The following attestation bundles were made for kestrel_feature_visual-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on KestrelSovereignAI/kestrel-feature-visual
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrel_feature_visual-0.4.0-py3-none-any.whl -
Subject digest:
c7de99a8f66deaa006db8f638d53cc90ae930b004964b8e4720bc079d61a5b6b - Sigstore transparency entry: 2340489560
- Sigstore integration time:
-
Permalink:
KestrelSovereignAI/kestrel-feature-visual@b2bcb5e3dff63cff7d1d89891b1809513c27eea2 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/KestrelSovereignAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2bcb5e3dff63cff7d1d89891b1809513c27eea2 -
Trigger Event:
push
-
Statement type: