Documentation Index Fetch the complete documentation index at: https://docs.lyzr.ai/llms.txt
Use this file to discover all available pages before exploring further.
Enable agents to generate files (PDFs, DOCX, CSV) and images during conversations. Outputs are returned as downloadable artifacts.
Quick Start
from lyzr import Studio
from lyzr.image_models import Gemini, DallE
studio = Studio( api_key = "your-api-key" )
# File generation
file_agent = studio.create_agent(
name = "Report Generator" ,
provider = "gpt-4o" ,
role = "Report creator" ,
goal = "Generate professional reports" ,
file_output = True # Enable file generation
)
response = file_agent.run( "Create a Q4 sales report in PDF format" )
if response.has_files():
for file in response.files:
print ( f "Generated: { file .name } ( { file .format_type } )" )
file .download( "./reports/q4_sales.pdf" )
# Image generation
image_agent = studio.create_agent(
name = "Image Creator" ,
provider = "gpt-4o" ,
role = "Visual designer" ,
goal = "Create images" ,
image_model = Gemini. PRO # Enable image generation
)
response = image_agent.run( "Create an image of a futuristic cityscape" )
if response.has_files():
for img in response.files:
print ( f "Image: { img.url } " )
img.download( "./images/city.png" )
File Output
Enable agents to generate documents like PDFs, DOCX, CSV, and more.
Enable File Output
agent = studio.create_agent(
name = "Doc Generator" ,
provider = "gpt-4o" ,
role = "Document creator" ,
file_output = True # Enable file generation
)
Supported File Types
Format Description Use Cases PDF Portable Document Reports, invoices, certificates DOCX Word Document Editable documents, proposals CSV Comma-Separated Data exports, spreadsheets XLSX Excel Structured data, analytics PPT/PPTX PowerPoint Presentations, slides TXT Plain Text Simple text files
Example
agent = studio.create_agent(
name = "Invoice Generator" ,
provider = "gpt-4o" ,
role = "Financial document creator" ,
goal = "Generate professional invoices" ,
instructions = "Create detailed invoices with line items, totals, and payment terms" ,
file_output = True
)
response = agent.run( """
Create an invoice for:
- Client: Acme Corp
- Items:
- Web Development: $5,000
- Hosting (1 year): $500
- Payment terms: Net 30
""" )
if response.has_files():
invoice = response.files[ 0 ]
print ( f "Invoice created: { invoice.name } " )
invoice.download( "./invoices/acme_invoice.pdf" )
Image Output
Enable agents to generate images using Google Gemini or OpenAI DALL-E.
Image Models
from lyzr.image_models import Gemini, DallE
# Google Gemini models
Gemini. PRO # gemini/gemini-3-pro-image-preview
Gemini. FLASH # gemini/gemini-2.5-flash-image
# OpenAI DALL-E models
DallE. DALL_E_3 # dall-e-3
DallE. DALL_E_2 # dall-e-2
DallE. GPT_IMAGE_1 # gpt-image-1
DallE. GPT_IMAGE_1_5 # gpt-image-1.5
Enable Image Generation
from lyzr.image_models import Gemini
agent = studio.create_agent(
name = "Image Creator" ,
provider = "gpt-4o" ,
role = "Visual designer" ,
image_model = Gemini. PRO # Enable image generation
)
Example
from lyzr.image_models import DallE
agent = studio.create_agent(
name = "Art Generator" ,
provider = "gpt-4o" ,
role = "Digital artist" ,
goal = "Create beautiful images" ,
instructions = "Generate high-quality images based on descriptions" ,
image_model = DallE. DALL_E_3
)
response = agent.run( "Create an abstract painting with vibrant sunset colors" )
if response.has_files():
for img in response.files:
print ( f "Image URL: { img.url } " )
img.download( "./art/sunset.png" )
Combined File & Image Output
Enable both file and image generation in the same agent.
from lyzr.image_models import Gemini
agent = studio.create_agent(
name = "Content Creator" ,
provider = "gpt-4o" ,
role = "Marketing content creator" ,
goal = "Create documents with images" ,
instructions = "Generate brochures, presentations, and marketing materials" ,
file_output = True , # Enable file generation
image_model = Gemini. FLASH # Enable image generation
)
response = agent.run( "Create a product brochure for our new smartphone with product images" )
if response.has_files():
for artifact in response.files:
print ( f " { artifact.format_type.upper() } : { artifact.name } " )
if artifact.format_type == "pdf" :
artifact.download( "./brochures/smartphone.pdf" )
elif artifact.format_type == "image" :
artifact.download( "./images/smartphone.png" )
Artifact Class
Generated files are returned as Artifact objects.
Properties
Property Type Description namestr File name urlstr Download URL format_typestr File format (pdf, docx, image, etc.) artifact_idstr Unique artifact identifier
Methods
download()
artifact.download(save_path: str )
Download the artifact to a local file.
# Download to specific path
artifact.download( "./output/report.pdf" )
# Download with original name
artifact.download( f "./output/ { artifact.name } " )
Working with Artifacts
Check for Files
response = agent.run( "Generate a report" )
# Using method
if response.has_files():
print ( f "Files generated: { len (response.files) } " )
# Using property
for file in response.files:
print ( file .name)
Filter by Type
response = agent.run( "Create documents and images" )
# Get all files
all_files = response.files
# Filter PDFs
pdfs = [f for f in response.files if f.format_type == "pdf" ]
# Filter images
images = [f for f in response.files if f.format_type == "image" ]
Batch Download
import os
response = agent.run( "Create multiple reports" )
output_dir = "./outputs"
os.makedirs(output_dir, exist_ok = True )
for artifact in response.files:
save_path = os.path.join(output_dir, artifact.name)
artifact.download(save_path)
print ( f "Downloaded: { save_path } " )
Use Cases
Report Generation
report_agent = studio.create_agent(
name = "Report Generator" ,
provider = "gpt-4o" ,
role = "Business analyst" ,
goal = "Create comprehensive reports" ,
file_output = True
)
response = report_agent.run( """
Generate a quarterly sales report including:
- Executive summary
- Sales by region
- Top performing products
- Recommendations
Format: PDF
""" )
Invoice Creation
invoice_agent = studio.create_agent(
name = "Invoice Creator" ,
provider = "gpt-4o" ,
role = "Accounting assistant" ,
goal = "Generate professional invoices" ,
file_output = True
)
response = invoice_agent.run( """
Create invoice #2024-001 for:
Client: Tech Solutions Inc.
Services rendered:
- Consulting: 40 hours @ $150/hr
- Implementation: 20 hours @ $200/hr
Due date: 30 days
""" )
Marketing Materials
from lyzr.image_models import DallE
marketing_agent = studio.create_agent(
name = "Marketing Creator" ,
provider = "gpt-4o" ,
role = "Marketing specialist" ,
file_output = True ,
image_model = DallE. DALL_E_3
)
response = marketing_agent.run( """
Create a product launch announcement with:
1. A PDF brochure highlighting features
2. A hero image for the website
3. Social media graphics
""" )
Next Steps
File Generation Detailed guide to file generation
Image Generation Detailed guide to image generation