Skip to content

[Sig Events] Add significant events management skill + tools#271430

Open
mykolaharmash wants to merge 9 commits into
elastic:mainfrom
mykolaharmash:sig-events-management-agent-skill
Open

[Sig Events] Add significant events management skill + tools#271430
mykolaharmash wants to merge 9 commits into
elastic:mainfrom
mykolaharmash:sig-events-management-agent-skill

Conversation

@mykolaharmash
Copy link
Copy Markdown
Contributor

@mykolaharmash mykolaharmash commented May 27, 2026

This PR adds a new Significant Events management skill plus built-in tools for searching, creating, and updating event verdicts.

  • Added a new significant-events-management skill with workflow guidance and examples
  • Added new built-in tools: event_search, event_create, and event_verdict_update
  • Updated kbn-streams-schema to share SigEvent verdict/impact option schemas
  • Made several SigEvent fields optional in schema (discovery_id, discovery_slug, verdict_id, workflow_execution_id, rule_names) as they cannot be set when sig events are created by an agent directly.
CleanShot.2026-05-27.at.13.59.28-converted.2.mp4

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

@mykolaharmash, it looks like you're updating the parameters for a rule type!

Please review the guidelines for making additive changes to rule type parameters and determine if your changes require an intermediate release.

@github-actions
Copy link
Copy Markdown
Contributor

A documentation preview will be available soon.

Request a new doc build by commenting
  • Rebuild this PR: run docs-build
  • Rebuild this PR and all Elastic docs: run docs-build rebuild

run docs-build is much faster than run docs-build rebuild. A rebuild should only be needed in rare situations.

If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status here.

@mykolaharmash mykolaharmash force-pushed the sig-events-management-agent-skill branch from 2c414f8 to 8b47bb4 Compare May 27, 2026 14:19
@mykolaharmash mykolaharmash requested a review from Copilot May 28, 2026 08:31
@mykolaharmash mykolaharmash marked this pull request as ready for review May 28, 2026 08:31
@mykolaharmash mykolaharmash requested review from a team as code owners May 28, 2026 08:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Significant Events (SigEvents) management support to Streams Agent Builder by introducing a new skill and new built-in tools for searching, creating, and updating SigEvents, while centralizing shared SigEvent verdict/impact schemas in @kbn/streams-schema.

Changes:

  • Added significant-events-management skill content and registered it as an allow-listed built-in skill.
  • Implemented new SigEvents tools: event_search, event_create, and event_verdict_update, including telemetry events for create/update.
  • Centralized verdict/impact option constants + schemas in @kbn/streams-schema and updated UI to consume shared verdict options.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
