Skip to content

Claude Code agent chat#317

Open
nealrichardson wants to merge 11 commits intomainfrom
claude-code-agent-chat
Open

Claude Code agent chat#317
nealrichardson wants to merge 11 commits intomainfrom
claude-code-agent-chat

Conversation

@nealrichardson
Copy link
Contributor

From the README:

Claude Chat

A basic chat interface powered by the Claude Agent SDK. This extension serves as a building block for exploring Claude's capabilities on Posit Connect.

Overview

This extension provides a simple chat interface for asking general questions using the Claude Agent SDK. It demonstrates how to authenticate and interact with Claude models on Connect, supporting both direct Anthropic API access and AWS Bedrock.

Features

  • Simple Chat Interface: Clean Shiny-based UI for conversational interactions
  • Claude Agent SDK: Uses Anthropic's official SDK for Claude interactions
  • Flexible Authentication: Supports Anthropic API keys or AWS Bedrock
  • Multi-Turn Conversations: Persistent sessions maintain conversation context across messages
  • Conversation Export: Download conversation history as formatted markdown
  • Automatic Session Cleanup: Stale sessions are cleaned up to prevent memory leaks
  • Cost Tracking: Optional per-request and cumulative session cost display
  • Tool Support: Configurable access to Claude Code tools (Read, Write, Edit, Bash, etc.)

@jonkeane jonkeane requested a review from karawoo February 4, 2026 17:56
Comment on lines +32 to +45
"files": {
"pyproject.toml": {
"checksum": "placeholder"
},
"requirements.txt": {
"checksum": "placeholder"
},
"README.md": {
"checksum": "placeholder"
},
"app.py": {
"checksum": "placeholder"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we include the css as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Claude generated this up front and I didn't revisit it. #318 adds a CLAUDE.md, maybe we can put guidance in it about adding files to the manifest if it adds new files.

Comment on lines +607 to +614
ui.h3("Option 1: Posit Connect AWS Integration (Recommended)", class_="setup-section-title"),
ui.div(
ui.HTML(
"Associate an AWS Integration with this content that has a role granting Bedrock access. "
"Credentials will be obtained automatically at runtime. "
'See <a href="https://docs.posit.co/connect/admin/integrations/aws/" class="setup-link">Connect AWS Integration docs</a>.'
),
class_="setup-description",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a helpful feature, could we also add a note that you need to restart the app after associating the integration? It doesn't happen automatically and that tripped me up for a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, though that's also a bug to fix in Connect. (I wrote up an issue on Monday.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also annoying that there's no restart button in Connect, I did not write that issue though. I did the trick of setting a garbage env var because that does trigger restart.)

CONNECT_INTEGRATION_USED = False


def setup_connect_aws_integration() -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe for a followup PR, but it'd be nice to have some automatic refreshing of these credentials

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will bring that change over from the other version I have of this, I had to fix that today.

1. Verify environment variables are correctly set
2. For Bedrock, ensure `CLAUDE_CODE_USE_BEDROCK=1` is set
3. Check Connect logs for authentication errors

Copy link
Contributor

@karawoo karawoo Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. If running on Connect with an AWS integration, force a restart of the application by editing and saving an environment variable.

"tags": ["python", "shiny", "llm", "chat"],
"requiredFeatures": [],
"minimumConnectVersion": "2025.04.0",
"version": "0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "0.0.0"
"version": "0.0.1"

I think to get this officially added to the extensions this needs to be at least 0.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants