From 41058c0541e042a36466566f3eb9eba317926614 Mon Sep 17 00:00:00 2001 From: seeobjectively <156959607+seeobjectively@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:23:11 -0800 Subject: [PATCH 1/3] Add RA for content-based agents --- .../drawio/code-based-agents.drawio | 293 ++++++++++++++++++ .../RA0005/11-code-based-agents/readme.md | 151 +++++++++ 2 files changed, 444 insertions(+) create mode 100644 docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio create mode 100644 docs/ref-arch/RA0005/11-code-based-agents/readme.md diff --git a/docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio b/docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio new file mode 100644 index 0000000000..191db7f706 --- /dev/null +++ b/docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/ref-arch/RA0005/11-code-based-agents/readme.md b/docs/ref-arch/RA0005/11-code-based-agents/readme.md new file mode 100644 index 0000000000..41584f4c08 --- /dev/null +++ b/docs/ref-arch/RA0005/11-code-based-agents/readme.md @@ -0,0 +1,151 @@ +--- +id: id-ra0005-11 +slug: /ref-arch/e5eb3b9b1d/11 +sidebar_position: 11 +sidebar_custom_props: + category_index: [] +title: Building Code-Based Agents +description: >- + Build AI agents using popular frameworks like AWS Strands, LangGraph, + Microsoft Agent Framework, Google Agent Development Kit, and CrewAI on SAP BTP + with Kyma Runtime for custom enterprise automation. +keywords: + - sap + - ai agents + - code-based agents + - aws strands + - langgraph + - microsoft agent framework + - google agent development kit + - crewai + - kyma runtime +sidebar_label: Building Code-Based Agents +image: img/ac-soc-med.png +tags: + - agents + - genai + - aws + - azure + - gcp + - kyma +hide_table_of_contents: false +hide_title: false +toc_min_heading_level: 2 +toc_max_heading_level: 4 +draft: false +unlisted: false +contributors: + - seeobjectively +last_update: + author: seeobjectively + date: 2025-11-25 +--- + +Code-Based Agents on SAP Business Technology Platform (BTP) enable developers to implement sophisticated AI agent workflows using popular frameworks. This approach provides maximum flexibility for building custom agent logic, complex orchestration patterns, and tailored integrations that go beyond low-code configuration capabilities. By leveraging frameworks such as AWS Strands, LangGraph, Microsoft Agent Framework, Google Agent Development Kit, and CrewAI, developers can create enterprise-grade AI agents that seamlessly integrate with SAP services and external systems. + +This reference architecture demonstrates the implementation using **AWS Strands**, but developers have the flexibility to choose any agent framework that best fits their specific requirements and technical preferences. + +## Architecture + +![drawio](./drawio/code-based-agents.drawio) + +The architecture illustrates how code-based agents operate within SAP BTP using Kyma Runtime as the deployment platform. At the core, agent frameworks run as containerized workloads in Kyma Pods, providing the orchestration and reasoning capabilities needed for complex multi-step workflows. The architecture supports multiple deployment patterns: + +### Core Components + +**Kyma Runtime** serves as the cloud-native runtime environment, hosting agent applications in Pods. Each Pod can contain: +- **Tools**: Custom business logic and integrations exposed as callable functions +- **Strands Agent**: The agent orchestration layer managing workflow execution +- **LiteLLM**: A unified interface for accessing multiple LLM providers + +**Generative AI Hub** through SAP AI Core provides centralized access to foundation models and LLMs. The architecture supports both: +- **Partner-built models**: Accessed via HTTPS through providers like Amazon Bedrock (Amazon Nova, Anthropic Claude, Amazon Titan) +- **SAP-hosted models**: Available directly through Foundation Model Access + +**SAP HANA Cloud** enables agents to leverage enterprise data through: +- **Vector Engine**: Semantic search and similarity matching for contextual retrieval +- **Knowledge Graph Engine**: Structured relationship queries and reasoning over connected data + +**Open Telemetry Module** integrated with **SAP Cloud Logging** provides observability for agent execution, enabling monitoring, debugging, and performance optimization. + +**Authentication and Security** is managed through **SAP Cloud Identity Service** and **SAP Credential Store**, ensuring secure access to models and enterprise systems. + +### Agent Frameworks + +While this reference architecture demonstrates implementation using AWS Strands, the design supports multiple agent frameworks. Developers can choose the framework that best aligns with their requirements. + +The choice of framework depends on factors such as existing cloud infrastructure, required integrations, team expertise, and specific use case requirements. All frameworks can be deployed on SAP BTP's Kyma Runtime and integrated with SAP AI Core's Generative AI Hub. + +## Implementation Patterns + +Code-based agents on BTP follow several key patterns: + +### Memory and State Management +Agents maintain context across multi-turn interactions using: +- In-memory state for short-term context +- Vector storage in HANA Cloud for long-term memory +- Conversation history for continuity +- Custom persistence layers for domain-specific state + +### Orchestration Strategies +Different frameworks support various orchestration approaches: +- **ReAct (Reasoning + Acting)**: Iterative thought-action-observation loops +- **Plan-and-Execute**: Upfront planning followed by sequential execution +- **Multi-Agent**: Specialized agents collaborating on subtasks +- **Reflexion**: Self-reflection and error correction cycles + +## Deployment Considerations + +When deploying code-based agents on BTP, consider: + +**Scalability**: Kyma's Kubernetes foundation enables horizontal scaling of agent workloads based on demand. + +**Observability**: Leverage OpenTelemetry integration for comprehensive tracing of agent execution, tool invocations, and LLM calls. + +**Cost Management**: Monitor token usage and API calls through SAP AI Core's metering capabilities to optimize costs. + +**Security**: Implement proper authentication flows using SAP Cloud Identity Service and secure credential management through SAP Credential Store. + +**Performance**: Use LiteLLM for unified access to multiple model providers, enabling fallback strategies and load distribution. + +## When to Use Code-Based Agents + +Code-based agents are the right choice when: + +- **Complex Logic Required**: Business rules and workflows exceed low-code capabilities +- **Custom Integrations Needed**: Specialized connectors or adapters are necessary +- **Framework-Specific Features**: Leveraging unique capabilities of specific agent frameworks +- **Fine-Grained Control**: Precise control over reasoning steps, memory, and tool selection +- **Advanced Patterns**: Implementing sophisticated orchestration like multi-agent systems or self-improving agents + +For simpler scenarios focused on rapid deployment within the SAP ecosystem, consider [Content-Based Agents](../5-ai-agents/readme.md#content-based-agents) using Joule Studio's Agent Builder. + +## Services & Components + +For a comprehensive list of services, components and descriptions, please explore the Introduction on [Services & Components](./#services--components). + +Additional components specific to this architecture: + +- [SAP BTP, Kyma runtime](https://discovery-center.cloud.sap/serviceCatalog/kyma-runtime/?region=all) is a fully managed Kubernetes runtime based on the open-source project "Kyma". This cloud-native solution allows developers to extend SAP solutions with serverless functions and combine them with containerized microservices. + +- [SAP Cloud Logging](https://discovery-center.cloud.sap/serviceCatalog/cloud-logging?region=all) is an instance-based and environment-independent observability service that builds upon OpenSearch to store, visualize, and analyze application logs, metrics, and traces from SAP BTP Cloud Foundry, Kyma, and other environments. + +## Examples + +Examples of code-based agent implementations: + +- [AWS Strands documentation](https://aws.amazon.com/bedrock/agents/) +- [LangGraph tutorials and examples](https://langchain-ai.github.io/langgraph/tutorials/) +- [Microsoft Agent Framework documentation](https://learn.microsoft.com/en-us/semantic-kernel/agents/) +- [Google Agent Development Kit documentation](https://cloud.google.com/vertex-ai/docs/generative-ai/agents) +- [CrewAI examples](https://docs.crewai.com/examples) + +## Resources + +For more information related to code-based agents: + +- [AI Agent Development Approaches](../5-ai-agents/readme.md#ai-agent-development-approaches) +- [Agent Evaluation Framework](../5-ai-agents/readme.md#agent-evaluation) +- [SAP AI Core Documentation](https://help.sap.com/docs/sap-ai-core) +- [Kyma Runtime Documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/kyma-environment) +- [LiteLLM Documentation](https://docs.litellm.ai/) From 63e4313917c4c5a7d890be4ec05fb7194cfb2108 Mon Sep 17 00:00:00 2001 From: seeobjectively <156959607+seeobjectively@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:05:13 -0800 Subject: [PATCH 2/3] Update contributors list --- docs/ref-arch/RA0005/11-code-based-agents/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ref-arch/RA0005/11-code-based-agents/readme.md b/docs/ref-arch/RA0005/11-code-based-agents/readme.md index 41584f4c08..d7a6175b83 100644 --- a/docs/ref-arch/RA0005/11-code-based-agents/readme.md +++ b/docs/ref-arch/RA0005/11-code-based-agents/readme.md @@ -36,6 +36,7 @@ draft: false unlisted: false contributors: - seeobjectively + - anujag24 last_update: author: seeobjectively date: 2025-11-25 From 6b9905c649fec54621ff1f6a4fa5f8821da6fa49 Mon Sep 17 00:00:00 2001 From: seeobjectively <156959607+seeobjectively@users.noreply.github.com> Date: Tue, 2 Dec 2025 10:56:05 -0800 Subject: [PATCH 3/3] move code-based agents deep dive to subpage --- .../drawio/code-based-agents.drawio | 0 .../1-code-based-agents}/readme.md | 14 +++++++------- docs/ref-arch/RA0005/5-ai-agents/readme.md | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) rename docs/ref-arch/RA0005/{11-code-based-agents => 5-ai-agents/1-code-based-agents}/drawio/code-based-agents.drawio (100%) rename docs/ref-arch/RA0005/{11-code-based-agents => 5-ai-agents/1-code-based-agents}/readme.md (94%) diff --git a/docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio b/docs/ref-arch/RA0005/5-ai-agents/1-code-based-agents/drawio/code-based-agents.drawio similarity index 100% rename from docs/ref-arch/RA0005/11-code-based-agents/drawio/code-based-agents.drawio rename to docs/ref-arch/RA0005/5-ai-agents/1-code-based-agents/drawio/code-based-agents.drawio diff --git a/docs/ref-arch/RA0005/11-code-based-agents/readme.md b/docs/ref-arch/RA0005/5-ai-agents/1-code-based-agents/readme.md similarity index 94% rename from docs/ref-arch/RA0005/11-code-based-agents/readme.md rename to docs/ref-arch/RA0005/5-ai-agents/1-code-based-agents/readme.md index d7a6175b83..731f036ef7 100644 --- a/docs/ref-arch/RA0005/11-code-based-agents/readme.md +++ b/docs/ref-arch/RA0005/5-ai-agents/1-code-based-agents/readme.md @@ -1,7 +1,7 @@ --- -id: id-ra0005-11 -slug: /ref-arch/e5eb3b9b1d/11 -sidebar_position: 11 +id: id-ra0005-5-1 +slug: /ref-arch/e5eb3b9b1d/5/1 +sidebar_position: 1 sidebar_custom_props: category_index: [] title: Building Code-Based Agents @@ -119,11 +119,11 @@ Code-based agents are the right choice when: - **Fine-Grained Control**: Precise control over reasoning steps, memory, and tool selection - **Advanced Patterns**: Implementing sophisticated orchestration like multi-agent systems or self-improving agents -For simpler scenarios focused on rapid deployment within the SAP ecosystem, consider [Content-Based Agents](../5-ai-agents/readme.md#content-based-agents) using Joule Studio's Agent Builder. +For simpler scenarios focused on rapid deployment within the SAP ecosystem, consider [Content-Based Agents](../readme.md#content-based-agents) using Joule Studio's Agent Builder. ## Services & Components -For a comprehensive list of services, components and descriptions, please explore the Introduction on [Services & Components](./#services--components). +For a comprehensive list of services, components and descriptions, please explore the Introduction on [Services & Components](../../#services--components). Additional components specific to this architecture: @@ -145,8 +145,8 @@ Examples of code-based agent implementations: For more information related to code-based agents: -- [AI Agent Development Approaches](../5-ai-agents/readme.md#ai-agent-development-approaches) -- [Agent Evaluation Framework](../5-ai-agents/readme.md#agent-evaluation) +- [AI Agent Development Approaches](../readme.md#ai-agent-development-approaches) +- [Agent Evaluation Framework](../readme.md#agent-evaluation) - [SAP AI Core Documentation](https://help.sap.com/docs/sap-ai-core) - [Kyma Runtime Documentation](https://help.sap.com/docs/btp/sap-business-technology-platform/kyma-environment) - [LiteLLM Documentation](https://docs.litellm.ai/) diff --git a/docs/ref-arch/RA0005/5-ai-agents/readme.md b/docs/ref-arch/RA0005/5-ai-agents/readme.md index 77b0cf61d4..b353459e13 100644 --- a/docs/ref-arch/RA0005/5-ai-agents/readme.md +++ b/docs/ref-arch/RA0005/5-ai-agents/readme.md @@ -68,6 +68,8 @@ They leverage popular frameworks such as LangGraph, AutoGen, CrewAI, or smolagen ![drawio](./drawio/reference-architecture-generative-ai-code-based.drawio) +For a detailed guide on building code-based agents, including deployment approaches with Kyma Runtime, LLM access patterns using LiteLLM, and framework-specific implementation details, see [Building Code-Based Agents](./1-code-based-agents/readme.md). + ## Elements of AI Agents To understand the technical working of an AI Agent, consider its five core components explained below.