Skip to content
Learn Agentic AI15 min read0 views

AI Agent for K-12 Parent Communication: Grade Updates, Attendance, and School Events

Build an AI agent that keeps K-12 parents informed with real-time grade updates, attendance notifications, school event details, and seamless LMS integration.

Bridging the School-Home Communication Gap

Parents want to stay informed about their children's education, but navigating multiple portals, decoding grade books, and tracking school communications is overwhelming. Teachers spend hours each week responding to routine parent inquiries about grades, attendance, and events. An AI parent communication agent bridges this gap by providing parents with instant, personalized updates while reducing the communication burden on teachers.

Student and Parent Data Model

The data model needs to connect parents to students and aggregate information from multiple school systems.

from dataclasses import dataclass, field
from datetime import date, datetime
from enum import Enum
from typing import Optional


class AttendanceStatus(Enum):
    PRESENT = "present"
    ABSENT_EXCUSED = "absent_excused"
    ABSENT_UNEXCUSED = "absent_unexcused"
    TARDY = "tardy"
    EARLY_DISMISSAL = "early_dismissal"


class GradeLevel(Enum):
    A = "A"
    A_MINUS = "A-"
    B_PLUS = "B+"
    B = "B"
    B_MINUS = "B-"
    C_PLUS = "C+"
    C = "C"
    D = "D"
    F = "F"


@dataclass
class Assignment:
    assignment_id: str
    course_name: str
    title: str
    due_date: date
    max_points: float
    earned_points: Optional[float] = None
    is_missing: bool = False
    is_late: bool = False
    feedback: str = ""


@dataclass
class AttendanceRecord:
    record_date: date
    status: AttendanceStatus
    period: str = "Full Day"
    note: str = ""


@dataclass
class CourseGrade:
    course_name: str
    teacher: str
    current_grade: float
    letter_grade: str
    assignments_missing: int = 0
    last_updated: Optional[date] = None


@dataclass
class Student:
    student_id: str
    first_name: str
    last_name: str
    grade_level: int
    homeroom_teacher: str
    courses: list[CourseGrade] = field(default_factory=list)
    attendance: list[AttendanceRecord] = field(default_factory=list)
    assignments: list[Assignment] = field(default_factory=list)


@dataclass
class Parent:
    parent_id: str
    name: str
    email: str
    phone: str
    students: list[str] = field(default_factory=list)
    notification_preferences: dict = field(default_factory=dict)


@dataclass
class SchoolEvent:
    event_id: str
    title: str
    description: str
    event_date: datetime
    location: str
    grade_levels: list[int] = field(default_factory=list)
    rsvp_required: bool = False
    category: str = ""

Grade Monitoring and Alert Logic

The agent should proactively detect concerning grade patterns.

See AI Voice Agents Handle Real Calls

Book a free demo or calculate how much you can save with AI voice automation.

STUDENTS_DB: dict[str, Student] = {}
PARENTS_DB: dict[str, Parent] = {}
EVENTS_DB: list[SchoolEvent] = []


def analyze_grade_trends(student_id: str) -> dict:
    student = STUDENTS_DB.get(student_id)
    if not student:
        return {"error": "Student not found"}

    alerts = []
    summary = []

    for course in student.courses:
        summary.append({
            "course": course.course_name,
            "grade": course.letter_grade,
            "percentage": course.current_grade,
            "missing_assignments": course.assignments_missing,
        })

        if course.current_grade < 70:
            alerts.append({
                "type": "low_grade",
                "severity": "high",
                "course": course.course_name,
                "grade": course.current_grade,
                "message": f"{course.course_name}: grade is "
                    f"{course.current_grade}%, below passing threshold",
            })

        if course.assignments_missing > 2:
            alerts.append({
                "type": "missing_assignments",
                "severity": "medium",
                "course": course.course_name,
                "count": course.assignments_missing,
                "message": f"{course.course_name}: "
                    f"{course.assignments_missing} missing assignments",
            })

    return {
        "student_name": f"{student.first_name} {student.last_name}",
        "grade_level": student.grade_level,
        "courses": summary,
        "alerts": alerts,
        "gpa": round(
            sum(c.current_grade for c in student.courses)
            / len(student.courses), 1
        ) if student.courses else 0,
    }


def get_attendance_summary(student_id: str) -> dict:
    student = STUDENTS_DB.get(student_id)
    if not student:
        return {"error": "Student not found"}

    total = len(student.attendance)
    present = sum(
        1 for r in student.attendance
        if r.status == AttendanceStatus.PRESENT
    )
    absences = sum(
        1 for r in student.attendance
        if r.status in (
            AttendanceStatus.ABSENT_EXCUSED,
            AttendanceStatus.ABSENT_UNEXCUSED
        )
    )
    unexcused = sum(
        1 for r in student.attendance
        if r.status == AttendanceStatus.ABSENT_UNEXCUSED
    )
    tardies = sum(
        1 for r in student.attendance
        if r.status == AttendanceStatus.TARDY
    )

    return {
        "student_name": f"{student.first_name} {student.last_name}",
        "total_days": total,
        "days_present": present,
        "total_absences": absences,
        "unexcused_absences": unexcused,
        "tardies": tardies,
        "attendance_rate": round(
            present / total * 100, 1
        ) if total > 0 else 100,
    }

Agent Tools and Assembly

from agents import Agent, function_tool, Runner
import json


@function_tool
def get_grades(parent_id: str, student_id: str) -> str:
    """Get current grades and alerts for a parent's child."""
    parent = PARENTS_DB.get(parent_id)
    if not parent or student_id not in parent.students:
        return "Access denied. Student not linked to this parent."
    return json.dumps(analyze_grade_trends(student_id))


@function_tool
def get_attendance(parent_id: str, student_id: str) -> str:
    """Get attendance summary for a parent's child."""
    parent = PARENTS_DB.get(parent_id)
    if not parent or student_id not in parent.students:
        return "Access denied."
    return json.dumps(get_attendance_summary(student_id))


@function_tool
def get_school_events(grade_level: int, category: str = "") -> str:
    """Get upcoming school events for a specific grade level."""
    now = datetime.now()
    upcoming = []
    for event in EVENTS_DB:
        if event.event_date < now:
            continue
        if grade_level not in event.grade_levels and event.grade_levels:
            continue
        if category and category.lower() not in event.category.lower():
            continue
        upcoming.append({
            "title": event.title,
            "date": event.event_date.strftime("%B %d, %Y at %I:%M %p"),
            "location": event.location,
            "category": event.category,
            "rsvp_required": event.rsvp_required,
        })
    return json.dumps(upcoming[:10]) if upcoming else "No upcoming events."


parent_agent = Agent(
    name="School Communication Assistant",
    instructions="""You are a K-12 school communication assistant for
    parents. Provide grade updates, attendance information, and
    school event details. Always verify parent identity before
    sharing student data. Present grade concerns constructively
    with actionable suggestions. Never compare students. When
    a parent wants to contact a teacher, provide the teacher name
    and suggest using the school messaging system.""",
    tools=[get_grades, get_attendance, get_school_events],
)

FAQ

How does the agent handle divorced or separated parents with different access levels?

The data model uses the parent-student linking in Parent.students to control access. Each parent record is independent, and the school can configure different access levels (full access, grades only, emergency only) per parent-student relationship. The agent checks these permissions before returning any data.

Can the agent send proactive notifications to parents?

Yes. Schedule a background job that runs analyze_grade_trends for all students daily. When alerts are generated (low grades, missing assignments, unexcused absences), send notifications via the parent preferred channel (email, SMS, app push) based on their notification_preferences.

How do you handle FERPA compliance?

FERPA requires that student education records are only shared with authorized parties. The agent enforces this through the parent-student linkage verification in every tool call. All data access is logged with timestamps and parent ID for audit trails. The agent never stores conversation content containing student records beyond the session.


#AIAgents #EdTech #K12Education #Python #ParentCommunication #AgenticAI #LearnAI #AIEngineering

Share this article
C

CallSphere Team

Expert insights on AI voice agents and customer communication automation.

Try CallSphere AI Voice Agents

See how AI voice agents work for your industry. Live demo available -- no signup required.