An open API service indexing awesome lists of open source software.

https://github.com/sppdd/forms-agent

google forms automation agent kit.
https://github.com/sppdd/forms-agent

Last synced: 11 months ago
JSON representation

google forms automation agent kit.

Awesome Lists containing this project

README

          

# Google Forms Agent Pipeline

A comprehensive Google Forms management system built with Google ADK (Agent Development Kit) that can create, edit, validate, and manage Google Forms from documents or direct input.

## ๐Ÿš€ Features

- **Document Processing**: Parse PDF, DOCX, TXT, and MD files to extract form questions
- **Form Creation**: Create Google Forms with intelligent auto-completion
- **Form Editing**: Edit existing forms with batch operations
- **Form Validation**: Validate form structures and auto-fix issues
- **Service Account Integration**: Secure Google Forms API authentication
- **Pipeline Architecture**: Modular subagent system for specialized tasks
- **ADK Callback Optimizations**: Performance, caching, and monitoring capabilities

## ๐Ÿ“ Project Structure

```
forms_agent/
โ”œโ”€โ”€ forms_agent/ # Main agent package
โ”‚ โ”œโ”€โ”€ agent.py # Root agent with subagent tools
โ”‚ โ”œโ”€โ”€ service_account.json # Google service account credentials
โ”‚ โ””โ”€โ”€ subagents/ # Specialized subagents
โ”‚ โ”œโ”€โ”€ document_parser/ # Document parsing and extraction
โ”‚ โ”œโ”€โ”€ form_creator/ # Form creation and configuration
โ”‚ โ”œโ”€โ”€ form_editor/ # Form editing and management
โ”‚ โ””โ”€โ”€ form_validator/ # Form validation and quality control
โ”œโ”€โ”€ google_forms_api.py # Standalone Google Forms API client
โ”œโ”€โ”€ google_forms_tool.py # Google ADK tool wrappers
โ”œโ”€โ”€ google_forms_agent.py # Google ADK agent implementation
โ”œโ”€โ”€ requirements.txt # Python dependencies
โ””โ”€โ”€ README.md # This file
```

## ๐Ÿ› ๏ธ Installation

1. **Clone the repository**:
```bash
git clone
cd forms_agent
```

2. **Install dependencies**:
```bash
pip install -r requirements.txt
```

3. **Set up Google Service Account**:
- Create a Google Cloud Project
- Enable Google Forms API
- Create a service account
- Download the JSON credentials file as `service_account.json`
- Place it in the `forms_agent/` directory

4. **Configure environment**:
```bash
# Set your Google API key (optional, for additional features)
export GOOGLE_API_KEY="your-api-key-here"
```

## ๐ŸŽฏ Quick Start

### Using the Standalone API

```python
from google_forms_api import GoogleFormsAPI

# Initialize the API
api = GoogleFormsAPI()

# Create a form
result = api.create_form(
title="My Test Form",
description="A test form created with the API"
)

if result["result"] == "success":
form_id = result["form_id"]
print(f"Form created: {result['form_url']}")
```

### Using the ADK Agent

```python
from forms_agent.agent import root_agent

# The agent is ready to use in your ADK workflows
# It provides comprehensive form management capabilities
```

### Testing the Pipeline

```bash
# Test the service account
python simple_test.py

# Test the subagents
python test_subagents.py

# Test the standalone forms API
python test_standalone_forms.py
```

## ๐Ÿ”ง Usage Examples

### 1. Create a Form from Document

```python
# The agent can parse documents and create forms automatically
# Upload a document and the agent will:
# 1. Parse the document content
# 2. Extract questions and structure
# 3. Create a Google Form
# 4. Add questions and configure settings
```

### 2. Edit Existing Forms

```python
# The agent can edit existing forms:
# - Update titles and descriptions
# - Add, modify, or delete questions
# - Configure form settings
# - Retrieve form responses
```

### 3. Validate Form Structure

```python
# The agent can validate forms:
# - Check question types and compatibility
# - Suggest improvements
# - Auto-fix common issues
# - Ensure Google Forms API compliance
```

## ๐Ÿ—๏ธ Architecture

### Subagent System

The project uses a modular subagent architecture:

- **Document Parser Agent**: Handles document processing and content extraction
- **Form Creator Agent**: Manages form creation and initial configuration
- **Form Editor Agent**: Handles form editing and updates
- **Form Validator Agent**: Validates form structure and quality

### Service Account Integration

The system uses Google service account authentication for secure API access:

- Automatic authentication handling
- Secure credential management
- API rate limiting and error handling
- Session state management

### ADK Callback Optimizations

The system includes comprehensive callback optimizations:

- **Caching**: Automatic caching of LLM responses and tool results
- **Validation**: Enhanced input validation and error recovery
- **Monitoring**: Comprehensive performance monitoring and logging
- **Safety**: Content filtering and guardrails
- **Performance**: Optimized API calls and batch processing

## ๐Ÿ“Š Performance Features

- **Caching**: 50-80% faster response times through intelligent caching
- **Rate Limiting**: Prevents API overload and ensures reliable operation
- **Error Recovery**: Automatic retry logic and graceful error handling
- **Monitoring**: Real-time performance tracking and analytics
- **Validation**: Input validation and data quality checks

## ๐Ÿ”’ Security

- **Service Account Authentication**: Secure Google API access
- **Content Filtering**: Protection against sensitive data processing
- **Input Validation**: Comprehensive input sanitization
- **Error Handling**: Secure error messages without data leakage
- **Rate Limiting**: Protection against API abuse

## ๐Ÿงช Testing

The project includes comprehensive test suites:

- **Unit Tests**: Individual component testing
- **Integration Tests**: End-to-end workflow testing
- **Performance Tests**: Caching and optimization validation
- **Security Tests**: Authentication and validation testing

Run tests with:
```bash
python test_subagents.py
python test_standalone_forms.py
python simple_test.py
```

## ๐Ÿ“ˆ Monitoring and Analytics

The system provides comprehensive monitoring:

- **Performance Metrics**: Response times and throughput
- **Cache Analytics**: Hit rates and optimization effectiveness
- **Error Tracking**: Error patterns and resolution
- **API Usage**: Call frequency and optimization opportunities

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request

## ๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

## ๐Ÿ†˜ Support

For support and questions:

1. Check the documentation in the `README_standalone_forms.md` file
2. Review the optimization guide in `ADK_CALLBACK_OPTIMIZATION_GUIDE.md`
3. Test the examples in the test files
4. Check the Google ADK documentation for callback usage

## ๐Ÿš€ Roadmap

- [ ] Enhanced caching strategies
- [ ] Advanced form templates
- [ ] Batch form operations
- [ ] Real-time collaboration features
- [ ] Advanced analytics dashboard
- [ ] Multi-language support
- [ ] Mobile optimization
- [ ] Advanced security features

---

**Built with Google ADK and Google Forms API**