Task Attachments

Example

Attach multiple file types to tasks for comprehensive analysis.

Quick Start

Clone the Complete Example

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

git clone https://github.com/astreus-ai/task-attachments
cd task-attachments
npm install

Or Install Package Only

If you prefer to build from scratch:

npm install @astreus-ai/astreus

Environment Setup

# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
DB_URL=sqlite://./astreus.db

Task with Multiple Attachments

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

const agent = await Agent.create({
  name: 'AnalysisAgent',
  model: 'gpt-4o',
  visionModel: 'gpt-4o',  // Specify vision model directly
  vision: true // Enable vision for images
});

// Code review task with multiple file types
const reviewTask = await agent.createTask({
  prompt: `Perform a comprehensive analysis:
    1. Review the code for security issues
    2. Check the design mockup for usability
    3. Verify dependencies are up to date
    4. Review documentation completeness`,
  attachments: [
    { 
      type: 'code', 
      path: '/src/auth/login.ts', 
      name: 'Login Controller',
      language: 'typescript' 
    },
    { 
      type: 'image', 
      path: '/designs/login-ui.png', 
      name: 'Login UI Mockup' 
    },
    { 
      type: 'json', 
      path: '/package.json', 
      name: 'Dependencies' 
    },
    { 
      type: 'markdown', 
      path: '/docs/api.md', 
      name: 'API Documentation' 
    }
  ],
  metadata: {
    type: 'comprehensive-review',
    priority: 'high'
  }
});

const result = await agent.executeTask(reviewTask.id);
console.log('Analysis complete:', result.response);

Running the Example

If you cloned the repository:

npm run dev

If you built from scratch, create an index.ts file with the code above and run:

npx tsx index.ts

Repository

The complete example is available on GitHub: astreus-ai/task-attachments

How is this guide?