Building Production-Ready Credit & Yield Staking AI Agents on Amazon EKS
.png)
EKS Auto Mode and Karpenter provision elastic compute for production AI agents, while MCP enables dynamic tool discovery and external data access. Strands SDK orchestrates A2A agents, swarms, workflows, and graph-based delegation. Financial and credit agents run as containerized Kubernetes services with ECR images, agent-card discovery, HTTP/JSON endpoints, and multi-agent risk analytics covering yield staking, macro volatility, rates, liquidity, drawdowns, hedging, and execution discipline.
Educational engineering workshop only. The credit and yield staking domain is used to teach agent-tool architecture and production deployment patterns. This is not financial advice.
Credit & Yield Staking Insight
The market romance is still AI-led, but jealous bond yields are watching. Global equities have been carried by tech/semiconductor earnings and AI capex, while bond volatility and elevated valuations remain the main danger. follow trend only above key moving averages; use stop-loss, position sizing, and avoid chasing gap-ups.
Oil is the seductive macro trigger: every spike whispers inflation. Middle East disruption lifted energy-risk premiums, forcing markets to reprice inflation, central-bank patience, and growth risk. monitor Brent, breakeven inflation, and 10-year yields; hedge equity longs with energy exposure or tighter trailing stops when oil volatility rises.
Rates are the cold player that can end the party. Higher sovereign yields and term premiums can compress P/E multiples, especially in long-duration growth stocks. reduce leverage when yields break higher; prefer quality balance sheets, free-cash-flow names, and short-duration fixed income for dry powder.
Workshop Summary
.png)
Developers build production-ready Credit & Yield Staking AI agents on Amazon EKS. The workshop starts with EKS Auto Mode and NodePools, then adds MCP tool access, Strands agents, A2A server exposure, Docker packaging, ECR image publishing, Kubernetes deployment, and a multi-agent credit review system.
Architecture Built in This Workshop
.png)
Trader
└─ asks Credit & Yield Staking insight question
AWS Region
├─ VPC
│ └─ Amazon EKS with Auto Mode and Karpenter
│ ├─ agents namespace
│ │ ├─ financial-agent Service
│ │ ├─ financial-agent Deployment
│ │ ├─ Credit multi-agent server
│ │ └─ Strands Credit Agent
│ ├─ mcp-servers namespace
│ │ └─ financial MCP server
│ ├─ MCP Client
│ ├─ Agent-to-Agent (A2A) server
│ └─ Strands financial agent
├─ Amazon Elastic Container Registry (ECR)
│ └─ agent and MCP server images
└─ Amazon Bedrock
└─ AI/LLM capabilities
External / out of AWS Region
└─ external MCP server for MCP Client financial strategy access
Workshop Parts
Part 1: Hands-on Workshop and EKS Auto Mode
Introduces production-ready AI agents on Amazon EKS, covering workshop resources, pre-provisioned EKS Auto Mode, Karpenter-driven provisioning, NodePools, scalable compute, ECR, Bedrock, VPC, namespaces, and MCP for external tool access.
Part 2: MCP, A2A Protocol, and Strands
Explains MCP, A2A protocol, and Strands SDK, including remote tool discovery, agent interoperability, agents-as-tools, swarms, graphs, workflows, decorators, Bedrock-backed agents, current_time tooling, and market-trend execution examples.
Part 3: Agent-to-Agent Server and Testing
Covers exposing an agent through an A2A server, FastAPI mounting, HTTP/JSON capability discovery, agent-card.json endpoints, local testing, Docker containerization, uv dependency caching, production images, ECR push commands, and rates-driven output.
Part 4: Deploying the Financial Agent in Kubernetes
Details Kubernetes deployment for the financial agent, including Service and Deployment YAML, labels, selectors, ports, environment variables, liveness probes, namespace creation, rollout checks, pod verification, internal DNS, curl testing, and agent-card discovery.
Part 5: Multi-Agent Systems and Credit Review Agent
Describes multi-agent systems where Credit and Financial agents collaborate through A2A tool providers, dynamic discovery, delegation, combined sources, risk review, counterparty analysis, liquidity checks, compliance considerations, and multi-agent server testing.
Part 1 — EKS Auto Mode & NodePools
.png)
A pre-provisioned EKS cluster is created with Auto Mode enabled.
EKS Auto Mode
EKS Auto Mode uses Karpenter to:
- Automatically launch compute resources.
- Observe pods that the Kubernetes scheduler marks as unschedulable and provision nodes to run them.
- Remove nodes when they are no longer needed.
NodePools
NodePools define:
- The types of compute resources that can be provisioned.
- Capacity types, such as On-Demand or Spot.
- Availability zones.
When pods need to be scheduled, Karpenter selects the most appropriate NodePool configuration to provision nodes.
This turns basic conversational AI into scalable, tool-enabled agents.
AWS Components
- Amazon Elastic Container Registry (ECR): Stores container images for both agent and MCP server deployments.
- Amazon Bedrock Claude Sonnet: Provides AI/LLM capabilities for the agent.
- VPC: Provides network isolation and a security boundary for the EKS cluster.
- Amazon EKS Auto Mode: Provides a managed Kubernetes cluster with automatic infrastructure management.
- Agent Namespace: Contains the AI agent container deployment and service.
- MCP Namespace: Contains the MCP container deployment and service for external data access.
- MCP Protocol: A protocol that enables agents to access external tools and data sources.
Agent with MCP
The Model Context Protocol (MCP) enables agents to access external services.
Part 2 — MCP, A2A Protocol, and Strands
.png)
Agent-to-Agent (A2A) Protocol
The Agent-to-Agent (A2A) protocol enables multiple applications to interact with an agent.
Deploy Agent to Kubernetes — Production Ready
Model Context Protocol (MCP)
The Model Context Protocol (MCP) enables AI agents to access external tools and services.
MCP Client
The MCP client uses the URL of the remote MCP server to dynamically discover and use tools.
def get_mcp_tools():
mcp_url = os.getenv("FINANICAL_MCP_URL", "http://localhost:8080/mcp")
mcp_client = MCPClient(lambda: streamablehttp_client(mcp_url))
mcp_client.start()
return mcp_client.list_tools_sync()
Strands Summary
- Agent-to-Agent (A2A): An open standard for agents to discover skills, communicate, and collaborate across systems, improving interoperability and delegation. It is useful for cross-platform assistants, enterprise automation, marketplaces, and coordinated multi-agent tasks.
- Agents as Tools: Specialized agents are wrapped as callable functions for other agents, improving modularity, reuse, and control. This is useful for coding assistants, retrieval experts, compliance reviewers, calculators, and domain-specific workflow steps.
- Swarm: A collaborative orchestration pattern where multiple agents work as a team, share context, divide tasks, and solve problems together. It is useful for research, brainstorming, planning, incident response, investigations, and complex uncertain tasks.
- Graph: A deterministic, directed orchestration pattern where agents, nodes, swarms, or nested graphs follow predefined paths, improving predictability and auditability. It is useful for approvals, diagnostics, data pipelines, regulated processes, and repeatable decisions.
- Workflow: A structured coordination pattern for specialized agents in defined sequences or patterns, improving efficiency, repeatability, and accountability. It is useful for onboarding, reporting, claims processing, content review, service desk automation, and operations.
Strands
Strands is an open-source SDK that simplifies building autonomous AI agents through model-driven orchestration. It reduces complex coding, handles multi-agent workflows, and automates tasks such as cloud resource management.
Python functions can be turned into tools by adding a simple @tool decorator.
@tool(name="get_todays_date", description="Retrieves today's date for accuracy")
def get_todays_date() -> str:
return datetime.today().strftime('%Y-%m-%d')
Agent
An agent has the ability to take actions.
def financial_agent():
agent = Agent(
description="Helpful agent that assists with Fixed Income Indices",
model=BEDROCK_MODEL_ID,
system_prompt="""
You are a professional trader with 40 years of experience.
Read the nearest 3-month US financial market trend.
Give investment suggestions.
""",
tools=[get_mcp_tools(), current_time] # Strands community current_time tool features
)
return agent
Run the Agent
def main():
agent = financial_agent()
agent("Give investment suggestions based on the nearest 3-month financial market trend")
Run the agent in the Bash terminal:
uv run --project ~/environment/agents/a2a/agent agent
echo -e "\n\n***** end of agent response *****"
Output
Tool #1: current_time
Tool #2: get_forecast
The market romance is still AI-led, but jealous bond yields are watching. Global equities have been carried by tech/semiconductor earnings and AI capex, while bond volatility and elevated valuations remain the main danger. follow trend only above key moving averages; use stop-loss, position sizing, and avoid chasing gap-ups.
- Tool Execution Visibility: Tool #1
- Multi-Step Reasoning: Market romance → bond yields/volatility → semiconductor earnings → AI capex → use stop-losses, position sizing, and avoid chasing gap-ups.
Part 3 — Agent-to-Agent Server and Testing
.png)
Agent-to-Agent (A2A) Server
The Agent-to-Agent (A2A) server can be accessed by other applications and services.
Use the Strands SDK to expose your agent as a network service.
def run_a2a_server():
host = os.getenv("A2A_HOST", "0.0.0.0")
port = int(os.getenv("A2A_PORT", "9000"))
http_url = os.getenv("A2A_URL", os.getenv("AGENTCORE_RUNTIME_URL", f"http://localhost:{port}"))
agent = finanical_agent() # agent we just created
app = FastAPI() # web service
a2a_server = A2AServer(agent=agent, port=port, host=host, http_url=http_url, serve_at_root=True)
# Mounts A2A server to web service
app.mount("/", a2a_server.to_fastapi_app())
# Runs server
uvicorn.run(app, host=host, port=port)
Agent-to-Agent (A2A) Server Testing
run_in_background 9000 uv run --project ~/environment/agents/a2a/agent agent-a2a-server
a2a_client_local http://localhost:9000 "Provide investment suggestions for yield staking?"
Output
Oil is the seductive macro trigger: every spike whispers inflation. Middle East disruption lifted energy-risk premiums, forcing markets to reprice inflation, central-bank patience, and growth risk. monitor Brent, breakeven inflation, and 10-year yields; hedge equity longs with energy exposure or tighter trailing stops when oil volatility rises.
Capability Discovery
Clients discover the agent-card.json endpoint.
- Protocol: HTTP/JSON
- Container: Binds to
0.0.0.0:9000 for Kubernetes deployment.
Container Deployment
Package the Agent-to-Agent (A2A) server into a Docker container.
Amazon EKS (Amazon Elastic Kubernetes Service) provides proper scaling, monitoring, and service discovery.
Dockerfile
ARG RUNTAG=latest
FROM cgr.dev/chainguard/python:latest-dev AS uv
WORKDIR /app
# Safer production env
# Python bytecode precompiled, short startup/import times
ENV UV_COMPILE_BYTECODE=1
# Copy is usually safer in Docker environments
ENV UV_LINK_MODE=copy
# Optional safe production env
# Use system Python installations/interpreters
ENV UV_PYTHON_PREFERENCE=only-system
# Don’t allow lockfile updates
ENV UV_FROZEN=true
Development Image (uv)
.png)
# Create dependency cache layers
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-install-project --no-dev --no-editable
# Create coding cache layers
COPY *.py .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-dev --no-editable
--mount=type=cache creates a cache.
--no-dev --no-editable installs only production dependencies.
Production Image
FROM cgr.dev/chainguard/python:${RUNTAG}
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=uv /app/.venv .venv
ENV PATH allows commands such as python and pip to run.
--from=uv means copy from the Docker build stage named uv.
/app/.venv is the source path inside that stage.
.venv is the destination path in the current stage.
Push the container image to ECR, Amazon Elastic Container Registry:
docker build ~/environment/agents/a2a/agent/ -t ${ECR_REPO_FINANCIAL_AGENT_URI}:latest
docker push ${ECR_REPO_FINANCIAL_AGENT_URI}:latest
Part 4 — Deploying the Financial Agent in Kubernetes
.png)
Deploy Financial Agent in Kubernetes
Service Resource: k8s.yaml
apiVersion: v1
kind: Service
metadata:
name: finanical-agent
namespace: agents
labels:
app.kubernetes.io/name: finanical-agent
spec:
selector:
app.kubernetes.io/name: finanical-agent
ports:
- port: 9000
targetPort: a2a
name: a2a
Service Discovery
Label selector:
app.kubernetes.io/name: finanical-agent
Internal DNS:
http://finanical-agent.agents/
Deployment Resource
.png)
apiVersion: apps/v1
kind: Deployment
metadata:
name: finanical-agent
namespace: agents
labels:
app.kubernetes.io/name: finanical-agent
spec:
selector:
matchLabels:
app.kubernetes.io/name: finanical-agent
template:
metadata:
labels:
app.kubernetes.io/name: finanical-agent
spec:
serviceAccountName: finanical-agent
containers:
- name: finanical-agent
image: ${ECR_REPO_FINANCIAL_AGENT_URI}:latest
ports:
- containerPort: 9000
name: a2a
env:
- name: FINANCIAL_MCP_URL
value: "http://finanical-mcp.mcp-servers:8080/mcp"
- name: A2A_URL
value: "http://finanical-agent.agents:9000"
command: ["agent-a2a-server"]
livenessProbe:
tcpSocket:
port: 9000
Create the Kubernetes namespace:
kubectl create namespace agents
Deploy your agent to Kubernetes:
envsubst < ~/environment/agents/a2a/agent/k8s.yaml | kubectl apply -f -
Wait for the pod to be running:
kubectl rollout status --namespace agents deployment finanical-agent
Verify the deployment:
kubectl get pods -n agents -l app.kubernetes.io/name=finanical-agent
Test the Agent Running in Kubernetes
kubectl run curl-test --image=curlimages/curl \
--rm -it --restart=Never -- \
curl -s -X GET http://financial-agent.agents:9000/.well-known/agent-card.json \
| sed 's/pod "curl-test" deleted//' | jq -r .
A2A Agent Card
The A2A Agent Card describes an agent’s capabilities and enables clients to discover what the agent can do.
Call the Agent Running in Kubernetes
a2a_client_in_k8s http://financial-agent.agents:9000 "Provide investment"
Part 5 — Multi-Agent Systems and Credit Review Agent
.png)
Multi-Agent Systems
Multiple agents work together to solve complex problems.
- Credit Agent: Provides credit review on yield staking investment.
- Financial Agent: Provides investment suggestions on yield staking.
Request Analysis
The Credit Agent analyzes your request and determines that it needs more financial data to provide good yield staking investment suggestions.
Benefit
Extra domain expertise produces higher-quality responses.
Multi-Agent Systems in Strands
- A2A Protocol: Discovers and communicates with agents.
- Multi-Agent Orchestration: Coordinates agents to solve complex problems.
- A2A Client as Agent Tool: Wrapped as callable functions for other agents.
- Benefit: Dynamically discovers other agents.
def financial_agent_as_tool(request: str) -> str:
remote_agent_a2a_url = os.getenv("FINANCIAL_A2A_SERVER_URL", "http://localhost:9000")
a2a_tool_provider = A2AClientToolProvider(known_agent_urls=[remote_agent_a2a_url])
tools = a2a_tool_provider.tools
agent = Agent(
model=BEDROCK_MODEL_ID,
tools=tools,
system_prompt="You are an agent interface. Discover agents and tools you can use",
callback_handler=None
)
try:
response = agent(request)
return str(response)
except Exception as e:
raise Exception(f"Failed to process remote A2A agent request: {str(e)}")
Multi-Agent System
Create a Credit Agent that provides credit review on yield staking investment.
Use the A2A client provider tools to discover and communicate with A2A agents, delegate tasks to other agents, and combine information from multiple sources.
def credit_agent() -> Agent:
agent = Agent(
model=BEDROCK_MODEL_ID,
description="""
Credit review agent that evaluates yield staking investment opportunities from a credit,
counterparty, liquidity, operational, and risk-control perspective.
""",
system_prompt="""
You are a credit review agent for yield staking investment opportunities.
Your role is to assess the credit and risk profile of a proposed yield staking investment.
You do not provide financial advice, investment recommendations, or guarantees of return.
You provide structured risk analysis to support human decision-making.
Always evaluate the following areas:
- Counterparty risk
- Protocol or platform risk
- Asset quality and volatility risk
- Yield sustainability
- Liquidity and redemption risk
- Smart contract and operational risk
- Custody and settlement risk
- Regulatory and compliance considerations
- Historical performance, if available
- Concentration and exposure limits
- Downside scenarios and stress risks
If the user does not provide enough information, ask for:
- Staking platform or protocol name
- Asset being staked
- Expected yield or APY
- Lock-up period
- Investment amount
- Jurisdiction
- Counterparty or custodian details
- Available documentation, ratings, audits, or financial disclosures
Provide output in a clear credit review format:
- Executive summary
- Key strengths
- Key risks
- Required due diligence
- Risk rating
- Credit concerns
- Mitigating factors
- Final review conclusion
Use available tools or agents to gather supporting information where appropriate.
Clearly state assumptions and limitations.
Do not tell the user to invest or not invest.
""",
tools=[current_time, financial_agent_as_tool]
)
return agent
Expose Multi-Agent as an A2A Server
def run_a2a_server():
host = os.getenv("A2A_HOST", "0.0.0.0")
port = int(os.getenv("A2A_PORT", "9000"))
http_url = os.getenv("A2A_URL", os.getenv("CREDIT_AGENT_RUNTIME_URL", f"http://localhost:{port}"))
agent = credit_agent()
app = FastAPI()
a2a_server = A2AServer(agent=agent, port=port, host=host, http_url=http_url, serve_at_root=True)
app.mount("/", a2a_server.to_fastapi_app())
uvicorn.run(app, host=host, port=port)
A2A Multi-Agent Server Testing
run_in_background 9000 uv run --project ~/environment/agents/a2a/multi-agent multi-agent-a2a-server
a2a_client_local http://localhost:9000 "Can you provide a credit review on yield staking investment in the nearest 3 months?"
Output
Rates are the cold player that can end the party. Higher sovereign yields and term premiums can compress P/E multiples, especially in long-duration growth stocks. reduce leverage when yields break higher; prefer quality balance sheets, free-cash-flow names, and short-duration fixed income for dry powder.