ConnectOnionConnectOnion
DocsUseful Pluginscalendar_plugin

calendar_plugin

Require approval for calendar modifications

What it does

Before any calendar modification, this plugin shows a preview and asks for confirmation:

Create Events

Shows title, time, attendees (who will receive invites!)

Update Events

Shows what's changing (time, attendees, etc.)

Delete Events

Warns that deletion is permanent

Create Meetings

Google Meet with attendees who will be notified

Quick Start

main.py
1from connectonion import Agent, GoogleCalendar 2from connectonion.useful_plugins import calendar_plugin 3 4calendar = GoogleCalendar() # Requires OAuth: co auth google 5 6agent = Agent("scheduler", tools=[calendar], plugins=[calendar_plugin]) 7 8agent.input("Schedule a meeting with John tomorrow at 2pm")
Python REPL
Interactive
┌─ Create Event ─────────────────────────┐
│ Title: Meeting with John │
│ Start: 2024-01-15 14:00 │
│ End: 2024-01-15 15:00 │
│ Attendees: john@example.com │
│ (will receive invite!) │
└────────────────────────────────────────┘
Proceed with create event?
> Yes, create event
> Auto approve all calendar actions this session
> No, tell agent what I want

Protected Operations

These calendar methods require approval:

MethodActionPreview Shows
create_eventCreate calendar eventTitle, time, attendees, location
create_meetCreate Google MeetTitle, time, attendees
update_eventModify existing eventEvent ID, changed fields
delete_eventDelete eventEvent ID, warning message

Read-only operations like list_events, get_event, search_events are automatically allowed.

Approval Options

Yes, {action}

Proceed with this specific action

Auto approve all calendar actions this session

Skip approval for all calendar operations

No, tell agent what I want

Reject and provide alternative instructions

How it works

main.py
1WRITE_METHODS = ('create_event', 'create_meet', 'update_event', 'delete_event') 2 3@before_each_tool 4def check_calendar_approval(agent): 5 pending = agent.current_session.get('pending_tool') 6 if not pending: 7 return 8 9 tool_name = pending['name'] 10 if tool_name not in WRITE_METHODS: 11 return 12 13 # Skip if all actions auto-approved 14 if agent.current_session.get('calendar_approve_all', False): 15 return 16 17 args = pending['arguments'] 18 19 # Build preview based on action type 20 preview = Text() 21 if tool_name == 'create_event': 22 preview.append(f"Title: {args.get('title')}\n") 23 preview.append(f"Start: {args.get('start_time')}\n") 24 if args.get('attendees'): 25 preview.append(f"Attendees: {args['attendees']} (will receive invite!)\n") 26 # ... 27 28 # Show preview and get choice 29 console.print(Panel(preview, title=f"[yellow]{action}[/yellow]")) 30 31 choice = pick(f"Proceed with {action}?", options) 32 33 if choice == "No, tell agent what I want": 34 feedback = input("What do you want instead? ") 35 raise ValueError(f"User feedback: {feedback}")

Events Used

EventHandlerPurpose
before_each_toolcheck_calendar_approvalPreview and approve calendar changes

Related

Source

connectonion/useful_plugins/calendar_plugin.py

main.py
1# Bundle as plugin 2calendar_plugin = [ 3 check_calendar_approval, 4]