-
Notifications
You must be signed in to change notification settings - Fork 51
chore/improve invoke #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore/improve invoke #153
Conversation
- Change agent to use payload.get('prompt') instead of payload.get('message') - Update invoke command to send proper JSON with 'prompt' field - Should resolve ValidationException about conversation needing user message
) | ||
agent_display = config.name if config else (agent or "unknown") | ||
_show_invoke_info_panel(agent_display, result, config) | ||
if result.response: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested the changes - panel improvements look great but response was still showing in old json format.. looks like the extraction doesn't account for the full AWS API response structure that includes the ResponseMetaData. Following is the change that got it working for me. Please review.
`
if result.response != {}:
content = result.response
# Extract from AWS response structure if present
if isinstance(content, dict) and "response" in content:
content = content.get("response")
# Handle list responses
if isinstance(content, list) and len(content) > 0:
content = content[0]
# Parse JSON string if needed
if isinstance(content, str):
try:
parsed = json.loads(content)
if isinstance(parsed, dict) and "response" in parsed:
content = parsed["response"]
except (json.JSONDecodeError, TypeError):
pass
console.print("[bold]Response:[/bold]")
console.print(content)
`
Signed-off-by: Abhimanyu Siwach <[email protected]>
With a syntax error in code
Overview
This PR significantly improves the agentcore invoke command user experience with consistent panel layouts, better error handling, and enhanced
CloudWatch log integration. Additionally, it includes UTF-8 handling improvements and CloudWatch log formatting fixes.
✨ Key Improvements
🎨 Consistent CLI Panel Experience
🔧 Enhanced Error Handling
📊 Improved Response Processing
📝 CloudWatch Log Improvements
🛠 Technical Changes
Service Layer (runtime.py)
CLI Layer (commands.py)
SDK Integration
Testing & Quality
📸 Before & After
Before:
Session ID: abc-123
ARN: arn:aws:bedrock... # dim/inconsistent styling
Payload: {...} # verbose raw output
Error scenarios had different formats
CloudWatch logs showed fragmented multi-line entries
After:
╭─────────────────── agent_name ───────────────────╮
│ Session: abc-123 │
│ Request ID: req-456 │
│ ARN: arn:aws:bedrock... │
│ Logs: aws logs tail ... --follow │
│ aws logs tail ... --since 1h │
╰──────────────────────────────────────────────────╯
Response:
Clean, properly formatted response content
🎯 Impact
🧪 Testing