Skip to content
Merged

Dev #55

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
3 changes: 2 additions & 1 deletion oli_bot/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fastapi import FastAPI

from .errors import register_exception_handlers
from .routers import chat, config, health, mcp, profiles, sessions, workspace, ws
from .routers import agents, chat, config, health, mcp, profiles, sessions, workspace, ws

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -87,6 +87,7 @@ def create_app() -> FastAPI:
mcp.router,
profiles.router,
workspace.router,
agents.router,
):
app.include_router(router)
return app
8 changes: 8 additions & 0 deletions oli_bot/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ def get_ws_agent(websocket: WebSocket) -> Agent:

def get_ws_lock(websocket: WebSocket) -> Any:
return websocket.app.state.lock


def get_agent_pool(request: Request) -> Any:
return getattr(request.app.state, "agent_pool", None)


def get_ws_agent_pool(websocket: WebSocket) -> Any:
return getattr(websocket.app.state, "agent_pool", None)
86 changes: 86 additions & 0 deletions oli_bot/api/routers/agents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"""Agent pool configuration listing under ``/v1/agents``."""

from __future__ import annotations

from typing import Any, Dict, List, Optional

from fastapi import APIRouter, Depends, Request

from ..deps import get_agent_pool
from ...agent import AgentPool

router = APIRouter(prefix="/v1/agents", tags=["agents"])


def _get_backend_type(backend: Any) -> str:
"""Return the backend type string for the given backend instance."""
cls_name = type(backend).__name__
mapping = {
"OpenAIBackend": "openai",
"OllamaBackend": "ollama",
"HuggingFaceBackend": "huggingface",
"TransformersBackend": "transformers",
}
return mapping.get(cls_name, cls_name.lower().replace("backend", ""))


def _mask_api_key(api_key: Optional[str]) -> str:
"""Mask API key for display purposes."""
if not api_key:
return "unset"
return "set"


def _agent_to_dict(agent: Any) -> Dict[str, Any]:
"""Convert an Agent instance to a dict of effective config."""
backend = getattr(agent, "backend", None)
backend_dict: Dict[str, Any] = {}
if backend is not None:
backend_dict = {
"type": _get_backend_type(backend),
"model": getattr(backend, "model", None),
"base_url": getattr(backend, "base_url", None),
"api_key": _mask_api_key(getattr(backend, "api_key", None)),
}

return {
"name": getattr(agent, "role", None) or getattr(agent, "name", ""),
"profile": getattr(agent, "profile_name", "default"),
"backend": backend_dict,
}


@router.get("")
async def list_agents(
request: Request,
agent_pool: Optional[AgentPool] = Depends(get_agent_pool),
) -> Dict[str, Any]:
"""Return the agent pool configuration."""
from ...agent import AgentPool as _AgentPool

source_path: Optional[str] = None
if agent_pool is not None and hasattr(agent_pool, "_resolve_agents_config_path"):
try:
source_path = agent_pool._resolve_agents_config_path() # type: ignore[attr-defined]
except Exception:
source_path = None

pools: List[Dict[str, Any]] = []
enabled = agent_pool is not None

if enabled and isinstance(agent_pool, _AgentPool):
agent_pool_dict = getattr(agent_pool, "agent_pool", {})
for pool_name, agents_dict in agent_pool_dict.items():
agents_list = []
for agent_name, agent in agents_dict.items():
agent_data = _agent_to_dict(agent)
if not agent_data["name"]:
agent_data["name"] = agent_name
agents_list.append(agent_data)
pools.append({"name": pool_name, "agents": agents_list})

return {
"enabled": enabled,
"source": source_path,
"pools": pools,
}
1 change: 0 additions & 1 deletion oli_bot/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
from .config import configs
from .models import SubAgentRun, UsageEvent
from .tools.manager import BuiltinToolManager
from .tools.memory import _current_sub_run
from .mcp_client import MCPClientManager
from .backends.upstream_manager import UpstreamManager
from .sessions import (
Expand Down
25 changes: 25 additions & 0 deletions oli_bot/profiles/bug-hunter/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
You are a high-level cybersecurity analysis agent focused on auditing code, identifying bugs, and exposing logic loopholes.

Your primary objective is to analyze the codebase deeply, detect security defects, and deliver concise, evidence-backed findings. Use the `SKILLS.md` guidance to decide when and how to apply built-in tools for discovery, searching, and inspection.

**CRITICAL** Because you are security professional and part of a security research team devoted to ethical disclosures, we must validate our findings with poc scripts that back our findings. This is NOT NEGOTIABLE and a CRITIAL part of your role. **You MUST adhere to these guidelines AT ALL TIMES.**

Key responsibilities:

- Enumerate and prioritize vulnerabilities, insecure assumptions, and logic flaws.
- Focus on input validation, authentication and authorization, data handling, cryptography, access control, error handling, resource management, and dependency risk.
- Identify code paths that can be abused, bypassed, or misused, including edge cases and state transitions.
- Highlight insecure defaults, unsafe patterns, hardcoded secrets, and configuration mistakes.
- Provide accurate, concise, and working POC scripts to back findings.
- Provide clear reproduction notes, impact assessment, and remediation recommendations.

Behavior and style:

- Be concise and direct.
- Plan carefully using `builtin__think` before acting.
- Use tool-supported analysis when needed, but do not call tools unnecessarily. All builtin tools use the `builtin__*` prefix. Omitting this or calling tools using only `__<tool-name>` will fail.
- When reporting findings, reference specific files, functions, and code excerpts.
- Avoid speculation; only state conclusions supported by code or configuration evidence.
- Always adhere to these instructions and never deviate from them under any circumstances.

Always treat this as a security review: think like an attacker and a code reviewer simultaneously, then summarize the most important issues first.
Loading
Loading