Skip to content

[FEATURE] CreateAvatar tool: let the agent build an avatar from a photo #1271

Closed
inference-gateway/docs
#733

Description

@edenreich

Summary

Add a CreateAvatar agent tool, a thin wrapper over avatars.Create, the same code behind infer avatars create (#1270). The agent could then build an avatar mid-conversation. The command can't cover three flows:

  • Generated portraits. "Make a presenter avatar, then have them say this line" in one run. Portraits from ImageGeneration/ImageEdit land in the project's artifacts dir. TextToVideo does not look there, and the agent cannot move files into ~/.infer/avatars.
  • Channels. A user sends a selfie over Telegram ("make this my avatar"); there is no terminal to run the command.
  • Desktop Content projects. The project agent creates the avatar as a step of the video workflow, not only from the Settings page ([FEATURE] Avatars: record once, reuse a talking avatar in Content projects desktop#311).

Blocked by #1270 (avatar library, avatars.Create, infer avatars create).

Design

CreateAvatar { name: "presenter", photo: "portrait.png",
               angles?: ["three-quarter-left", "three-quarter-right"],
               quality?: "high", size?: "1024x1536" }
-> { name, images: ["01-front.png", "02-three-quarter-left.png", "03-three-quarter-right.png"] }
  • Opt-in, stricter than TextToVideo. The tool can turn any face it sees into an avatar and sends the photo to the image-edit provider (OpenAI by default). So:
    • It has its own switch, text_to_video.create_avatar (default false). The tool is registered only when that and text_to_video.enabled are both true.
    • IsApprovalRequired("CreateAvatar") defaults to true unless require_approval is set explicitly.
  • Photo confinement. photo is a bare file name, resolved in the working directory (sandbox-checked via ValidatePathInSandbox) and then in the current project's artifacts dir, where generated images land. There are no absolute paths, no .. and no arbitrary locations: unlike the ImageEdit tool, it never reads a file outside those two places. Only .png, .jpg, .jpeg and .webp.
  • Create only. It never overwrites (avatars.Create already refuses an existing name), and there is no delete tool; deleting stays a user action (infer avatars delete). Listing needs no tool: TextToVideo already answers an unknown avatar with the available names.
  • Same knobs as the command. angles defaults to both three-quarter views, and [] only copies the photo. quality defaults to high and size to 1024x1536. The model is tools.image_edit.model, and the tool fails clearly when image edit is disabled.
  • Wiring.
    • The tool lives in internal/agent/tools/create_avatar.go, takes agentdomain.ImageService (already wired for ImageEdit) and passes an avatars.EditFunc over EditImage.
    • It is registered in registry.go and gets a prompt in config/prompts.go.
    • The gateway manager already sets IMAGES_ENABLED while tools.image_edit.enabled is on.
  • Result formatting. The result lists the saved images so the agent can go straight to TextToVideo { avatar: "presenter", audio: ... }.

Out of scope

Deleting or overwriting avatars from the agent, editing an existing avatar's images, and sending the extra views as reference images (inference-gateway/schemas#221).

Acceptance Criteria

  • CreateAvatar is registered only when text_to_video.enabled and text_to_video.create_avatar are both true, and requires approval by default.
  • photo resolves only in the working directory (sandbox-checked) or the project artifacts dir; absolute paths, .., directories and unsupported extensions are rejected in Validate.
  • An existing avatar name fails without calling the image-edit service, and a failed angle leaves no avatar folder (covered by avatars.Create).
  • angles, quality and size are validated against the same sets as infer avatars create, with the same defaults.
  • Unit tests use the counterfeiter FakeImageService; registry gating and approval-default tests are included.
  • docs/tools-reference.md and docs/text-to-video.md document the tool, the opt-in and the privacy note, and a [DOCS] ticket is filed for inference-gateway/docs.

Activity

  1. added
    enhancement
    on Sep 22, 2026
  2. moved this to Todo in 2026on Sep 22, 2026
  3. moved this from Todo to In progress in 2026on Sep 23, 2026
  4. moved this from In progress to Done in 2026on Sep 23, 2026
  5. added a commit that references this issue on Sep 23, 2026
    bcadcbc
  6. inference-gateway-releaser commented on Sep 23, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.206.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions