summaryrefslogtreecommitdiff
path: root/agent/pw_agent.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-09 07:50:11 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-09 07:50:11 +0300
commit94769225cfbcd4b0a30acab913915f45d6cb9f4b (patch)
treee85ad71ed37da23db2ddc8289b44742354c057c7 /agent/pw_agent.go
parent0e42a6f069ceea40485162c014c04cf718568cfe (diff)
Enha: agent client redo [WIP]
Diffstat (limited to 'agent/pw_agent.go')
-rw-r--r--agent/pw_agent.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/agent/pw_agent.go b/agent/pw_agent.go
new file mode 100644
index 0000000..8c1c2bf
--- /dev/null
+++ b/agent/pw_agent.go
@@ -0,0 +1,40 @@
+package agent
+
+// PWAgent: is AgenterA type agent (enclosed with tool chaining)
+// sysprompt explain tools and how to plan for execution
+type PWAgent struct {
+ *AgentClient
+ sysprompt string
+}
+
+// NewWebAgentB creates a WebAgentB that uses the given formatting function
+func NewPWAgent(client *AgentClient, sysprompt string) *PWAgent {
+ return &PWAgent{AgentClient: client, sysprompt: sysprompt}
+}
+
+func (a *PWAgent) ProcessTask(task string) []byte {
+ req, err := a.FormFirstMsg(a.sysprompt, task)
+ if err != nil {
+ a.Log().Error("PWAgent failed to process the request", "error", err)
+ return []byte("PWAgent failed to process the request; err: " + err.Error())
+ }
+ toolCallLimit := 10
+ for i := 0; i < toolCallLimit; i++ {
+ resp, err := a.LLMRequest(req)
+ if err != nil {
+ a.Log().Error("failed to process the request", "error", err)
+ return []byte("failed to process the request; err: " + err.Error())
+ }
+ toolCall, hasToolCall := findToolCall(resp)
+ if !hasToolCall {
+ return resp
+ }
+ // check resp for tool calls
+ // make tool call
+ // add tool call resp to body
+ // send new request too lmm
+ tooResp := toolCall(resp)
+ req, err = a.FormMsg(toolResp)
+ }
+ return nil
+}