Skip to content

Enhance agent automation with task management and scheduling features#3439

Open
Dallas98 wants to merge 6 commits into
developfrom
automation_schedule
Open

Enhance agent automation with task management and scheduling features#3439
Dallas98 wants to merge 6 commits into
developfrom
automation_schedule

Conversation

@Dallas98

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 16, 2026 06:50
@Dallas98 Dallas98 requested a review from WMC001 as a code owner July 16, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces end-to-end “agent automation” (durable scheduled tasks) across SDK, backend, database, and frontend, enabling users to create/manage scheduled runs from chat and a dedicated “Automation Tasks” UI.

Changes:

  • Adds an SDK-level, framework-independent schedule engine + durable lease-based scheduler core.
  • Implements backend agent-automation domain (DB schema + data access, scheduler adapter, runner, intent analysis/prompt generation, and FastAPI endpoints) and wires it into runtime startup/shutdown.
  • Adds frontend automation task types, API client, navigation entry, chat proposal card UX, and the /agent-tasks management page.

Reviewed changes

Copilot reviewed 58 out of 59 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/sdk/scheduler/test_core.py Adds unit tests for lease scheduler behavior and trigger computation.
test/sdk/scheduler/init.py Test package marker for scheduler tests.
test/backend/services/test_agent_service.py Adds coverage for non-SSE background agent execution.
test/backend/services/test_agent_automation_scheduler.py Tests backend lease-store adapter + executor fencing token propagation.
test/backend/services/test_agent_automation_schedule_engine.py Tests backend adapter around SDK schedule computation and cron validation/fallback.
test/backend/services/test_agent_automation_prompt_generator.py Tests task title/instruction normalization and strategy selection.
test/backend/services/test_agent_automation_lifecycle.py Exercises proposal→confirm→manual run lifecycle with conversation persistence.
test/backend/services/test_agent_automation_intent_analyzer.py Tests LLM vs rule-based automation intent analysis behaviors.
test/backend/services/test_agent_automation_conversation_hook.py Ensures conversation deletion triggers automation cleanup hook.
test/backend/services/test_agent_automation_conversation_adapter.py Tests persisting proposal exchanges to conversation history units.
test/backend/database/test_agent_automation_db.py Tests DB lease SQL patterns and presence of partial unique indexes in SQL + ORM.
test/backend/app/test_agent_automation_app.py Adds FastAPI smoke tests for automation endpoints and auth behavior.
sdk/nexent/scheduler/triggers.py Adds pure schedule computation + cron validation/fallback evaluator.
sdk/nexent/scheduler/core.py Adds durable lease-based async scheduler core with renewal/shutdown semantics.
sdk/nexent/scheduler/init.py Exposes scheduler primitives via package exports.
frontend/types/chat.ts Extends chat message model to carry automation proposal payloads.
frontend/types/agentAutomation.ts Defines frontend types for tasks/runs/proposals and schedule triggers.
frontend/services/api.ts Adds agent-automation API endpoint constants.
frontend/services/agentAutomationService.ts Implements typed API client for automation task/proposal lifecycle.
frontend/server.js Routes automation API paths through runtime auth forwarding.
frontend/public/locales/zh/common.json Adds Chinese UI strings for automation-aware deletion + navigation.
frontend/public/locales/en/common.json Adds English UI strings for automation-aware deletion + navigation.
frontend/lib/chatMessageExtractor.ts Parses automation_proposal message units and improves i18n typing.
frontend/components/navigation/SideNavigation.tsx Adds “Automation Tasks” route entry and reorders navigation.
frontend/app/[locale]/chat/streaming/chatStreamFinalMessage.tsx Renders proposal card in chat and enables confirm flow.
frontend/app/[locale]/chat/internal/chatInterface.tsx Adds proposal pre-check before agent run and task markers for conversations.
frontend/app/[locale]/chat/components/chatLeftSidebar.tsx Shows automation marker on conversations + automation-aware delete confirmation.
frontend/app/[locale]/chat/components/chatHeader.tsx Displays an automation-bound indicator in the chat header.
frontend/app/[locale]/agent-tasks/page.tsx Adds Automation Tasks management page (list/edit/run/pause/resume/history).
frontend/app/[locale]/agent-tasks/components/AutomationProposalCard.tsx Adds reusable UI card for automation proposals (schedule + capability status).
deploy/sql/migrations/v2.3.0_0713_add_agent_automation.sql Adds DB tables/indexes for tasks/runs/proposals and nav permission entries.
deploy/sql/init.sql Mirrors automation schema/indexes into fresh-install init SQL.
backend/utils/prompt_template_utils.py Registers new agent_automation prompt templates.
backend/services/conversation_management_service.py Invokes automation cleanup hook during conversation deletion.
backend/services/agent_service.py Adds background agent-run entrypoint and an “is running” helper.
backend/services/agent_automation/scheduler.py Adapts SDK lease scheduler to Postgres-backed agent-automation execution.
backend/services/agent_automation/schedule_engine.py Wraps SDK schedule engine for backend API models.
backend/services/agent_automation/runner.py Implements run execution, persistence, fencing, retries/pausing, and cancellation.
backend/services/agent_automation/prompt_generator.py Generates stable task titles/instructions with LLM+fallback normalization.
backend/services/agent_automation/models.py Adds Pydantic models/enums for triggers, tasks, proposals, and API responses.
backend/services/agent_automation/intent_analyzer.py Adds rule/LLM automation-intent detection and schedule trigger construction.
backend/services/agent_automation/errors.py Adds domain exceptions with stable error codes for the automation API.
backend/services/agent_automation/conversation_adapter.py Persists proposal exchanges into conversation messages/units.
backend/services/agent_automation/capability_resolver.py Resolves capabilities and validates user-selected bindings at run time.
backend/services/agent_automation/init.py Adds domain package marker.
backend/pyproject.toml Adds croniter dependency for cron evaluation.
backend/prompts/agent_automation_zh.yaml Adds Chinese prompts for intent analysis and task-content extraction.
backend/prompts/agent_automation_en.yaml Adds English prompts for intent analysis and task-content extraction.
backend/database/db_models.py Adds ORM models and partial indexes for automation tables.
backend/database/agent_automation_db.py Adds DB access layer: CRUD, lease ops, claim/renew/release, orphan recovery.
backend/consts/const.py Adds automation runtime configuration env vars.
backend/apps/runtime_app.py Wires automation routers and starts/stops the automation scheduler on lifecycle.
backend/apps/agent_automation_app.py Adds FastAPI endpoints for proposals/tasks/runs and conversation automation lookup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +99 to +102
if spec.mode == ScheduleMode.ONCE:
if fire_count > 0:
return None
next_fire = start_at if start_at >= local_after else local_after
Comment on lines +618 to +622
} catch (error) {
log.warn("Failed to handle automation chat command", error);
const errorMessage =
error instanceof ApiError
? error.message

{/* Button group - only show when hideButtons is false and message is complete */}
{!hideButtons && message.isComplete && (
{!hideButtons && message.isComplete && !automationProposal && (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants