From 778c365cd9979cc5ab5eb7df8e7ec5d1ab834495 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 22 Jan 2026 11:48:05 +0100 Subject: pkg/aflow: add LLMTool LLMTool acts like a tool for the parent LLM, but is itself implemented as an LLM agent. It can have own tools, different from the parent LLM agent. It can do complex multi-step research, and provide a concise answer to the parent LLM without polluting its context window. --- pkg/aflow/testdata/TestLLMTool.llm.json | 541 ++++++++++++++++++++++++++++++++ 1 file changed, 541 insertions(+) create mode 100644 pkg/aflow/testdata/TestLLMTool.llm.json (limited to 'pkg/aflow/testdata/TestLLMTool.llm.json') diff --git a/pkg/aflow/testdata/TestLLMTool.llm.json b/pkg/aflow/testdata/TestLLMTool.llm.json new file mode 100644 index 000000000..7579aa970 --- /dev/null +++ b/pkg/aflow/testdata/TestLLMTool.llm.json @@ -0,0 +1,541 @@ +[ + { + "Model": "model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "Do something!\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 1, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher description", + "name": "researcher", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Question": { + "description": "Question you have.", + "type": "string" + } + }, + "required": [ + "Question" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "properties": { + "Answer": { + "description": "Answer to your question.", + "type": "string" + } + }, + "required": [ + "Answer" + ], + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "Prompt" + } + ], + "role": "user" + } + ] + }, + { + "Model": "sub-agent-model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "researcher instruction\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 2, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher-tool description", + "name": "researcher-tool", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Something": { + "description": "something", + "type": "string" + } + }, + "required": [ + "Something" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "What do you think?" + } + ], + "role": "user" + } + ] + }, + { + "Model": "sub-agent-model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "researcher instruction\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 2, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher-tool description", + "name": "researcher-tool", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Something": { + "description": "something", + "type": "string" + } + }, + "required": [ + "Something" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "What do you think?" + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionCall": { + "id": "id1", + "args": { + "Something": "subtool input 1" + }, + "name": "researcher-tool" + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionResponse": { + "id": "id1", + "name": "researcher-tool" + } + } + ], + "role": "user" + } + ] + }, + { + "Model": "model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "Do something!\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 1, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher description", + "name": "researcher", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Question": { + "description": "Question you have.", + "type": "string" + } + }, + "required": [ + "Question" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "properties": { + "Answer": { + "description": "Answer to your question.", + "type": "string" + } + }, + "required": [ + "Answer" + ], + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "Prompt" + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionCall": { + "id": "id0", + "args": { + "Question": "What do you think?" + }, + "name": "researcher" + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionResponse": { + "id": "id0", + "name": "researcher", + "response": { + "Answer": "Nothing." + } + } + } + ], + "role": "user" + } + ] + }, + { + "Model": "sub-agent-model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "researcher instruction\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 2, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher-tool description", + "name": "researcher-tool", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Something": { + "description": "something", + "type": "string" + } + }, + "required": [ + "Something" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "But really?" + } + ], + "role": "user" + } + ] + }, + { + "Model": "sub-agent-model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "researcher instruction\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 2, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher-tool description", + "name": "researcher-tool", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Something": { + "description": "something", + "type": "string" + } + }, + "required": [ + "Something" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "But really?" + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionCall": { + "id": "id2", + "args": { + "Something": "subtool input 2" + }, + "name": "researcher-tool" + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionResponse": { + "id": "id2", + "name": "researcher-tool" + } + } + ], + "role": "user" + } + ] + }, + { + "Model": "model", + "Config": { + "systemInstruction": { + "parts": [ + { + "text": "Do something!\nPrefer calling several tools at the same time to save round-trips.\n" + } + ], + "role": "user" + }, + "temperature": 1, + "tools": [ + { + "functionDeclarations": [ + { + "description": "researcher description", + "name": "researcher", + "parametersJsonSchema": { + "additionalProperties": false, + "properties": { + "Question": { + "description": "Question you have.", + "type": "string" + } + }, + "required": [ + "Question" + ], + "type": "object" + }, + "responseJsonSchema": { + "additionalProperties": false, + "properties": { + "Answer": { + "description": "Answer to your question.", + "type": "string" + } + }, + "required": [ + "Answer" + ], + "type": "object" + } + } + ] + } + ], + "responseModalities": [ + "TEXT" + ] + }, + "Request": [ + { + "parts": [ + { + "text": "Prompt" + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionCall": { + "id": "id0", + "args": { + "Question": "What do you think?" + }, + "name": "researcher" + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionResponse": { + "id": "id0", + "name": "researcher", + "response": { + "Answer": "Nothing." + } + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionCall": { + "id": "id2", + "args": { + "Question": "But really?" + }, + "name": "researcher" + } + } + ], + "role": "user" + }, + { + "parts": [ + { + "functionResponse": { + "id": "id2", + "name": "researcher", + "response": { + "Answer": "Still nothing." + } + } + } + ], + "role": "user" + } + ] + } +] \ No newline at end of file -- cgit mrf-deployment