- Newest
- Most votes
- Most comments
That was a bug in boto3. Latest version - 1.34.111 - works
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
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
Relevant content
- asked 2 months ago
- asked 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
By the way, have you created an action group? If you haven't already done so, try creating an action group in the Bedrock agent. https://docs.aws.amazon.com/bedrock/latest/userguide/agents-action-create.html
yes, i did. it works properly in a console. agentid and alias - aka version - are also verified