> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Images to Task Context

> Processing images and visual content in task context

Tasks can include image attachments for processing. The framework automatically handles image loading and provides them to the model for analysis.

## Single Image Attachment

```python theme={null}
from upsonic import Agent, Task

agent = Agent(model="anthropic/claude-sonnet-4-5")

# Task with single image
task = Task(
    description="Describe what you see in the attached image",
    context=["image.png"]
)

agent.print_do(task)
```

## Multiple Image Attachments

```python theme={null}
from upsonic import Agent, Task

agent = Agent(model="anthropic/claude-sonnet-4-5")

# Task with multiple images
task = Task(
    description="Compare the two attached images and identify similarities and differences",
    context=["image1.jpg", "image2.jpg"]
)

agent.print_do(task)
```

## Images with Other Context

```python theme={null}
from upsonic import Agent, Task

agent = Agent(model="anthropic/claude-sonnet-4-5")

# Task with images and other context
task = Task(
    description="Analyze the attached chart and provide insights based on the market data",
    context=["chart.png", market_data_task],
)

agent.print_do(task)
```

## Supported Image Formats

The framework supports various image formats including:

* PNG (.png)
* JPEG (.jpg, .jpeg)
* GIF (.gif)
* BMP (.bmp)
* TIFF (.tiff)

```python theme={null}
from upsonic import Agent, Task

agent = Agent(model="anthropic/claude-sonnet-4-5")

# Example with different image formats
task = Task(
    description="Analyze all the attached images",
    context=["photo.jpg", "diagram.png", "chart.tiff"]
)

agent.print_do(task)
```

## Best Practices

* **File Paths**: Use absolute or relative paths that are accessible to your application
* **Image Size**: Consider image file sizes for performance optimization
* **Format Selection**: Choose appropriate formats based on your analysis needs
* **Error Handling**: Handle cases where image files might not be accessible
* **Context Integration**: Combine images with relevant text context for better analysis
