Skip to content

Add agentic functionalities to yeti#1267

Open
tomchop wants to merge 9 commits intomainfrom
agents
Open

Add agentic functionalities to yeti#1267
tomchop wants to merge 9 commits intomainfrom
agents

Conversation

@tomchop
Copy link
Copy Markdown
Collaborator

@tomchop tomchop commented Mar 23, 2026

This pull request introduces a new agent integration feature, enabling proxying and streaming of chat sessions and analytics tasks to an external Agent Service. It adds a new API router for agent-related endpoints, updates system configuration to reflect agent support, and implements an analytics task that interacts with the agent service. Key changes are grouped below.

Agent Integration and API Enhancements:

  • Added a new core/web/apiv2/agents.py API router that proxies chat and session requests to an external Agent Service via HTTP and WebSocket, including streaming responses and bi-directional message forwarding. This includes user authentication and session management.
  • Registered the new agents API router in core/web/webapp.py, mounting it under /agents and protecting it with user authentication dependencies. [1] [2]
  • Updated the system configuration API (core/web/apiv2/system.py) to expose an agents_enabled field, reflecting the new agent integration status. [1] [2]
  • Added agent configuration options (enabled, http_root, websocket_root) to yeti.conf.sample for easy deployment and customization.

Analytics Task Integration:

  • Implemented a new analytics task in plugins/analytics/public/url_extract_investigation.py that streams URL investigation requests to the agent service, parses responses, and creates investigation entities and linked observables in the system.

RBAC and Dependency Updates:

  • Fixed the RBAC decorator in core/schemas/rbac.py to properly await asynchronous route handlers, ensuring correct permission checks for async endpoints.
  • Added the websockets package to dependencies to support WebSocket proxying.

@tomchop tomchop requested a review from udgover March 23, 2026 14:46
Copy link
Copy Markdown
Collaborator

@udgover udgover left a comment

Choose a reason for hiding this comment

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

Few comments related to ws security. Other than that LGTM.

async def chat_proxy_endpoint(httpreq: Request, client_ws: WebSocket):
"""
1. Accepts connection from Vue.js
2. Authenticates user (via Cookie or Query Param).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you think this is enough as a security pov?


enabled = True
http_root = http://agents:8888
websocket_root = ws://agents:8888
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't we enforce wss?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

IMO it'a as complicated as enforcing https - depends a lot on the infrastructure setup you might want to have, certificates, etc. Given this communication is meant to happen within the same docker network I would tend to say I'd leave it up to whoever deploys it to implement wss? WDYT?

Copy link
Copy Markdown
Collaborator

@udgover udgover Mar 24, 2026

Choose a reason for hiding this comment

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

Agree! Maybe we should state this somewhere in the documentation. We let user handle secure deployment to fit their needs.


# Configuration
AGENT_HTTP_BASE = yeti_config.get("agents", "http_root")
AGENT_WEBSOCKET_BASE = yeti_config.get("agents", "websocket_root")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Enforce wss? See comment in sample conf.

FILTER_TAG = "extract_investigation"


class UrlExtractInvestigation(task.AnalyticsTask):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The name is confusing :) I initially thought it was only meant to extract URL from a report. However, correct me if I'm wrong, it's meant to extractr IOCs from a provided URL which corresponds to an article / report.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ah yeah, it's meant to Extract an investigation from a URL! I'm open to suggestions for a better name :) ExtractIocsFromReportUrl ?

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