# Release v0.0.4 - Audit Trail & Tool Agent Improvements

## 🎉 Overview

Version 0.0.4 introduces comprehensive audit trail capabilities and significant improvements to the tool agent for generating tool specifications from Astra DB tables.

## ✨ New Features

### Audit Trail System

- **Automatic Audit Logging**: Track all tool executions with detailed audit records stored in Astra DB
- **Audit Table Management**: Automatic creation and management of audit tables in Astra DB
- **Comprehensive Audit Data**: Capture tool executions with:
  - Tool ID and run ID (UUID-based)
  - Client identification
  - Start and end timestamps
  - Execution parameters and results
  - Error tracking and status information
  - Status codes and detailed messages
- **Configurable Audit**: Enable audit trail via `--audit` flag or `ASTRA_DB_AUDIT_TABLE_NAME` environment variable
- **Partitioned Storage**: Audit tables use efficient partitioning by tool ID and date for optimal query performance

### Enhanced Tool Agent

- **Improved Tool Specification Generation**: Enhanced AI-powered tool specification generation from table schemas
- **Better Prompt Engineering**: New customizable prompt system for tool generation (`tool_agent_prompt.py`)
- **Additional Instructions Support**: Pass custom instructions to guide tool specification generation
- **Prompt Export**: Export and customize the prompts used for tool generation
- **Enhanced Schema Analysis**: Better understanding of partition keys, sorting keys, and indexed columns
- **Smart Parameter Generation**: Automatic generation of date range and numeric range parameters for indexed columns

## 🔧 Improvements

- **Database Layer Enhancements**: Improved database operations with better error handling and logging
- **Tool Execution Middleware**: Enhanced middleware for tracking tool execution lifecycle
- **Logging System**: Improved logging with better context and structured information
- **Documentation Updates**: Comprehensive README updates with new features and usage examples

## 📦 New Examples

- **Airline Tool Example**: New example tool specification generated by the tool agent (`examples/tools/airline_tool_by_agent.json`)
- **Tool Agent Prompt Template**: Example prompt file for tool specification generation (`examples/prompts/tool_agent_prompt.md`)
- **Organized Examples**: Better organization of example tools and configurations

## 🛠️ Technical Changes

- Added `audit.py` module for audit table definitions
- Enhanced `database.py` with audit trail setup and logging methods
- Improved `run_tool.py` middleware with audit integration
- Enhanced `tool_agent.py` with better prompt handling and instructions
- New `tool_agent_prompt.py` module for prompt management
- Updated logger configuration and utilities

## 📋 Configuration

To enable audit trail, set the following environment variable:
```bash
ASTRA_DB_AUDIT_TABLE_NAME=mcp_audit_trail
```

Or use the command-line flag:
```bash
uvx agentic-astra --audit
```

## 🔄 Migration Notes

- Audit trail is **opt-in** - existing deployments continue to work without changes
- When audit is enabled, the audit table is automatically created on first use
- No breaking changes to existing APIs or tool configurations

## 📚 Documentation

- Updated README with audit trail configuration details
- Added IBM Orchestrate integration guide (`Orchestrate_Integration.md`)
- Enhanced BUILD.md with release workflow documentation

## 🐛 Bug Fixes

- Improved error handling in tool execution
- Better validation of tool parameters
- Enhanced logging for debugging

---

**Full Changelog**: [v0.0.3...v0.0.4](https://github.com/smatiolids/agentic-astra/compare/v0.0.3...v0.0.4)

