summaryrefslogtreecommitdiff
path: root/agent/agent.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-21 11:39:36 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-21 11:39:36 +0300
commit75fde2a575697f8f46ee9676c0ed228e5315a4e5 (patch)
tree64e02a6afef049eb2ca79a3a5d2b0beb8ba26385 /agent/agent.go
parent1ca75a00642c4e0a6eea3117e3b4ebaacfdcfa7a (diff)
parent5525c946613a6f726cd116d79f1505a63ab25806 (diff)
Merge branch 'master' into doc/tutorial
Diffstat (limited to 'agent/agent.go')
-rw-r--r--agent/agent.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/agent/agent.go b/agent/agent.go
new file mode 100644
index 0000000..8824ecb
--- /dev/null
+++ b/agent/agent.go
@@ -0,0 +1,45 @@
+package agent
+
+// I see two types of agents possible:
+// ones who do their own tools calls
+// ones that works only with the output
+
+// A: main chat -> agent (handles everything: tool + processing)
+// B: main chat -> tool -> agent (process tool output)
+
+// AgenterA gets a task "find out weather in london"
+// proceeds to make tool calls on its own
+type AgenterA interface {
+ ProcessTask(task string) []byte
+}
+
+// AgenterB defines an interface for processing tool outputs
+type AgenterB interface {
+ // Process takes the original tool arguments and the raw output from the tool,
+ // and returns a cleaned/summarized version suitable for the main LLM context
+ Process(args map[string]string, rawOutput []byte) []byte
+}
+
+// registry holds mapping from tool names to agents
+var RegistryB = make(map[string]AgenterB)
+var RegistryA = make(map[AgenterA][]string)
+
+// Register adds an agent for a specific tool name
+// If an agent already exists for the tool, it will be replaced
+func RegisterB(toolName string, a AgenterB) {
+ RegistryB[toolName] = a
+}
+
+func RegisterA(toolNames []string, a AgenterA) {
+ RegistryA[a] = toolNames
+}
+
+// Get returns the agent registered for the given tool name, or nil if none.
+func Get(toolName string) AgenterB {
+ return RegistryB[toolName]
+}
+
+// Register is a convenience wrapper for RegisterB.
+func Register(toolName string, a AgenterB) {
+ RegisterB(toolName, a)
+}