Skip to content

refactor(ai): Adopt whilesmartgo/agents for the assistant core #182

Description

@nfebe

The assistant's engine, tool registry, harness loop, and tool authorization are implemented inline across internal/ai and internal/api, coupled to gin and FlatRun's auth. github.com/whilesmartgo/agents now provides that core as a provider-agnostic, framework-free library. Depend on it and drop the duplicated core, keeping only what is FlatRun-specific.

Checklist

  • Add github.com/whilesmartgo/agents (pinned) as a dependency.
  • Replace the internal/ai provider abstraction (Provider, Message, ToolCall, Request, Response) and the OpenAI-compatible client with the library's Engine and engine/openai.
  • Express the built-in tools (list_deployments, restart_container, run_host_command, and the rest) as agents.Tool values in a Registry, keeping their existing FlatRun implementations.
  • Drive the session tool loop through agents.Runner, supplying Authorize from the current actor and deployment-write gate and Approve from the awaiting-approval flow.
  • Keep the FlatRun-specific parts: the gin handlers, the flat-file session store and its per-user scoping, suggested-action parsing, redaction, and the display/hidden transcript projection.
  • Confirm the assistant behaves identically (auto-run, approval, tool errors, step budget) against the existing tests.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions