[Enhancement]: Add Go (v2) example: Converse API with extended/adaptive thinking (Bedrock Runtime)
Maintainers usually reply within 2 days
@brmur is already working on this.
Since Aug 24, 2026.
Assessment
This issue has not been assessed yet.
Description
Background story
The Bedrock Runtime docs for extended thinking and adaptive thinking
(https://docs.aws.amazon.com/bedrock/latest/userguide/claude-messages-extended-thinking.html
and .../claude-messages-adaptive-thinking.html) only include CLI, Python,
and TypeScript code snippets. There's no Go (v2) example anywhere in the
docs or in this repo's gov2/bedrock-runtime folder showing how to enable
thinking through the Converse API or how to parse the resulting
reasoningContent block from the response.
I had to reverse-engineer the correct approach from the generated SDK
type definitions on pkg.go.dev rather than from any example, which is
error-prone (union member names, pointer vs. value fields, etc. aren't
obvious without a working reference). A canonical Go example would save
other Go developers the same trial and error.
What does this example accomplish?
Shows how to call the Converse API with thinking enabled on a Claude
model on Bedrock, and how to read the reasoning content back out of the
response alongside the normal text block. Specifically it should cover:
- Setting additionalModelRequestFields via the bedrockruntime/document
package to enable thinking (both the newer adaptive mode with an
effort level, and the older manual mode with budget_tokens, since
support differs by model). - Setting InferenceConfig.MaxTokens appropriately alongside thinking.
- Parsing types.ContentBlockMemberReasoningContent out of the response
message content, distinct from types.ContentBlockMemberText. - A note on when ConverseStream is required instead of Converse (e.g.
once MaxTokens exceeds the streaming threshold).
Which AWS service(s)?
Amazon Bedrock Runtime (Converse API)
Which AWS SDKs or tools?
- All languages
- .NET
- C++
- Go (v2)
- Java
- Java (v2)
- JavaScript
- JavaScript (v3)
- Kotlin
- PHP
- Python
- Ruby
- Rust
- Swift
- Not applicable
Are there existing code examples to leverage?
- gov2/bedrock-runtime already has a basic ConverseClaude example
(text-only, no thinking) that this could extend or sit alongside:
https://docs.aws.amazon.com/code-library/latest/ug/go_2_bedrock-runtime_code_examples.html - The Python and TypeScript snippets on the adaptive thinking doc page
show the shape of the additionalModelRequestFields payload, just not
in Go:
https://docs.aws.amazon.com/bedrock/latest/userguide/claude-messages-adaptive-thinking.html
Do you have any reference code?
thinkingConfig := document.NewLazyDocument(map[string]interface{}{
"thinking": map[string]interface{}{
"type": "adaptive",
"effort": "high",
},
})
input := &bedrockruntime.ConverseInput{
ModelId: aws.String("us.anthropic.claude-opus-4-6-v1"),
Messages: []types.Message{message},
InferenceConfig: &types.InferenceConfiguration{
MaxTokens: aws.Int32(16000),
},
AdditionalModelRequestFields: thinkingConfig,
}
response, err := client.Converse(ctx, input)
if err != nil {
log.Fatalf("Error calling model: %v", err)
}
if msg, ok := response.Output.(*types.ConverseOutputMemberMessage); ok {
for _, block := range msg.Value.Content {
switch v := block.(type) {
case *types.ContentBlockMemberReasoningContent:
if rt, ok := v.Value.(*types.ReasoningContentBlockMemberReasoningText); ok {
fmt.Println("--- Thinking ---")
fmt.Println(aws.ToString(rt.Value.Text))
}
case *types.ContentBlockMemberText:
fmt.Println(v.Value)
}
}
}
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 5.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from awsdocs/aws-doc-sdk-examples
-
Modify ListObjectVersions to also show how do list versions of only a single objectMay be free again @brmur claimed this 163 days ago, and no pull request is open. OpenTask
awsdocs/aws-doc-sdk-examples#7914 · 1 assignee ·
Maintainers usually reply within 2 days
-
Create Rust DynamoDB GetItem single action exampleMay be free again @brmur claimed this 171 days ago, and no pull request is open. OpenNew example request Rust
awsdocs/aws-doc-sdk-examples#7913 · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug]: CloudWatch Logs Large Query Scenario - Offset BugMay be free again @rlhagerm claimed this 198 days ago, and no pull request is open. Open
awsdocs/aws-doc-sdk-examples#7873 · 1 assignee ·
Maintainers usually reply within 2 days
-
[Enhancement]: Update S3 Go code examples to use feature/s3/transfermanager instead of deprecated feature/s3/managerMay be free again @brmur claimed this 198 days ago, and no pull request is open. Open
awsdocs/aws-doc-sdk-examples#7872 · 3 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Enhancement]: Add Amazon Nova Converse API example for Go SDK v2 (bedrock-runtime)May be free again @rlhagerm claimed this 205 days ago, and no pull request is open. OpenNew example request
awsdocs/aws-doc-sdk-examples#7812 · 2 comments · 1 assignee ·
Maintainers usually reply within 2 days
All issues in awsdocs/aws-doc-sdk-examples
Similar issues
-
面渣逆袭Spring事务传播机制勘误Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
itwanger/toBeBetterJavaer#218 ·
-
Markdown and Astro language servers do not start when the project path contains a non-ASCII character or a spacePossibly taken @RoiSoleil claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-wildwebdeveloper/wildwebdeveloper#2277 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
johanhaleby/occurrent#1462 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
SasanLabs/VulnerableApp#912 ·
Maintainers usually reply within 1 day
-
area/build area/events area/storage area/storage/kafkasql area/storage/sql
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apicurio/apicurio-registry#11079 ·
Maintainers usually reply within 1 day