davsclaus opened a new pull request, #30542: URL: https://github.com/apache/camel/pull/30542
_Claude Code on behalf of Claus Ibsen_ ## What A follow-up to #30525 (CAMEL-27312, merged), for [CAMEL-27313](https://issues.apache.org/jira/browse/CAMEL-27313). `camel_runtime_ai_trace` and `camel_runtime_ai_conversation` now read the GenAI calls from the `genai` dev console of #30539 instead of the OpenTelemetry span dump: - They need no tracer and no `camel run --observe`. - The level comes from the console instead of being guessed from span attributes. - Runs are not lost when route spans push them out of the span dump. The tools keep the shape #30525 gave them, the one asked of @Croway there. The span model in camel-jbang-core stays: the TUI Spans tab uses it for one trace. **Depends on #30539 at runtime.** That PR adds the `genai` dev console and the `genai` action of the CLI connector. This PR compiles and tests on main, as it only reads the console's JSON. ## Changes - **New `get_genai` tool** in the shared tool registry (camel-jbang-core). It sends the `genai` action with the `limit`, `id` and `content` options of the console. - **`camel_runtime_ai_trace`** starts with the summary line and the `genAi` part, as before, now from the console: - the model calls per model: tokens in, out and cached, average time, failed calls - the newest 5 agent runs, each with its `runId`, route, exchange id, start, time, tokens and steps in order - at level `full`, each run's question and answer, and the tool arguments and results, cut at 200 characters - when something is missing, the summary says what to do: no console (set a `camel.aiObservability` option such as the level, so that `camel run` adds camel-ai-observability), dev console off, or level `basic` - **`camel_runtime_ai_conversation`** asks the console for the one call by `runId`. It gives the input of the first model call (system instructions and question), then each model call's answer and each tool call's result. The later model calls repeat the history in their input, so only their answers are taken. Empty texts are skipped (a model gives one next to its tool calls). The caps are as before: 1,000 characters a text, 6,000 in all. - The console answer is read without `McpToolNames`, so recorded messages stay as they were. A console that can't be read counts as no GenAI calls (logged at debug), not as an error of the whole call. ## Tried live I ran a camel-openai agent with an `ai-tool` route on Ollama (`llama3.2`) at level `full`, with `camel run`. There was no `--observe`, so no tracer, and no `--console`: the CLI uses the connector action. The app ran with the jars of #30539, and I called the MCP server of this branch over stdio: - `camel_runtime_ai_trace`: `GenAI level=full: 2 agent runs, 4 model calls (llama3.2), 2 tool calls; runs newest first. camel_runtime_ai_conversation with a runId shows the messages of a run.` Each run lists `chat llama3.2` (tool_calls), then `execute_tool lookupOrder {"orderId":"A-17"}` with its result, then `chat llama3.2` (stop), plus its question and answer. - `camel_runtime_ai_conversation` with a `runId`: 5 message parts in order (system, user, the tool call, the tool result, "The status of order A-17 is DELIVERED."). ## Tests - camel-jbang-core: `RuntimeToolsTest` checks that `get_genai` sends the `genai` action with its options. - camel-jbang-mcp: `GenAiTraceReportTest` runs on answers shaped like the console's. It covers: - the summary, the runs and their steps, the newest 5 - level `basic`, no console, dev console off - the route filter - the conversation, with the input on the model call or on the run, and its caps - a run without messages - the answer as read back from the action file All 485 tests of the module pass. Docs: the MCP tools table in `camel-jbang-mcp.adoc`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
