Skip to content

API Reference parrot.bots.jira_specialist

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.bots.jira_specialist

View source

Jira Specialist Agent with Daily Standup Workflow.

Extends JiraSpecialist with:

  • Daily ticket dispatch via Telegram inline keyboards
  • Callback handlers for ticket selection
  • Redis-based response tracking
  • Manager escalation for non-responders

HITL lane (ask_human instead of inline keyboards), fanned out over the JIRA_DEVELOPERS roster, one private chat per developer:

SCHEDULER → dispatch_morning_standup() / dispatch_eod_standup()
/standup  → standup_command()  (the caller's own morning standup)

Alias Agent

Re-exported from parrot.bots.Agent.

Alias AgentDispatcher

Re-exported from parrot.bots._types.AgentDispatcher.

Alias CallbackContext

Re-exported from parrot.integrations.telegram.callbacks.CallbackContext.

Alias CallbackResult

Re-exported from parrot.integrations.telegram.callbacks.CallbackResult.

Class DailyStandupConfig

Configuration for the daily standup workflow.

Fields:

Field Type Default Description
jira_projects List[str] ['NAV' Jira projects to search for tickets
ticket_statuses List[str] ['Open' Jira statuses to include in daily message
in_progress_transition str 'In Progress' Target Jira status when dev selects a ticket
response_window_hours int 2 Hours to wait before escalating non-responders
redis_ttl_seconds int 43200 TTL for Redis response tracking keys
max_tickets_shown int 8 Maximum tickets to show in the message
prefix_select str 'tsel'
prefix_skip str 'tskp'

Class Developer

A developer in the team with Jira + Telegram mappings.

Fields:

Field Type Default Description
id str Internal developer ID
name str Display name
username str Internal Username
jira_username str Jira account username/email
jira_account_id Optional[str] Jira Cloud accountId, used in JQL
telegram_chat_id int Telegram private chat ID
manager_chat_id Optional[int] Manager's Telegram chat ID for escalation

Class HistoryEvent

History of Events.

Fields:

Field Type Default Description
author Optional[str]
created datetime
items List[HistoryItem]

Class HistoryItem

Model representing a history item.

Fields:

Field Type Default Description
field str
fromString Optional[str]
toString Optional[str]

Alias HookEvent

Re-exported from parrot.core.hooks.HookEvent.

Alias JIRA_ALLOWED_REPORTERS

Re-exported from parrot.conf.JIRA_ALLOWED_REPORTERS.

Alias JIRA_DEFAULT_REPORTER

Re-exported from parrot.conf.JIRA_DEFAULT_REPORTER.

Alias JIRA_TELEGRAM_PUBLIC_CHANNEL_ID

Re-exported from parrot.conf.JIRA_TELEGRAM_PUBLIC_CHANNEL_ID.

Alias JIRA_USERS

Re-exported from parrot.conf.JIRA_USERS.

Class JiraSpecialist

Base class for Jira specialist agents.

This class is abstract by convention — it is never instantiated or registered with the AgentRegistry directly. To deploy a concrete Jira agent, subclass it in agents/ and apply the @register_agent decorator on the subclass (e.g. class Jirachi(JiraSpecialist):).

Capabilities (all inherited by subclasses):

  • Jira ticket search, creation, and transitions (per-user OAuth2 3LO or service-account basic/token auth — see :meth:post_configure).
  • HITL flows via Telegram (:class:TelegramHumanTool) for approvals, single/multi choice, free-text and form interactions.
  • Daily standup:
    • Button-driven (Redis-tracked) flow: :meth:dispatch_daily_tickets → :meth:escalate_non_responders.
    • HITL flow via ask_human: :meth:run_morning_standup / :meth:run_eod_standup, fanned out over the roster by the scheduled :meth:dispatch_morning_standup / :meth:dispatch_eod_standup, and triggerable per developer with the /standup Telegram command (:meth:standup_command).
  • Callback handlers for ticket selection.

Prompt architecture (FEAT-138): Uses a composable :class:~parrot.bots.prompts.PromptBuilder with two Jira-specific layers installed via :meth:_build_jira_prompt_builder:

* ``jira_workflow`` — all behavioural rules (posture, standup flow,
  cancellation, HITL rules, interaction type examples).
* ``jira_grounding`` — anti-hallucination policy (sentinel phrases,
  no cross-ticket bleed, no apology-then-fabricate loop).

To extend the prompt in a subclass, override
:meth:`_build_jira_prompt_builder` or pass ``prompt_builder=`` in
``__init__``.
Parameter Type Default Description
**kwargs {}

Attributes:

Attribute Type Description
public_channel_id Optional[Any]
jira_toolkit Optional[JiraToolkit]

Method JiraSpecialist.set_wrapper

Called by TelegramAgentWrapper to give the agent a reference to the wrapper for proactive messaging.

set_wrapper(wrapper) -> None

Parameter Type Default Description
wrapper

Method JiraSpecialist.set_agent_dispatcher

Wire an async dispatcher so TRIGGER_AGENT actions can invoke other agents. Without this, TRIGGER_AGENT degrades to log-only.

Typically called at application startup once both the concrete Jira agent and an orchestrator exist, e.g.::

jira_agent.set_agent_dispatcher(orchestrator.execute_agent)

set_agent_dispatcher(dispatcher: AgentDispatcher) -> None

Parameter Type Default Description
dispatcher AgentDispatcher An async callable matching the :class:AgentDispatcher protocol shape (agent_name, task, keyword-only user_id/session_id). AutonomousOrchestrator.execute_agent (ai-parrot-server) satisfies this shape.

Method JiraSpecialist.load_developers

Load the developer list from config/database. Override this in a subclass or configure via external source.

load_developers() -> List[Developer]

Returns: List[Developer]

Method JiraSpecialist.agent_tools

Return agent-specific non-Jira tools.

Only returns :class:TelegramHumanTool here. The :class:JiraToolkit is constructed later in :meth:post_configure, once self.app is attached and app['jira_oauth_manager'] is reachable — this is what enables per-user OAuth2 3LO credentials.

agent_tools()

Method JiraSpecialist.post_configure

Wire the :class:JiraToolkit using app-scoped credentials.

Credential resolution is delegated to the :meth:_configure_jira hook (override it in subclasses to change auth). This method then registers the resulting tools with self.tool_manager, syncs them back to the LLM so schemas are visible for the first user turn, and wires the reminder toolkit. Re-entrant (FEAT-721): already-registered Jira and Reminder toolkits are adopted, and self.tools never gains duplicate names.

post_configure() -> None

Method JiraSpecialist.clone_for_user

Return a fully isolated per-user clone of this agent.

Called by :class:TelegramAgentWrapper when the YAML sets singleton_agent: false. Giving every user their own agent removes the self._agent_lock serialization inside _invoke_agent — one user's hung tool call can no longer freeze the rest of the chat.

The clone:

  • is built from the same __init__ kwargs as the original (captured in :attr:_init_kwargs), so LLM config, model, system prompt, and injection threshold are preserved;
  • runs the full :meth:configure → :meth:post_configure pipeline so it gets its own LLM client, ToolManager, conversation memory, :class:JiraToolkit and :class:ReminderToolkit;
  • inherits the read-only references the parent relies on at runtime (self.app, self._wrapper, the developer roster, and :attr:_standup_config) without mutating the parent's state.

Per-user authentication still flows through :class:OAuthCredentialResolver inside JiraToolkit._pre_execute, so each clone's Jira calls use the caller's own OAuth2 3LO tokens.

clone_for_user(user_context: UserContext) -> JiraSpecialist

Parameter Type Default Description
user_context UserContext Channel-agnostic identity snapshot provided by the integration wrapper. Not consumed directly here — per-user credential scoping is handled downstream by the OAuth resolver — but accepted to match the :class:AbstractBot contract.

Returns: JiraSpecialist — A fully configured :class:JiraSpecialist (or concrete subclass) instance that can service a single user without sharing mutable state with the original.

Method JiraSpecialist.run_morning_standup

Run the morning standup for one or all configured developers.

For each developer, the agent is asked to follow the "Morning check-in" section of its system prompt: fetch open tickets, present a shortlist via ask_human (inline buttons on Telegram), transition the picked ticket to In Progress, post the standup comment, and collect a one-line plan.

run_morning_standup(developer: Optional[dict] = None, developer_id: Optional[str] = None, **kwargs: Any) -> List[Dict[str, Any]]

Parameter Type Default Description
developer Optional[dict] None
developer_id Optional[str] None Run for a single developer if provided; otherwise fan out to every developer in parallel.
**kwargs Any {}

Returns: List[Dict[str, Any]] — List of per-developer result dicts.

Method JiraSpecialist.run_eod_standup

Run the end-of-day standup wrap for one or all developers.

For each developer, the agent collects a three-field status (done_today / plan_tomorrow / blockers) via the ask_human form interaction, posts it as a Jira comment on the primary ticket worked today, and flags blockers.

run_eod_standup(developer_id: Optional[str] = None, **kwargs: Any) -> List[Dict[str, Any]]

Parameter Type Default Description
developer_id Optional[str] None Run for a single developer if provided; otherwise fan out to every developer in parallel.
**kwargs Any {}

Returns: List[Dict[str, Any]] — List of per-developer result dicts.

Method JiraSpecialist.dispatch_morning_standup

Scheduler entry point: private morning standup for every developer.

Iterates the roster — JIRA_DEVELOPERS from the app settings module, see :meth:_standup_roster — and runs the "Morning check-in" section of the system prompt for each one inside their own Telegram chat, so every developer gets their standup as a private message.

Marks each developer as dispatched and, once they finish the conversation, as having responded, so :meth:escalate_non_responders can report whoever stayed silent.

dispatch_morning_standup(developer_id: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
developer_id Optional[str] None Run for a single developer instead of the whole roster.

Returns: Dict[str, Any] — Summary dict (see :meth:_dispatch_standup_lane).

Method JiraSpecialist.dispatch_eod_standup

Scheduler entry point: private end-of-day wrap for every developer.

The end-of-day counterpart of :meth:dispatch_morning_standup: for each developer on the roster it runs the "End-of-day wrap" section of the system prompt in their private chat, collecting done_today / plan_tomorrow / blockers and posting them to Jira.

Writes no response bookkeeping — the standup:responded key tracks the morning answer and the two lanes share one key per day.

dispatch_eod_standup(developer_id: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
developer_id Optional[str] None Run for a single developer instead of the whole roster.

Returns: Dict[str, Any] — Summary dict (see :meth:_dispatch_standup_lane).

Method JiraSpecialist.standup_command

Run the morning standup on demand, for whoever typed /standup.

The Telegram wrapper invokes agent commands inside the caller's chat scope, so the developer is resolved from the live chat id. Pass /standup developer_id=35 to target someone else explicitly.

standup_command(developer_id: Optional[str] = None, **kwargs: Any) -> str

Parameter Type Default Description
developer_id Optional[str] None Roster id to run for; defaults to the calling chat.
**kwargs Any {}

Returns: str — A localized one-line confirmation, sent back to the caller's chat.

Method JiraSpecialist.dispatch_daily_tickets

CRON entry point: Send daily ticket messages to all developers.

Scheduled to run at 08:00 AM.

dispatch_daily_tickets() -> Dict[str, Any]

Returns: Dict[str, Any] — Summary dict with dispatch results.

Method JiraSpecialist.on_ticket_selected

Handle ticket selection.

on_ticket_selected(callback: CallbackContext) -> CallbackResult

Parameter Type Default Description
callback CallbackContext

Returns: CallbackResult

Method JiraSpecialist.on_ticket_skipped

Handle skip — developer already has a plan for today.

on_ticket_skipped(callback: CallbackContext) -> CallbackResult

Parameter Type Default Description
callback CallbackContext

Returns: CallbackResult

Method JiraSpecialist.escalate_non_responders

CRON entry point: Check for non-responders and escalate.

Scheduled to run at 10:00 AM (2h after dispatch).

The managers are notified with a single message listing every developer who did not answer the morning standup, posted to the shared Telegram channel (:attr:public_channel_id, defaulting to the JIRA_TELEGRAM_PUBLIC_CHANNEL_ID env var) instead of one DM per manager. Each silent developer still gets their private nudge.

When no channel is configured the legacy behaviour is kept as a fallback: non-responders are grouped by manager and each manager gets their own list.

escalate_non_responders(manager_chat_id: Optional[int] = None) -> Dict[str, Any]

Parameter Type Default Description
manager_chat_id Optional[int] None Send the digest here instead of the configured channel (explicit override wins over both).

Returns: Dict[str, Any] — Summary of escalation results: date, total_dispatched, responded, non_responders, escalated_to, channel_id and messages_sent.

Method JiraSpecialist.get_standup_status

Get current daily standup status.

Useful for debugging or a /standup_status command.

get_standup_status() -> Dict[str, Any]

Returns: Dict[str, Any]

Method JiraSpecialist.handle_hook_event

Route :class:HookEvent instances emitted by JiraWebhookHook.

Dispatches each known event type to its dedicated handler:

  • jira.created → :meth:handle_jira_ticket_created
  • jira.assigned → :meth:handle_jira_assignment
  • jira.ready_for_test → :meth:handle_ready_for_test
  • jira.transitioned → :meth:_dispatch_transition
  • All others → logged at INFO level, returns None.

handle_hook_event(event: HookEvent) -> Optional[Dict[str, Any]]

Parameter Type Default Description
event HookEvent The hook event forwarded by HookManager.

Returns: Optional[Dict[str, Any]] — The result dict returned by the matched handler, or None when the event type is not recognised.

Method JiraSpecialist.handle_jira_assignment

Kick off the assignment conversation with the developer on Telegram.

Invoked by the :class:JiraWebhookHook when a ticket is assigned (either on creation with a non-null assignee or via an assignee change in the changelog).

The developer receives a prompt on Telegram asking them to provide:

  • a due date (ISO YYYY-MM-DD),
  • an original estimate (1d, 4h, 30m…),
  • and to accept or reject the assignment.

On accept, the agent posts the estimate as timetracking.originalEstimate, writes the due date, and transitions the issue to In Progress. On reject, the agent posts a Jira comment with the reason and leaves the ticket untouched so a manager can reassign.

handle_jira_assignment(payload: Dict[str, Any]) -> Dict[str, Any]

Parameter Type Default Description
payload Dict[str, Any] The HookEvent.payload emitted by :class:JiraWebhookHook. Must contain issue_key and either new_assignee or assignee dicts.

Returns: Dict[str, Any] — Result dict with status (ok/skipped/error), issue_key, and — on skip/error — reason.

Method JiraSpecialist.handle_jira_ticket_created

Auto-repoint the reporter of a freshly-created Jira ticket when the original reporter is not in JIRA_ALLOWED_REPORTERS.

Emits a Jira comment documenting the change and returns a result dict compatible with the other handle_* webhook methods.

handle_jira_ticket_created(payload: Dict[str, Any]) -> Dict[str, Any]

Parameter Type Default Description
payload Dict[str, Any] The hook event payload containing issue_key and a reporter dict with email, display_name, account_id, and name keys (as enriched by TASK-808).

Returns: Dict[str, Any] — A dict with status ∈ {"ok", "skipped", "error"} and optional fields issue_key, original_reporter, new_reporter, reason, and error. Never raises.

Method JiraSpecialist.handle_ready_for_test

Notify the QA channel when a ticket transitions to "Ready For Test".

The destination channel id is read from navconfig.config key JIRA_TEST_WEBHOOK_CHANNEL. The message announces that the developer has finished the development phase and the ticket is entering the testing phase.

handle_ready_for_test(payload: Dict[str, Any]) -> Dict[str, Any]

Parameter Type Default Description
payload Dict[str, Any] The HookEvent.payload emitted by :class:JiraWebhookHook. Expected to contain issue_key, summary, priority, assignee and (optionally) user (the actor who moved the ticket).

Returns: Dict[str, Any] — Result dict with status (ok/skipped/error), issue_key and, on skip/error, reason.

Method JiraSpecialist.create_ticket

Create a Jira ticket using the JiraToolkit.

create_ticket(summary: str, description: str, **kwargs) -> str

Parameter Type Default Description
summary str
description str
**kwargs {}

Returns: str

Method JiraSpecialist.search_all_tickets

Search for due Jira tickets using the JiraToolkit and return structured output. Uses dataframe storage optimization to avoid token limits.

search_all_tickets(start_date: str = '2025-01-01', end_date: str = '2026-02-28', max_tickets: Optional[int] = None, **kwargs) -> List[JiraTicket]

Parameter Type Default Description
start_date str '2025-01-01'
end_date str '2026-02-28'
max_tickets Optional[int] None
**kwargs {}

Returns: List[JiraTicket]

Method JiraSpecialist.weekly_ticket_count_report

Month-to-date ticket count by Assignee grouped by Component.

Decorated with :func:schedule_weekly_report so the scheduler runs it weekly (defaults to MON 09:00 UTC; override via the {AGENT_ID}_WEEKLY_REPORT env var, format DDD HH:MM).

Pulls every ticket from the configured Jira projects created since the first day of the current month, groups the rows by component × assignee, and emails a plain-text summary to jlara@trocglobal.com.

weekly_ticket_count_report() -> Dict[str, Any]

Returns: Dict[str, Any] — Dict with period, total_tickets, by_component (nested {component: {assignee: count}}) and a flat rows list — useful for tests and downstream consumers.

Method JiraSpecialist.get_ticket

Get detailed information for a specific Jira ticket, including history.

get_ticket(issue_number: str) -> JiraTicketDetail

Parameter Type Default Description
issue_number str

Returns: JiraTicketDetail

Method JiraSpecialist.get_in_progress_by_assignee

Return all "In Progress" Jira tickets grouped by assignee.

Queries Jira directly via :attr:jira_toolkit for issues currently in the target status (default "In Progress"), then groups them by assignee. For each assignee, returns up to max_per_assignee tickets (default 3) with the ticket key, summary, creation time, due date, and — when available from the issue changelog — the most recent transition timestamp into the target status.

get_in_progress_by_assignee(projects: Optional[List[str]] = None, max_per_assignee: int = 3, statuses: Optional[List[str]] = None) -> Dict[str, Any]

Parameter Type Default Description
projects Optional[List[str]] None Jira project keys to search. Defaults to :attr:DailyStandupConfig.jira_projects.
max_per_assignee int 3 Maximum number of tickets to include per assignee in the bullet list. Defaults to 3.
statuses Optional[List[str]] None Status names to filter on. Defaults to ["In Progress"]. The first entry is also the status whose transition timestamp is extracted from the changelog.

Returns: Dict[str, Any] — A dict with two keys: * markdown: A Markdown-formatted bullet list (one bullet per assignee, with up to max_per_assignee nested ticket bullets). * by_assignee: Ordered mapping assignee -> list[ticket] where each ticket dict contains key, summary, created, due_date and in_progress_at.

Raises:

  • RuntimeError — If :attr:jira_toolkit is not configured yet or the underlying Jira search returns an error envelope.

Class JiraTicket

Model representing a Jira Ticket.

Fields:

Field Type Default Description
project str The project key (e.g., NAV).
issue_number str The issue key (e.g., NAV-5972).
title str Summary or title of the ticket.
description str Description of the ticket.
assignee Optional[str] The person assigned to the ticket.
reporter Optional[str] The person who reported the ticket.
created_at datetime Date of creation.
updated_at datetime Date of last update.
labels List[str] List of labels associated with the ticket.
components List[str] List of components.

Class JiraTicketDetail

Detailed Jira Ticket model with history.

Fields:

Field Type Default Description
issue_number str
title str
description Optional[str]
status str
assignee Optional[str]
reporter Optional[str]
labels List[str]
created datetime
updated datetime
history List[HistoryEvent]

Class JiraTicketResponse

Model representing a Jira Ticket Response.

Fields:

Field Type Default Description
tickets List[JiraTicket] List of Jira tickets found.

Alias OAuthCredentialResolver

Re-exported from parrot.auth.credentials.OAuthCredentialResolver.

Alias REDIS_URL

Re-exported from parrot.conf.REDIS_URL.

Alias ReminderToolkit

Re-exported from parrot.tools.reminder.ReminderToolkit.

Alias ScheduleType

Re-exported from parrot.scheduler.ScheduleType.

Alias TelegramHumanTool

Re-exported from parrot.integrations.telegram.TelegramHumanTool.

Alias TransitionAction

Re-exported from parrot.core.hooks.TransitionAction.

Alias TransitionActionType

Re-exported from parrot.core.hooks.TransitionActionType.

Alias UserContext

Re-exported from parrot.auth.context.UserContext.

Alias build_inline_keyboard

Re-exported from parrot.integrations.telegram.callbacks.build_inline_keyboard.

Alias get_current_telegram_chat_id

Re-exported from parrot.integrations.telegram.get_current_telegram_chat_id.

Alias render_message

Re-exported from parrot.bots.jira_messages.render_message.

Alias schedule

Re-exported from parrot.scheduler.schedule.

Alias telegram_callback

Re-exported from parrot.integrations.telegram.callbacks.telegram_callback.

Alias telegram_chat_scope

Re-exported from parrot.integrations.telegram.telegram_chat_scope.

Alias telegram_command

Re-exported from parrot.integrations.telegram.telegram_command.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally