MCPcopy Create free account
hub / github.com/THUDM/AgentBench / interaction

Function interaction

src/client/agent_test.py:15–32  ·  view source on GitHub ↗
(agent: AgentClient)

Source from the content-addressed store, hash-verified

13
14
15def interaction(agent: AgentClient):
16 try:
17 history = []
18 while True:
19 print("================= USER ===================")
20 user = input(">>> ")
21 history.append({"role": "user", "content": user})
22 try:
23 agent_response = agent.inference(history)
24 print("================ AGENT ====================")
25 print(agent_response)
26 history.append({"role": "agent", "content": agent_response})
27 except Exception as e:
28 print(e)
29 exit(0)
30 except KeyboardInterrupt:
31 print("\n[Exit] KeyboardInterrupt")
32 exit(0)
33
34
35if __name__ == '__main__':

Callers 1

agent_test.pyFile · 0.85

Calls 1

inferenceMethod · 0.45

Tested by

no test coverage detected