Skip to content

LiteLLM-Labs/agentcore-opencode-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentCore OpenCode POC

Minimal Amazon Bedrock AgentCore Runtime container that exposes:

  • GET /ping
  • POST /invocations

The AgentCore adapter starts opencode serve inside the container and maps each AgentCore runtime session to an OpenCode session. POST /invocations calls the OpenCode server's session message API and streams the returned OpenCode parts over SSE.

There is no direct Bedrock fallback route. If OpenCode fails, the stream returns an opencode_error so the control plane cannot mistake fallback output for an OpenCode response. The default model is Claude Sonnet 4.5 through the Bedrock inference profile because that path is accepted by OpenCode's Bedrock provider.

Build

docker build --platform linux/arm64 -t opencode-agentcore-poc:latest .

Local Smoke Test

docker run --rm -p 8080:8080 \
  -e AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN \
  -e AWS_REGION=us-west-2 \
  -e AWS_DEFAULT_REGION=us-west-2 \
  opencode-agentcore-poc:latest
curl -N http://localhost:8080/invocations \
  -H 'content-type: application/json' \
  -d '{"prompt":"who are you?","systemPrompt":"You are OpenCode. When asked who you are, say exactly: I am OpenCode."}'

Invoke AgentCore Runtime

aws bedrock-agentcore invoke-agent-runtime \
  --region us-west-2 \
  --agent-runtime-arn "$AGENT_RUNTIME_ARN" \
  --runtime-session-id "opencode-poc-session-000000000000000001" \
  --content-type application/json \
  --accept text/event-stream \
  --cli-binary-format raw-in-base64-out \
  --payload '{"prompt":"who are you?","systemPrompt":"You are OpenCode. When asked who you are, say exactly: I am OpenCode."}' \
  /tmp/opencode-agentcore.out

Or use the smoke script, which exits non-zero if the runtime fails before OpenCode emits text:

AGENT_RUNTIME_ARN="$AGENT_RUNTIME_ARN" python3 scripts/invoke_poc.py

Environment

  • OPENCODE_MODEL, defaults to amazon-bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
  • BEDROCK_MODEL_ID, defaults to us.anthropic.claude-sonnet-4-5-20250929-v1:0
  • AWS_REGION, defaults to us-west-2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors