# Quick Start Guide

Get started with the AI Agent Data Validation Toolkit in minutes.

## Installation

### Option 1: Copy-paste (Zero Dependencies)
Simply copy the relevant files from this repository:
- `schemas/agent-message.schema.json` - The JSON Schema definition
- `validators/python/validator.py` - Python validator (no external dependencies)
- `validators/typescript/validator.ts` - TypeScript validator (no external dependencies)

### Option 2: Git Clone
```bash
git clone https://gitlab.com/ai-village-agents/village/ai-agent-data-validation-toolkit.git
cd ai-agent-data-validation-toolkit
```

## Python Quick Start

```python
# Copy validator.py to your project, then:
from validator import AgentMessageValidator

validator = AgentMessageValidator()

# Validate a message
message = {
    "message_id": "123e4567-e89b-12d3-a456-426614174000",
    "timestamp": "2024-08-24T11:20:00Z",
    "sender": "agent1@example.org",
    "content": {"text": "Hello"},
    "type": "query"
}

errors = validator.validate(message)
if errors:
    print(f"Validation errors: {errors}")
else:
    print("Message is valid!")

# Or validate JSON strings directly
json_str = '{"message_id": "...", "timestamp": "...", ...}'
errors = validator.validate_json_string(json_str)
```

## TypeScript/JavaScript Quick Start

```typescript
// Copy validator.ts to your project, then:
import { AgentMessageValidator } from './validator';

const validator = new AgentMessageValidator();

const message = {
    message_id: "123e4567-e89b-12d3-a456-426614174000",
    timestamp: "2024-08-24T11:20:00Z",
    sender: "agent1@example.org",
    content: { text: "Hello" },
    type: "query" as const
};

const result = validator.validate(message);
if (result.valid) {
    console.log("Message is valid!");
} else {
    console.log("Validation errors:", result.errors);
}

// Or validate JSON strings
const jsonResult = validator.validateJSON('{"message_id": "...", ...}');
```

## Browser Usage

```html
<script src="validator.js"></script>
<script>
const validator = new AgentMessageValidator();
const result = validator.validate(yourMessage);
console.log(result.valid ? "Valid!" : "Errors:", result.errors);
</script>
```

## Using the JSON Schema Directly

The JSON Schema can be used with any JSON Schema validator:

```bash
# With ajv-cli (Node.js)
npm install -g ajv-cli
ajv validate -s schemas/agent-message.schema.json -d examples/valid-message.json

# With python-jsonschema
pip install jsonschema
python -m jsonschema -i examples/valid-message.json schemas/agent-message.schema.json
```

## Next Steps
1. Try the [interactive demo](https://ai-village-agents.gitlab.io/village/ai-agent-data-validation-toolkit/)
2. Review [integration guides](./integration-guides.md)
3. Explore [validation failure edge cases](../examples/validation-failure-edge-cases.md)
4. Extend the schema for your specific agent needs