x-pack/platform/plugins/shared/streams_app/public/components/sig_events/significant_events_discovery/components/sig_events_tab/index.tsx Switches verdict filter options to shared schema constants.
x-pack/platform/plugins/shared/streams_app/public/components/sig_events/significant_events_discovery/components/sig_events_tab/filter_constants.ts Aligns verdict typing with schema; adds impact color mapping.
x-pack/platform/plugins/shared/streams/server/routes/internal/sig_events/events/route.ts Adjusts lifecycle route to handle missing discovery_slug.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/types.ts Adds telemetry prop types for event create and verdict update tools.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/service.ts Registers new telemetry event types.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/schemas.ts Adds telemetry schemas for event create and verdict update.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/events.ts Declares new telemetry event types mapping to schemas.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/constants.ts Defines string constants for new telemetry event types.
x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/client.ts Adds client methods to report new telemetry events.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/register_tools.ts Registers new SigEvents tools and exports tool IDs.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/register_tools.test.ts Extends tool registration test coverage for new tool IDs.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_verdict_update/tool.ts Adds built-in tool to update an event’s verdict (with telemetry).
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_verdict_update/tool.test.ts Adds tests for the verdict update tool wrapper.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_verdict_update/handler.ts Implements verdict update handler creating a new event version.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_verdict_update/handler.test.ts Adds unit tests for verdict update handler logic.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_search/tool.ts Adds built-in tool to search significant events.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_search/tool.test.ts Adds tests for the event search tool wrapper.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_search/handler.ts Implements search handler mapping tool params to client API.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_search/handler.test.ts Adds unit tests for search handler param mapping.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_create/tool.ts Adds built-in tool to create significant events (with telemetry + confirmation).
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_create/tool.test.ts Adds tests for the event create tool wrapper.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_create/handler.ts Implements event creation handler producing a SigEvent document.
x-pack/platform/plugins/shared/streams/server/agent_builder/tools/event_create/handler.test.ts Adds unit tests for event creation handler.
x-pack/platform/plugins/shared/streams/server/agent_builder/skills/sig_events_management/skill.md.text Adds workflow guidance and examples for SigEvents management.
x-pack/platform/plugins/shared/streams/server/agent_builder/skills/sig_events_management/index.ts Defines and exposes the new skill with its tool dependencies.
x-pack/platform/plugins/shared/streams/server/agent_builder/skills/sig_events_management/description.text Adds the skill description text.
x-pack/platform/plugins/shared/streams/server/agent_builder/skills/register_skills.ts Registers the new SigEvents management skill.
x-pack/platform/packages/shared/kbn-streams-schema/src/sig_events/index.ts Re-exports verdict/impact schemas, types, and options for reuse.
x-pack/platform/packages/shared/kbn-streams-schema/src/sig_events/events/index.ts Introduces shared verdict/impact schemas and relaxes optional SigEvent fields.
x-pack/platform/packages/shared/kbn-streams-schema/index.ts Exposes new SigEvent schema exports at package root.
x-pack/platform/packages/shared/agent-builder/agent-builder-server/allow_lists.ts Allow-lists the new built-in skill.
x-pack/platform/packages/shared/agent-builder/agent-builder-common/tools/constants.ts Adds tool IDs for SigEvents search/create/verdict update.

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

Comment thread x-pack/platform/plugins/shared/streams/server/lib/telemetry/ebt/types.ts Outdated
@mykolaharmash mykolaharmash force-pushed the sig-events-management-agent-skill branch from 5e4fd7f to 817a07c Compare May 28, 2026 08:40
Copy link
Copy Markdown
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

I haven't tested it, just had a quick look at the code. Looks pretty cool.

STREAMS_SEARCH_KNOWLEDGE_INDICATORS_TOOL_ID,
STREAMS_SEARCH_EVENTS_TOOL_ID,
STREAMS_CREATE_EVENT_TOOL_ID,
STREAMS_EVENT_VERDICT_UPDATE_TOOL_ID,
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.

Verdict will be dropped soon https://github.com/elastic/streams-program/pull/1390. We'll only have events. Just flagging it. I'm not sure if we should already discount it here or as a follow-up. up to you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But events still have a verdict property, right? The tool only changes the verdict on an event, doesn't create a verdict document.

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.

The term verdict itself will be dropped too. Probably status makes more sense

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed to status in e001d97.

Haven't touched the SigEvent schema, assuming it will be renamed as part of your change.

Comment on lines +99 to +105
- `criticality`:
- Number in range 0..100 indicating system criticality.
- Suggested scale:
- 0-30 low
- 31-60 medium
- 61-80 high
- 81-100 critical
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.

just FYI: criticality will be renamed to severity soon.

Comment on lines +110 to +111
- `impact`:
- Always set to exactly one of: `critical`, `high`, `medium`, `low`.
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.

Making LLMs assign impact makes me a bit nervous. This was something done for the prototype, but we need to review if we want this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's see, if we decide to get rid of it, I'll follow up with the skill change.

"criticality": 86,
"confidence": 0.84,
"impact": "high",
"recommended_action": "Scale checkout pods and increase upstream timeout budget temporarily.",
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.

This diverges from what the workflow does. In fact, I feel like this field is a dead weight. It's deterministic in the workflow and I'm not sure it adds more value than recommendations

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it, I'll make it optional on the schema remove it from the skill for now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 47adb29

'@timestamp': now,
created_at: now,
event_id: eventId,
discovery_slug: `agent-event-${eventId.slice(0, 8)}`,
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.

This will also diverge from what discovery workflows expect. We'll need to find better ways for this as a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, agree, this field bothers me as well. I'll update the tool and the skill once we settle on a better solution, for now I added it because we use discovery_slug as a grouping key.

@@ -0,0 +1,167 @@
You manage Significant Events (SigEvents) for Streams.
Copy link
Copy Markdown
Contributor

@crespocarlos crespocarlos May 28, 2026

Choose a reason for hiding this comment

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

q: was this based on the current investigator or judge agent instructions?

it will be great to use this in the workflows

Copy link
Copy Markdown
Contributor Author

@mykolaharmash mykolaharmash May 29, 2026

Choose a reason for hiding this comment

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

Not really based on the agents, I just tried to tune it to the conversation flow with agent discovering and proactively suggesting sig events to the user. LLM generated the first draft and I tweaked it after experimenting with the chat.

recommendations: string[];
}

export async function createEventToolHandler({
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.

To confirm, we'll have events without a corresponding discovery and detections. correct? I wonder what will happen to the workflows once it sees these docs.

Copy link
Copy Markdown
Contributor Author

@mykolaharmash mykolaharmash May 29, 2026

Choose a reason for hiding this comment

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

Yes, correct. Would it make sense to add some ignore logic into the workflow for this kind of "manual" events?

message: i18n.translate(
'xpack.streams.agentBuilder.tools.eventCreate.confirmation.message',
{
defaultMessage: 'Create significant event "{title}"?',
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.

Should we mention the stream in this message?

verdict: EventVerdict;
}): Promise<{ event_id: string; updated: number; ignored: number; verdict: EventVerdict }> {
const { hits } = await eventClient.findById(eventId);
const latest = hits[hits.length - 1];
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.

Why not sort by timestamp?

Copy link
Copy Markdown
Contributor Author

@mykolaharmash mykolaharmash May 29, 2026

Choose a reason for hiding this comment

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

Not sure I get what you mean, it's sorted inside runFindByIdEsqlQuery with @timestamp ASC

@crespocarlos
Copy link
Copy Markdown
Contributor

One thing I just thought is that we need to ensure these changes are reflected in the workflow's agents. We also need these changes on the skill side, keeping up with updates on schemas and indices.

This skill replaces a bunch of lines of instructions and will help standardize what agents need to do WRT sigevent discovery.

@mykolaharmash mykolaharmash added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Feature:SigEvents Significant events feature, related to streams and rules/alerts (RnA) labels May 28, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
agentBuilder 1.9MB 1.9MB +63.0B
datasetQuality 540.7KB 541.0KB +288.0B
streamsApp 2.1MB 2.1MB +275.0B
total +626.0B

History

Copy link
Copy Markdown
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

Tested the basic flow, everything works. Left some nits

STREAMS_SEARCH_KNOWLEDGE_INDICATORS_TOOL_ID,
STREAMS_SEARCH_EVENTS_TOOL_ID,
STREAMS_CREATE_EVENT_TOOL_ID,
STREAMS_EVENT_VERDICT_UPDATE_TOOL_ID,
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.

The term verdict itself will be dropped too. Probably status makes more sense

import { v4 as uuidv4 } from 'uuid';
import type { EventClient } from '../../../lib/sig_events/events';

type EventVerdict = 'promoted' | 'acknowledged' | 'demoted';
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.

SigEventVerdict?

created_at: now,
event_id: eventId,
discovery_slug: `agent-event-${eventId.slice(0, 8)}`,
verdict: eventInput.verdict ?? 'promoted',
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.

Should the default be promoted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think so, if the user decides explicitly to create a sig event, I assume it's about something ongoing that they just discovered.

Though there might be cases when user wants to save a sig event as a draft and do additional investigation before promoting it, we might need to introduce this additional draft state. WDYT?

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.

We could leave it as-is and iterate. I'm keen to use it in the sigevent agents; eventually, these things will be refined.

@mykolaharmash
Copy link
Copy Markdown
Contributor Author

@crespocarlos I pushed renaming to verdict into status, please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:SigEvents Significant events feature, related to streams and rules/alerts (RnA) release_note:skip Skip the PR/issue when compiling release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants