feat(agent): add create_a2h2a_ticket tool

This commit is contained in:
Chris Christiansen 2026-09-05 13:17:01 +00:00
parent 563b49da7c
commit 53aa95d4db

View File

@ -200,6 +200,44 @@ def push_file(path: str, content: str, message: str = "", sha: str = "") -> dict
return _call_tool("push_file", {"path": path, "content": content, "message": message, "sha": sha})
from pydantic import BaseModel, Field
from typing import Optional
class TicketSource(BaseModel):
reporter: str
trigger: str
affected_service: str
project_id: str
class ProposedAction(BaseModel):
execution_tool: str
tool_parameters: dict
parameter_hash: Optional[str] = None
class Context(BaseModel):
summary: str
user_justification: str
conversation_history: list
class Governance(BaseModel):
approval_status: str = "PENDING"
authorized_approver: str
requires_mfa: bool = True
timeout_minutes: int = 15
class A2H2ATicket(BaseModel):
ticket_id: Optional[str] = None
source: TicketSource
proposed_action: ProposedAction
context: Context
severity: str
governance: Governance
def create_a2h2a_ticket(ticket: A2H2ATicket) -> dict:
"""Create a new A2H2A ticket for a sensitive operation."""
return _call_tool("create_a2h2a_ticket", ticket.dict())
OPAX_TOOLS = [
FunctionTool(func=get_billing_summary),
FunctionTool(func=get_billing_credits),
@ -222,6 +260,7 @@ OPAX_TOOLS = [
FunctionTool(func=list_open_issues),
FunctionTool(func=create_issue),
FunctionTool(func=push_file),
FunctionTool(func=create_a2h2a_ticket),
]
@ -252,7 +291,7 @@ _INSTRUCTION_TEMPLATE = (
"Du har tilgang til alle OPAX-tools via opax-mcp. "
"Tools: list_commits, get_file, push_file, create_issue, list_open_issues (Gitea), "
"get_billing_summary, get_billing_credits, get_billing_anomalies, "
"get_build_status, get_state, get_telemetry, run_terminal, "
"get_build_status, get_state, get_telemetry, run_terminal, create_a2h2a_ticket, "
"create_invite, list_customers, send_webhook, send_email, get_notify_channels. "
"Når brukaren ber om data — KALL ALLTID rett tool før du svarar. "
"Svar på norsk (bokmål) med mindre annet er bedt om. "