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 inDocumentation Index
Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
Use this file to discover all available pages before exploring further.
AGENTS.md, not in code.
Overview
The setup has two parts:- AutonomousAgent with a workspace directory, no custom tools, no system prompt
- Two Task objects sent sequentially to the same agent
run_python) to explore data, compute metrics, write a report, and generate charts autonomously.
Project Structure
Environment Variables
Installation
Usage
- Read the shipment CSV (80 rows of delivery records)
- Compute KPIs: on-time rate, carrier performance, route delays, cost efficiency
- Write
workspace/KPI_REPORT.mdwith tables, breakdowns, and commentary - Generate one chart per metric and save them to
workspace/charts/
How It Works
| Component | Role |
|---|---|
| AutonomousAgent | Reads workspace files, runs Python, manages all logic |
| Task 1 (Analyst) | Reads CSV β computes KPIs β writes KPI_REPORT.md |
| Task 2 (Visualizer) | Reads report β runs matplotlib via run_python β saves PNGs |
| AGENTS.md | Task definitions, workspace layout, memory rules, safety rules |
| SOUL.md | Agent identity and analysis style |
Flow
- Agent reads
AGENTS.mdandSOUL.mdfrom the workspace on startup - Task 1: Agent reads
shipment_data.csv, decides which metrics matter, computes them, and writesKPI_REPORT.md - Task 2: Agent reads the report, writes matplotlib code, executes it via
run_python, and saves charts tocharts/ - Agent logs the session in
memory/
Complete Implementation
main.py
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 fromAGENTS.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.mdfor continuity between tasks and sessions - Workspace layout: Which files are inputs, which are outputs, who owns what
- Rules: Never delete source data, no exfiltration,
trashoverrm - Tools: Task 2 writes its own visualization script from scratch based on what Task 1 found
AGENTS.md to analyze different metrics. The agent adapts without touching code.
Sample Data
The includedshipment_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

