AiAgentTools.h header

#include <ew/app/AiAgentTools.h>

Namespace ew::app

WorldEntity struct

struct ew::app::WorldEntity

One entity captured in a WorldSnapshot: its name, its category name (empty when it has none), and its fields (key/value pairs, in the entity's own order).

Members

QString ew::app::WorldEntity::name

The entity's display name.

QString ew::app::WorldEntity::category

The name of the entity's category (empty when it has none).

std::vector<std::pair<QString, QString> > ew::app::WorldEntity::fields

The entity's fields as key/value pairs, in the entity's own order.

bool operator==(const WorldEntity &, const WorldEntity &)=default

Entities compare equal when every field matches.

WorldSnapshot struct

struct ew::app::WorldSnapshot

A read-only, copyable snapshot of the project's codex for agent tools: its entities and the category names, captured at one moment. Take it on the GUI thread with snapshotWorld() and hand the copy to the (off-thread) agent loop, so the worker never reads the live, mutating Project.

Members

std::vector<WorldEntity> ew::app::WorldSnapshot::entities

The codex entities, in project order.

QStringList ew::app::WorldSnapshot::categories

Every category name in the taxonomy.

bool operator==(const WorldSnapshot &, const WorldSnapshot &)=default

Snapshots compare equal when both fields match.

Functions

std::vector< AiToolSpec > ew::app::agentTools()

The read-only tools an AI agent may call to explore the world: search the codex, fetch an entity's full details, and list the codex categories. Returned as provider-agnostic AiToolSpec function definitions (OpenAI-compatible) to attach to an AiRequest. All are read-only – an agent can inspect the world but never mutates it through these.

QString ew::app::executeAgentTool(const WorldSnapshot &world, const AiToolCall &call)

Executes the tool call call against the world snapshot and returns its result as plain text for the model to read. Recognizes the agentTools() functions (search_codex, get_entity, list_categories); returns a clear message for an unknown tool or malformed arguments.

WorldSnapshot ew::app::snapshotWorld(const ew::core::Project &project)

Captures project's entities (name, category, fields) and its category names into a WorldSnapshot. Call on the thread that owns project (typically the GUI thread).