Agent with Vision

Create agents capable of processing and analyzing images.

Quick Start#

Clone the Complete Example#

The easiest way to get started is to clone the complete example repository:

bash
git clone https://github.com/astreus-ai/examples
cd examples/agent-with-vision
npm install

Or Install Package Only#

If you prefer to build from scratch:

bash
npm install @astreus-ai/astreus

Environment Setup#

bash
# .env
# Vision-capable model API key
OPENAI_API_KEY=sk-your-openai-api-key-here

# Database for agent persistence
DB_URL=sqlite://./astreus.db

Vision Agent#

typescript
import { Agent } from '@astreus-ai/astreus';

const agent = await Agent.create({
  name: 'VisionBot',
  model: 'gpt-4o',
  visionModel: 'gpt-4o',
  vision: true,
  systemPrompt: 'You can analyze and describe images in detail.'
});

// Analyze an image
const result = await agent.ask("Analyze this image and describe what you see", {
  attachments: [{
    type: 'image',
    path: './screenshot.png'
  }]
});

console.log(result); // Detailed image analysis

Running the Example#

If you cloned the repository:

bash
npm run dev

Repository#

The complete example is available on GitHub: examples/agent-with-vision