Skip to main content
An autonomous agent built with Upsonic’s AutonomousAgent that reads raw shipment data, decides which KPIs matter, writes a structured report, and produces matplotlib charts. The agent runs two tasks in sequence (analyst then visualizer) with all behavior defined in AGENTS.md, not in code.

Overview

The setup has two parts:
  1. AutonomousAgent with a workspace directory, no custom tools, no system prompt
  2. Two Task objects sent sequentially to the same agent
The agent uses its built-in tools (read/write files, run_python) to explore data, compute metrics, write a report, and generate charts autonomously.

Project Structure

After running, the workspace will also contain:

Environment Variables

Installation

Usage

The agent will:
  1. Read the shipment CSV (80 rows of delivery records)
  2. Compute KPIs: on-time rate, carrier performance, route delays, cost efficiency
  3. Write workspace/KPI_REPORT.md with tables, breakdowns, and commentary
  4. Generate one chart per metric and save them to workspace/charts/

How It Works

Flow

  1. Agent reads AGENTS.md and SOUL.md from the workspace on startup
  2. Task 1: Agent reads shipment_data.csv, decides which metrics matter, computes them, and writes KPI_REPORT.md
  3. Task 2: Agent reads the report, writes matplotlib code, executes it via run_python, and saves charts to charts/
  4. Agent logs the session in memory/

Complete Implementation

main.py

No system prompt, no custom tools. The agent reads everything from its workspace and uses run_python to execute generated code.

Workspace: AGENTS.md

The key to this example. Instead of hardcoding analysis steps in Python, the agent reads its instructions from AGENTS.md:
  • Two-task pipeline: Task 1 analyzes data and writes a report, Task 2 reads the report and produces charts
  • Memory: Daily logs in memory/YYYY-MM-DD.md for continuity between tasks and sessions
  • Workspace layout: Which files are inputs, which are outputs, who owns what
  • Rules: Never delete source data, no exfiltration, trash over rm
  • Tools: Task 2 writes its own visualization script from scratch based on what Task 1 found
Change the task descriptions or edit AGENTS.md to analyze different metrics. The agent adapts without touching code.

Sample Data

The included shipment_data.csv contains 80 shipment records with:
  • 3 Carriers: FastCargo (reliable), SpeedLine (mixed), EcoShip (cheap but slow on long routes)
  • 8 Destinations: Western cities are fast, eastern cities (Erzurum, Diyarbakir, Trabzon) have delays
  • 4 Categories: Electronics, Furniture, Food & Beverage, Clothing
  • Date range: Jan-Mar 2025
Swap it with your own data to analyze different operations.

Repository

View the full example: Operations Analyst