Image studio
This example expands a prompt into typed instructions, then calls an image provider. Prepare the SDK and CLI from the repository root:
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
create_prompt | traversal | (topic: str) -> dict | examples/python/image_studio/agent.py | |
generate_artwork | traversal | (topic: str, size: str = '1024x1024', model: str | None = None) -> dict | examples/python/image_studio/agent.py | |
generate_image | traversal | (prompt: str, size: str = '1024x1024', model: str | None = None) -> dict | examples/python/image_studio/agent.py |
Commands
atfg server start
atfg traverse image-studio.generate_artwork --in '{"topic":"An amber compass beside a travel journal","size":"1024x1024"}'
cargo build --bin atfgraphd --bin atfg
python -m atfgraph.worker --module examples.python.image_studio.agent:app
python -m examples.python.image_studio.call create_prompt '{"topic":"A quiet Bali beach at dawn"}'
python -m pip install -e ./python
Files
examples/python/image_studio/README.mdexamples/python/image_studio/__init__.pyexamples/python/image_studio/agent.pyexamples/python/image_studio/agentnode.yamlexamples/python/image_studio/call.pyexamples/python/image_studio/requirements.txt
README
This example expands a prompt into typed instructions, then calls an image provider. Prepare the SDK and CLI from the repository root:
python -m pip install -e ./python
cargo build --bin atfgraphd --bin atfg
export PATH="$PWD/target/debug:$PATH"
atfg server start
The default server is http://127.0.0.1:18880, with its Console at /ui/. Set server URL/key variables when connecting elsewhere.
Configure the prompt-expansion model through ATFGRAPH_MODEL_URL, ATFGRAPH_MODEL_NAME and its key. Set IMAGE_MODEL and the image provider's credential, such as OPENAI_API_KEY. Running the generation path can incur both chat and image charges.
python -m atfgraph.worker --module examples.python.image_studio.agent:app
# Another terminal:
atfg traverse image-studio.generate_artwork --in '{"topic":"An amber compass beside a travel journal","size":"1024x1024"}'
python -m examples.python.image_studio.call create_prompt '{"topic":"A quiet Bali beach at dawn"}'
Inspect two child steps: prompt expansion and image creation. The result includes the prompt, style notes, selected model, output URLs and any saved inline-image paths. ATFGRAPH_MEDIA_DIR chooses worker-local storage, defaulting to /tmp/atfgraph-image-studio. URL outputs are not downloaded automatically, and saved paths refer to the worker host. Select a supported model/size. Generation requires live provider access; errors do not produce fake artwork.