跳至内容

Bedrock agent invokation does not return "returnControl" element

0

All, in my Python call i am trying to invoke my agent. Agent is instructed to call a specific function for certain condition. Call Is: agent = BedrockAgent(agentAliasId='...',agentId='...') response = agent.invokeWithFunction( enableTrace=True, endSession=False, prompt='provede...', ) in a console agent asks for specific function information. in Python, trace is also indicates that function should be invilved. The problem is that is i do not see returnControl element in response. Agent and Agent alias are verified and action is "return control" in a console definition. Any help would be appreciated Thank you Yevgeniy

已提问 2 年前1029 查看次数
3 回答
1
已接受的回答

That was a bug in boto3. Latest version - 1.34.111 - works

已回答 2 年前
专家
已审核 2 年前
0

Hello.

If you execute invoke_agent() as is, the response will include "returnControl".
Have you tried running invoke_agent()?
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/invoke_agent.html

专家
已回答 2 年前
0

yes, and it does not return "returnControl".

class BedrockAgent: def init(self, agentId = "..", agentAliasId= "", name = "bedrock-agent-runtime", verify = False): self.agentId = agentId self.agentAliasId = agentAliasId self.client = boto3.client(name, verify=verify)

def invokeWithFunction(self, prompt, enableTrace=False, endSession=True, sessionId=str(uuid.uuid4())): response = self.client.invoke_agent( agentAliasId= self.agentAliasId, agentId=self.agentId, enableTrace=enableTrace, endSession=endSession, inputText=prompt, sessionId=sessionId) return response


agent = BedrockAgent(agentAliasId='...',agentId='...') response = agent.invokeWithFunction( enableTrace=True, endSession=False, prompt='please find ...', ) completion = response.get("completion") if completion: for event in completion: print("----------- Event -----------------") print(event)

Thank you, YK

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。