Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/claude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ jobs:
### 3. Security Review (CRITICAL)
Review for these vulnerabilities:
- 🔒 SQL injection vulnerabilities
- 🔒 Command injection (especially in shell tools, Bash usage — see `src/gaia/agents/chat/tools/shell_tools.py` for sandboxed pattern)
- 🔒 Command injection (especially in shell tools, Bash usage — see `src/gaia/agents/tools/shell_tools.py` for sandboxed pattern)
- 🔒 XSS vulnerabilities (web UIs, HTML generation — check `src/gaia/ui/` and `src/gaia/apps/webui/`)
- 🔒 Secrets exposure (API keys, tokens in code/logs)
- 🔒 Path traversal vulnerabilities (flag any user-supplied path without `pathlib` safety)
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/test_chat_agent.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

# This workflow tests the GAIA Chat Agent functionality
# Tests include: Session persistence, chat history, RAG, and path validation
# This workflow tests the GAIA Chat Agent, which ships as the standalone
# gaia-agent-chat wheel (#1102). Tests include the wheel's own smoke tests
# plus the framework-side session, RAG, and path-validation suites.

name: Chat Agent Tests

Expand All @@ -11,8 +12,9 @@ on:
push:
branches: [ main ]
paths:
- 'src/gaia/agents/chat/**'
- 'hub/agents/python/chat/**'
- 'src/gaia/agents/base/**'
- 'src/gaia/agents/tools/**'
- 'src/gaia/rag/**'
- 'src/gaia/chat/**'
- 'tests/test_chat_agent.py'
Expand All @@ -23,8 +25,9 @@ on:
branches: [ main ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/gaia/agents/chat/**'
- 'hub/agents/python/chat/**'
- 'src/gaia/agents/base/**'
- 'src/gaia/agents/tools/**'
- 'src/gaia/rag/**'
- 'src/gaia/chat/**'
- 'tests/test_chat_agent.py'
Expand Down Expand Up @@ -67,6 +70,19 @@ jobs:
uv pip install --system -e .[dev,rag]
# Install pytest-mock for mocking tests
uv pip install --system pytest-mock
# ChatAgent ships as the standalone gaia-agent-chat wheel (#1102)
uv pip install --system -e hub/agents/python/chat

- name: Run Chat Agent Package Tests
env:
GAIA_MEMORY_DISABLED: "1"
run: |
echo "================================================================"
echo " CHAT AGENT PACKAGE TESTS"
echo "================================================================"
echo "Testing registration shapes, lazy re-exports, and discovery..."
echo ""
python -m pytest hub/agents/python/chat/tests/ -v --tb=short

- name: Run Chat Agent Unit Tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"name": "Chat Agent Debug - Model Selection",
"type": "debugpy",
"request": "launch",
"module": "gaia.agents.chat.app",
"module": "gaia_agent_chat.app",
"args": ["--query", "hi"],
"cwd": "${workspaceFolder}",
"env": {
Expand Down
24 changes: 24 additions & 0 deletions hub/agents/python/chat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# gaia-agent-chat

Standalone GAIA agent — the conversational ChatAgent, shipped under three prompt
profiles: `chat` (general conversation), `doc` (document Q&A with RAG), and
`file` (file-system navigation/search). Depends on the published `amd-gaia`
framework wheel.

## Install

```bash
pip install gaia-agent-chat # from PyPI (once published)
pip install -e hub/agents/python/chat # editable, for development
```

Installing registers the `chat`, `doc`, and `file` agents via the `gaia.agent`
entry-point group; the GAIA registry discovers them automatically, so
`gaia chat` (including `gaia chat --ui`) resolves the agent through the registry.

## Develop / test

```bash
pip install -e ".[test]"
pytest hub/agents/python/chat/tests/ -x
```
32 changes: 32 additions & 0 deletions hub/agents/python/chat/gaia-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
id: chat
name: Chat
version: 0.1.0
description: "GAIA chat agent — conversation, document Q&A (RAG), and file-system profiles"
author: AMD
license: MIT

category: conversation
tags: [chat, general, personality, rag, files]
icon: message-circle
tools_count: 0

language: python
min_gaia_version: "0.20.0"
models: []

python:
entry_module: gaia_agent_chat
entry_class: ChatAgent
dependencies:
- "amd-gaia>=0.20.0"

requirements:
min_memory_gb: 8
platforms: [win-x64, linux-x64, darwin-arm64]

interfaces:
tui: true
cli: true
pipe: true
api_server: true
mcp_server: true
147 changes: 147 additions & 0 deletions hub/agents/python/chat/gaia_agent_chat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Copyright(C) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
"""GAIA Chat agent — standalone hub package.

Ships the conversational ChatAgent under three prompt profiles, each registered
as its own agent id via the ``gaia.agent`` entry-point group:

* ``chat`` — general conversation (lean prompt, no document tools)
* ``doc`` — document Q&A with RAG
* ``file`` — file-system navigation/search

Public names are re-exported lazily so registry discovery stays cheap. The
registry's ``_discover_installed_agents`` stamps ``source="installed"``, the
``installed:<id>`` namespaced id, and the namespaced-id factory wrapper.
"""

__all__ = ["build_chat", "build_doc", "build_file"]

__version__ = "0.1.0"

_LAZY = {
"ChatAgent": "agent",
"ChatAgentConfig": "agent",
"ChatAgentLite": "lite_agent",
}


def __getattr__(name):
if name in _LAZY:
import importlib

module = importlib.import_module(f"gaia_agent_chat.{_LAZY[name]}")
return getattr(module, name)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


def _make_factory(profile, extra=None, tiers=None):
"""ChatAgent factory honouring a ``model_tier`` kwarg (#1162)."""
import dataclasses

from gaia.agents.registry import _select_tier_model

_extra = dict(extra or {})
_tiers = list(tiers or [])

def factory(**kwargs):
tier = kwargs.pop("model_tier", None)
if tier:
preset = _select_tier_model(_tiers, tier)
if preset:
kwargs.setdefault("model_id", preset)

from gaia_agent_chat.agent import ChatAgent, ChatAgentConfig

valid_fields = {f.name for f in dataclasses.fields(ChatAgentConfig)}
filtered = {k: v for k, v in kwargs.items() if k in valid_fields}
filtered.setdefault("prompt_profile", profile)
for k, v in _extra.items():
filtered.setdefault(k, v)
return ChatAgent(config=ChatAgentConfig(**filtered))

return factory


def build_chat():
"""Return the :class:`AgentRegistration` for the ``chat`` profile."""
from gaia.agents.registry import AgentRegistration, build_model_tiers

tiers = build_model_tiers("Full")
return AgentRegistration(
id="chat",
name="Chat",
description="General conversation — fast, personality-first, no document tools",
source="installed",
conversation_starters=[
"What can you help me with?",
"Tell me about yourself",
"What's new today?",
],
factory=_make_factory("chat", tiers=tiers),
agent_dir=None,
models=[],
required_connections=[],
# Mirrors ChatAgent.CONSUMES_MCP_SERVERS — the lazy factory must not
# import the chat module at discovery time. A guard test keeps these
# in sync.
consumes_mcp_servers=True,
category="conversation",
tags=["chat", "general", "personality"],
icon="message-circle",
tools_count=0,
model_tiers=tiers,
)


def build_doc():
"""Return the :class:`AgentRegistration` for the ``doc`` profile."""
from gaia.agents.registry import AgentRegistration, build_model_tiers

tiers = build_model_tiers("Full")
return AgentRegistration(
id="doc",
name="Doc Agent",
description="Document Q&A with RAG — ask questions about PDFs, reports, and manuals",
source="installed",
conversation_starters=[
"Search my documents for...",
"Summarize this document",
"What does the report say about...",
],
factory=_make_factory("doc", tiers=tiers),
agent_dir=None,
models=[],
required_connections=[],
category="documents",
tags=["rag", "files", "search", "mcp"],
icon="file-text",
tools_count=15,
model_tiers=tiers,
)


def build_file():
"""Return the :class:`AgentRegistration` for the ``file`` profile."""
from gaia.agents.registry import AgentRegistration, build_model_tiers

tiers = build_model_tiers("Full")
return AgentRegistration(
id="file",
name="File Agent",
description="File system navigation, search, and analysis",
source="installed",
conversation_starters=[
"Find files related to...",
"What's in my Documents folder?",
"Show me the project structure",
],
factory=_make_factory("file", extra={"enable_filesystem": True}, tiers=tiers),
agent_dir=None,
models=[],
required_connections=[],
category="productivity",
tags=["files", "search", "filesystem", "shell"],
icon="folder-search",
tools_count=10,
model_tiers=tiers,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from gaia.agents.base.memory import MemoryMixin
from gaia.agents.base.tool_loader import ToolLoader
from gaia.agents.base.tools import _TOOL_REGISTRY
from gaia.agents.chat.session import SessionManager
from gaia.agents.chat.tools import FileToolsMixin
from gaia_agent_chat.session import SessionManager
from gaia.agents.tools import FileToolsMixin
from gaia.agents.tools import FileSystemToolsMixin # Enhanced file system navigation
from gaia.agents.tools import ScratchpadToolsMixin # Structured data analysis
from gaia.agents.tools import ( # Web browsing and search; Shared tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
from pathlib import Path

from gaia.agents.chat.agent import ChatAgent, ChatAgentConfig
from gaia_agent_chat.agent import ChatAgent, ChatAgentConfig
from gaia.logger import get_logger

logger = get_logger(__name__)
Expand Down
24 changes: 24 additions & 0 deletions hub/agents/python/chat/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "gaia-agent-chat"
version = "0.1.0"
description = "GAIA chat agent — conversation, document Q&A (RAG), and file-system profiles"
authors = [{ name = "AMD" }]
license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["amd-gaia>=0.20.0"]

[project.entry-points."gaia.agent"]
chat = "gaia_agent_chat:build_chat"
doc = "gaia_agent_chat:build_doc"
file = "gaia_agent_chat:build_file"

[project.optional-dependencies]
test = ["pytest"]

[tool.setuptools.packages.find]
include = ["gaia_agent_chat*"]
Loading
Loading