@bluefly/openstandardagents 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devfile.yaml +1 -1
- package/.env.example +1 -1
- package/.github/AGENTS.md +245 -0
- package/.github/agents/github-issue-triage.ossa.yaml +99 -0
- package/.github/agents/github-pr-triage.ossa.yaml +137 -0
- package/.github/workflows/issue-sync-to-gitlab.yml +138 -0
- package/.github/workflows/pr-triage-to-gitlab.yml +164 -0
- package/.version.json +2 -2
- package/.wiki-config.json +24 -0
- package/CHANGELOG.md +44 -18
- package/CODEOWNERS +75 -0
- package/CONTRIBUTING.md +103 -4
- package/README.md +178 -243
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/repositories/schema.repository.d.ts +6 -1
- package/dist/repositories/schema.repository.d.ts.map +1 -1
- package/dist/repositories/schema.repository.js +49 -27
- package/dist/repositories/schema.repository.js.map +1 -1
- package/dist/services/migration.service.d.ts +4 -3
- package/dist/services/migration.service.d.ts.map +1 -1
- package/dist/services/migration.service.js +11 -10
- package/dist/services/migration.service.js.map +1 -1
- package/dist/services/release-automation/release.service.js +1 -1
- package/dist/services/release-automation/release.service.js.map +1 -1
- package/dist/services/release-automation/schemas/release.schema.js +1 -1
- package/dist/services/release-automation/webhook.service.js +3 -3
- package/dist/services/release-automation/webhook.service.js.map +1 -1
- package/dist/services/runtime/claude/claude-adapter.d.ts +1 -1
- package/dist/services/runtime/claude/claude-adapter.d.ts.map +1 -1
- package/dist/services/runtime/claude/claude-adapter.js +2 -2
- package/dist/services/runtime/claude/claude-adapter.js.map +1 -1
- package/dist/spec/v0.2.8/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.8/README.md +72 -0
- package/dist/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/dist/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
- package/{spec/v0.2.6-dev/ossa-0.2.5.schema.json → dist/spec/v0.2.8/ossa-0.2.8.schema.json} +1509 -52
- package/dist/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
- package/dist/spec/v0.2.9/a2a-protocol.md +1337 -0
- package/dist/spec/v0.2.9/agent.md +1946 -0
- package/dist/spec/v0.2.9/capabilities/index.yaml +25 -0
- package/dist/spec/v0.2.9/capabilities/memory.yaml +251 -0
- package/dist/spec/v0.2.9/capability-schema.md +576 -0
- package/dist/spec/v0.2.9/compliance-profiles.md +533 -0
- package/dist/spec/v0.2.9/conformance-testing.md +1527 -0
- package/dist/spec/v0.2.9/gitlab-duo-integration.md +621 -0
- package/dist/spec/v0.2.9/ossa-0.2.9.schema.json +3699 -0
- package/dist/spec/v0.2.9/runtime-semantics.md +464 -0
- package/dist/spec/v0.2.9/security-model.md +1245 -0
- package/dist/spec/v0.2.9/semantic-conventions.md +347 -0
- package/dist/spec/v0.2.9/types.ts +522 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/policy.d.ts +377 -0
- package/dist/types/policy.d.ts.map +1 -0
- package/dist/types/policy.js +84 -0
- package/dist/types/policy.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/version.d.ts +68 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +156 -0
- package/dist/utils/version.js.map +1 -0
- package/docs/specs/policy-dsl.md +925 -0
- package/eslint-report.json +1 -0
- package/examples/adk-integration/code-review-workflow.yml +1 -1
- package/examples/adk-integration/customer-support.yml +1 -1
- package/examples/adk-integration/data-pipeline.yml +1 -1
- package/examples/advanced/reasoning-agent.yaml +136 -0
- package/examples/advanced/workflows/hybrid-model-strategy.yaml +1 -1
- package/examples/agent-manifests/critics/critic-agent.yaml +1 -1
- package/examples/agent-manifests/governors/governor-agent.yaml +1 -1
- package/examples/agent-manifests/integrators/integrator-agent.yaml +1 -1
- package/examples/agent-manifests/judges/judge-agent.yaml +1 -1
- package/examples/agent-manifests/monitors/monitor-agent.yaml +1 -1
- package/examples/agent-manifests/orchestrators/orchestrator-agent.yaml +1 -1
- package/examples/agent-manifests/sample-compliant-agent.yaml +1 -1
- package/examples/agent-manifests/workers/worker-agent.yaml +1 -1
- package/examples/agents-md/code-agent.ossa.json +100 -0
- package/examples/agents-md/monorepo-agent.ossa.yaml +180 -0
- package/examples/anthropic/claude-assistant.ossa.json +1 -1
- package/examples/autogen/multi-agent.ossa.json +1 -1
- package/examples/claude-code/code-reviewer.ossa.yaml +78 -0
- package/examples/claude-code/ossa-validator.ossa.yaml +80 -0
- package/examples/common_npm/agent-router.ossa.yaml +1 -0
- package/examples/common_npm/agent-router.v0.2.2.ossa.yaml +1 -1
- package/examples/crewai/research-team.ossa.json +1 -1
- package/examples/cursor/code-review-agent.ossa.json +1 -1
- package/examples/drupal/gitlab-ml-recommender.ossa.yaml +1 -0
- package/examples/drupal/gitlab-ml-recommender.v0.2.2.ossa.yaml +1 -1
- package/examples/extensions/agents-md-v1.yml +175 -0
- package/examples/extensions/drupal-v1.yml +1 -1
- package/examples/extensions/kagent-v1.yml +1 -1
- package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
- package/examples/integration-patterns/agent-to-agent-orchestration.ossa.yaml +4 -4
- package/examples/kagent/compliance-validator.ossa.yaml +1 -1
- package/examples/kagent/cost-optimizer.ossa.yaml +1 -1
- package/examples/kagent/documentation-agent.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter-v1.ossa.yaml +1 -0
- package/examples/kagent/k8s-troubleshooter-v1.v0.2.2.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter.ossa.yaml +1 -1
- package/examples/kagent/security-scanner.ossa.yaml +1 -1
- package/examples/langchain/chain-agent.ossa.json +1 -1
- package/examples/langflow/workflow-agent.ossa.json +1 -1
- package/examples/langgraph/state-machine-agent.ossa.json +1 -1
- package/examples/llamaindex/rag-agent.ossa.json +1 -1
- package/examples/migration-guides/from-langchain-to-ossa.yaml +4 -4
- package/examples/multi-agent/README.md +74 -0
- package/examples/multi-agent/conditional-router.ossa.yaml +42 -0
- package/examples/multi-agent/parallel-execution.ossa.yaml +54 -0
- package/examples/multi-agent/sequential-pipeline.ossa.yaml +45 -0
- package/examples/openai/basic-agent.ossa.yaml +1 -1
- package/examples/openai/multi-tool-agent.ossa.json +1 -1
- package/examples/openai/swarm-agent.ossa.json +1 -1
- package/examples/production/document-analyzer-openai.yml +1 -1
- package/examples/quickstart/support-agent.ossa.yaml +1 -1
- package/examples/spec-examples/audit-agent.yml +1 -1
- package/examples/spec-examples/chat-agent.yml +1 -1
- package/examples/spec-examples/compliance-agent.yml +1 -1
- package/examples/spec-examples/monitoring-agent.yml +1 -1
- package/examples/spec-examples/workflow-agent.yml +1 -1
- package/examples/templates/ossa-compliance.yaml +1 -1
- package/examples/vercel/edge-agent.ossa.json +1 -1
- package/gl-code-quality-report.json +62 -0
- package/llms-ctx-full.txt +39 -0
- package/llms-ctx.txt +39 -0
- package/llms.txt +47 -0
- package/package.json +6 -3
- package/scripts/README.md +25 -0
- package/scripts/compliance-audit.ts +796 -0
- package/scripts/eslint-to-codequality.cjs +34 -0
- package/scripts/generate-agents-catalog.ts +2 -1
- package/scripts/generate-api-docs.ts +2 -1
- package/scripts/generate-examples-docs.ts +2 -1
- package/scripts/generate-llms-ctx.sh +17 -0
- package/scripts/generate-schema-docs.ts +31 -10
- package/scripts/sync-version.js +4 -12
- package/scripts/validate-schema.ts +2 -1
- package/spec/v0.2.8/CHANGELOG.md +401 -0
- package/spec/v0.2.8/README.md +72 -0
- package/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
- package/spec/{v0.2.6-dev/ossa-0.2.6-dev.schema.json → v0.2.8/ossa-0.2.8.schema.json} +1509 -52
- package/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
- package/spec/v0.2.9/a2a-protocol.md +1337 -0
- package/spec/v0.2.9/agent.md +1946 -0
- package/spec/v0.2.9/capabilities/index.yaml +25 -0
- package/spec/v0.2.9/capabilities/memory.yaml +251 -0
- package/spec/v0.2.9/capability-schema.md +576 -0
- package/spec/v0.2.9/compliance-profiles.md +533 -0
- package/spec/v0.2.9/conformance-testing.md +1527 -0
- package/spec/v0.2.9/gitlab-duo-integration.md +621 -0
- package/spec/v0.2.9/ossa-0.2.9.schema.json +3699 -0
- package/spec/v0.2.9/runtime-semantics.md +464 -0
- package/spec/v0.2.9/security-model.md +1245 -0
- package/spec/v0.2.9/semantic-conventions.md +347 -0
- package/spec/v0.2.9/types.ts +522 -0
- package/test-results/junit.xml +337 -0
- package/.github/workflows/pr-comment.yml +0 -33
- package/bin/validate-ossa-0.2.5-RC.ts +0 -244
- package/dist/spec/v0.2.6-dev/ossa-0.2.5.schema.json +0 -1696
- package/dist/spec/v0.2.6-dev/ossa-0.2.6-dev.schema.json +0 -1696
- package/scripts/lib/exec.ts +0 -37
- package/scripts/lib/file-ops.ts +0 -58
- package/scripts/lib/version.ts +0 -83
- package/website/.lighthouserc.ts +0 -24
- package/website/.prettierrc +0 -10
- package/website/DESIGN_SYSTEM_IMPLEMENTATION.md +0 -445
- package/website/Dockerfile +0 -30
- package/website/app/about/page.tsx +0 -304
- package/website/app/blog/[slug]/page.tsx +0 -208
- package/website/app/blog/page.tsx +0 -249
- package/website/app/design-guide/page.tsx +0 -511
- package/website/app/docs/[[...slug]]/page.tsx +0 -847
- package/website/app/docs/core-concepts/project-structure/page.tsx +0 -349
- package/website/app/ecosystem/page.tsx +0 -410
- package/website/app/examples/page.tsx +0 -133
- package/website/app/globals.scss +0 -370
- package/website/app/layout.tsx +0 -106
- package/website/app/license/page.tsx +0 -183
- package/website/app/not-found.tsx +0 -18
- package/website/app/page.tsx +0 -686
- package/website/app/page.tsx.bak +0 -679
- package/website/app/page.tsx.bak2 +0 -649
- package/website/app/playground/page.tsx +0 -487
- package/website/app/robots.ts +0 -19
- package/website/app/rss.xml/route.ts +0 -74
- package/website/app/schema/page.tsx +0 -1001
- package/website/app/sitemap.ts +0 -56
- package/website/app/specification/page.tsx +0 -287
- package/website/components/InstallCommand.tsx +0 -96
- package/website/components/Logo.tsx +0 -97
- package/website/components/StructuredData.tsx +0 -65
- package/website/components/docs/DocsSearch.tsx +0 -104
- package/website/components/docs/DocsSidebar.tsx +0 -155
- package/website/components/docs/MarkdownContent.tsx +0 -401
- package/website/components/docs/VersionSelector.tsx +0 -105
- package/website/components/examples/ExamplesViewer.tsx +0 -293
- package/website/components/layout/Footer.tsx +0 -116
- package/website/components/layout/Header.tsx +0 -172
- package/website/components/schema/SchemaComponentsAccordion.tsx +0 -84
- package/website/components/schema/SchemaExplorer.tsx +0 -213
- package/website/components/ui/Badge.tsx +0 -82
- package/website/components/ui/Button.tsx +0 -116
- package/website/components/ui/Card.tsx +0 -167
- package/website/components/ui/Checkbox.tsx +0 -141
- package/website/components/ui/Input.tsx +0 -169
- package/website/components/ui/Radio.tsx +0 -141
- package/website/components/ui/Select.tsx +0 -182
- package/website/components/ui/Tag.tsx +0 -158
- package/website/components/ui/Textarea.tsx +0 -195
- package/website/components/ui/index.ts +0 -11
- package/website/content/blog/OpenAPI-AI-Agents-Standard.md +0 -285
- package/website/content/blog/Why-Formal-Standards-Matter-Now.md +0 -198
- package/website/content/blog/gitlab-kubernetes-agent-ecosystem.md +0 -286
- package/website/content/blog/introducing-ossa-framework.md +0 -328
- package/website/content/blog/ossa-production-results.md +0 -279
- package/website/content/blog/welcome-to-ossa.md +0 -43
- package/website/content/blog/why-ai-agents-need-open-standard.md +0 -98
- package/website/content/docs/00-home.md +0 -153
- package/website/content/docs/adapters/openai-adapter.md +0 -693
- package/website/content/docs/agents/catalog.md +0 -28
- package/website/content/docs/aiflow-framework-integration-with-ossa.md +0 -107
- package/website/content/docs/api-reference/index.md +0 -38
- package/website/content/docs/api-reference/ossa-core-api.md +0 -634
- package/website/content/docs/api-reference/ossa-registry-api.md +0 -515
- package/website/content/docs/api-reference/unified-agent-gateway.md +0 -599
- package/website/content/docs/architecture/execution-flow.md +0 -335
- package/website/content/docs/architecture/multi-agent-systems.md +0 -737
- package/website/content/docs/architecture/overview.md +0 -121
- package/website/content/docs/architecture/stack-integration.md +0 -461
- package/website/content/docs/changelog.md +0 -246
- package/website/content/docs/cli-reference/index.md +0 -111
- package/website/content/docs/cli-reference/ossa-agents.md +0 -70
- package/website/content/docs/cli-reference/ossa-export.md +0 -56
- package/website/content/docs/cli-reference/ossa-generate.md +0 -66
- package/website/content/docs/cli-reference/ossa-gitlab-agent.md +0 -57
- package/website/content/docs/cli-reference/ossa-import.md +0 -56
- package/website/content/docs/cli-reference/ossa-init.md +0 -57
- package/website/content/docs/cli-reference/ossa-migrate.md +0 -62
- package/website/content/docs/cli-reference/ossa-run.md +0 -66
- package/website/content/docs/cli-reference/ossa-schema.md +0 -57
- package/website/content/docs/cli-reference/ossa-setup.md +0 -57
- package/website/content/docs/cli-reference/ossa-validate.md +0 -66
- package/website/content/docs/configuration/index.md +0 -97
- package/website/content/docs/contributing.md +0 -599
- package/website/content/docs/deployment/github-mirroring.md +0 -924
- package/website/content/docs/documentation.md +0 -100
- package/website/content/docs/ecosystem/framework-support.md +0 -1361
- package/website/content/docs/ecosystem/overview.md +0 -366
- package/website/content/docs/errors/index.md +0 -10
- package/website/content/docs/examples/aiflow-framework-integration-with-ossa.md +0 -107
- package/website/content/docs/examples/catalog.md +0 -300
- package/website/content/docs/for-audiences/students-researchers.md +0 -122
- package/website/content/docs/getting-started/index.md +0 -92
- package/website/content/docs/getting-started/installation.md +0 -155
- package/website/content/docs/getting-started/running-agents.md +0 -309
- package/website/content/docs/getting-started.md +0 -91
- package/website/content/docs/integrations/aiflow.md +0 -104
- package/website/content/docs/integrations/drupal.md +0 -105
- package/website/content/docs/migration-guides/agent-schema-comparison.md +0 -232
- package/website/content/docs/migration-guides/anthropic-mcp-to-ossa.md +0 -1750
- package/website/content/docs/migration-guides/crewai-to-ossa.md +0 -274
- package/website/content/docs/migration-guides/drupal-eca-to-ossa.md +0 -2017
- package/website/content/docs/migration-guides/general-agent-schema.yml +0 -247
- package/website/content/docs/migration-guides/index.md +0 -133
- package/website/content/docs/migration-guides/langchain-to-ossa.md +0 -1714
- package/website/content/docs/migration-guides/langflow-to-ossa.md +0 -2075
- package/website/content/docs/migration-guides/migration-manifest.json +0 -64
- package/website/content/docs/migration-guides/openai-to-ossa.md +0 -1202
- package/website/content/docs/openapi-extensions/examples.md +0 -550
- package/website/content/docs/openapi-extensions/index.md +0 -551
- package/website/content/docs/openapi-extensions/operation-extensions.md +0 -457
- package/website/content/docs/openapi-extensions/root-extensions.md +0 -410
- package/website/content/docs/ossa-compliant-badge.md +0 -251
- package/website/content/docs/pre-release/index.md +0 -175
- package/website/content/docs/quick-reference.md +0 -17
- package/website/content/docs/readme.md +0 -35
- package/website/content/docs/releases/v0.2.6.md +0 -99
- package/website/content/docs/schema-reference/agent-capabilities.md +0 -50
- package/website/content/docs/schema-reference/agent-id.md +0 -52
- package/website/content/docs/schema-reference/agent-name.md +0 -50
- package/website/content/docs/schema-reference/agent-role.md +0 -54
- package/website/content/docs/schema-reference/agent-spec.md +0 -406
- package/website/content/docs/schema-reference/agent-version.md +0 -50
- package/website/content/docs/schema-reference/autonomy.md +0 -568
- package/website/content/docs/schema-reference/constraints.md +0 -543
- package/website/content/docs/schema-reference/index.md +0 -45
- package/website/content/docs/schema-reference/llm-config.md +0 -445
- package/website/content/docs/schema-reference/observability.md +0 -654
- package/website/content/docs/schema-reference/ossa-manifest.md +0 -309
- package/website/content/docs/schema-reference/taxonomy.md +0 -509
- package/website/content/docs/schema-reference/tools.md +0 -628
- package/website/content/docs/templates/blog-post.md +0 -43
- package/website/content/docs/types-reference/index.md +0 -105
- package/website/content/docs/use-cases/00-index.md +0 -395
- package/website/content/docs/use-cases/cicd-code-review.md +0 -1236
- package/website/content/docs/use-cases/customer-support.md +0 -1234
- package/website/content/docs/use-cases/enterprise-compliance.md +0 -1208
- package/website/content/docs/use-cases/research-multi-agent.md +0 -1161
- package/website/content/docs/versioning.md +0 -288
- package/website/dev.sh +0 -53
- package/website/docker-compose.dev.yml +0 -36
- package/website/lib/version.ts +0 -35
- package/website/lib/versions.json +0 -103
- package/website/next.config.ts +0 -18
- package/website/nginx.conf +0 -32
- package/website/package-lock.json +0 -9679
- package/website/package.json +0 -59
- package/website/postcss.config.mjs +0 -9
- package/website/scripts/fetch-versions.js +0 -166
- package/website/scripts/generate-examples-index.js +0 -163
- package/website/scripts/merge-docs-to-wiki.ts +0 -207
- package/website/scripts/sync-version.js +0 -72
- package/website/scripts/sync-wiki.ts +0 -322
- package/website/scripts/upload-wiki.ts +0 -199
- package/website/styles/_spacing.scss +0 -453
- package/website/styles/_tokens.scss +0 -245
- package/website/styles/_typography.scss +0 -361
- package/website/styles/_variables.scss +0 -287
- package/website/tailwind.config.ts +0 -170
|
@@ -1,2075 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Langflow to OSSA"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Langflow to OSSA Migration Guide
|
|
6
|
-
|
|
7
|
-
**Version:** 1.0
|
|
8
|
-
**Last Updated:** 2025-11-10
|
|
9
|
-
**Status:** Production Ready
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
1. [Overview](#overview)
|
|
16
|
-
2. [Key Concepts Mapping](#key-concepts-mapping)
|
|
17
|
-
3. [Architecture Comparison](#architecture-comparison)
|
|
18
|
-
4. [Migration Strategy](#migration-strategy)
|
|
19
|
-
5. [Component Mapping Reference](#component-mapping-reference)
|
|
20
|
-
6. [Migration Examples](#migration-examples)
|
|
21
|
-
7. [Advanced Patterns](#advanced-patterns)
|
|
22
|
-
8. [Testing & Validation](#testing--validation)
|
|
23
|
-
9. [Best Practices](#best-practices)
|
|
24
|
-
10. [Troubleshooting](#troubleshooting)
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Overview
|
|
29
|
-
|
|
30
|
-
This guide provides a comprehensive methodology for migrating from Langflow's visual flow-based architecture to OSSA (Open Standards for Scalable Agents). While Langflow excels at rapid prototyping with visual workflows, OSSA provides production-grade agent orchestration with enhanced interoperability, type safety, and enterprise features.
|
|
31
|
-
|
|
32
|
-
### Why Migrate to OSSA?
|
|
33
|
-
|
|
34
|
-
- **Production-Ready Infrastructure**: Built-in monitoring, metrics, and compliance
|
|
35
|
-
- **Multi-Protocol Support**: HTTP, gRPC, WebSocket, stdio, A2A protocol bridges
|
|
36
|
-
- **Framework Interoperability**: Works with LangChain, CrewAI, AutoGen, and MCP
|
|
37
|
-
- **Type Safety**: Full JSON Schema validation and TypeScript definitions
|
|
38
|
-
- **Enterprise Features**: RBAC, encryption, audit logging, compliance frameworks
|
|
39
|
-
- **Cloud-Native**: Kubernetes-ready with resource management and auto-scaling
|
|
40
|
-
- **Version Control Friendly**: YAML-based configuration vs. JSON blobs
|
|
41
|
-
|
|
42
|
-
### Migration Effort Estimation
|
|
43
|
-
|
|
44
|
-
| Flow Complexity | Estimated Time | Difficulty |
|
|
45
|
-
|----------------|----------------|------------|
|
|
46
|
-
| Simple (1-5 nodes) | 30-60 minutes | Easy |
|
|
47
|
-
| Medium (6-15 nodes) | 2-4 hours | Moderate |
|
|
48
|
-
| Complex (16+ nodes) | 4-8 hours | Advanced |
|
|
49
|
-
| Multi-flow systems | 1-2 days | Advanced |
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Key Concepts Mapping
|
|
54
|
-
|
|
55
|
-
### Langflow → OSSA Terminology
|
|
56
|
-
|
|
57
|
-
| Langflow Concept | OSSA Equivalent | Description |
|
|
58
|
-
|-----------------|-----------------|-------------|
|
|
59
|
-
| **Flow** | **Agent Workflow** | Complete end-to-end process |
|
|
60
|
-
| **Node** | **Capability Operation** | Individual processing unit |
|
|
61
|
-
| **Edge** | **Workflow Step Connection** | Data flow between operations |
|
|
62
|
-
| **Component** | **Agent Capability** | Reusable functionality |
|
|
63
|
-
| **Input/Output** | **Input/Output Schema** | Data contracts with JSON Schema |
|
|
64
|
-
| **Template** | **Agent Manifest** | Configuration specification |
|
|
65
|
-
| **Variable** | **Environment Variable** | Runtime configuration |
|
|
66
|
-
| **API Key** | **Authentication Config** | Security credentials |
|
|
67
|
-
| **Prompt Template** | **LLM Configuration** | Model interaction setup |
|
|
68
|
-
| **Memory** | **Context Management** | State persistence |
|
|
69
|
-
|
|
70
|
-
### Data Flow Models
|
|
71
|
-
|
|
72
|
-
**Langflow (Node-Edge Graph)**:
|
|
73
|
-
```
|
|
74
|
-
ChatInput → PromptTemplate → OpenAI → ChatOutput
|
|
75
|
-
↓ ↓ ↓ ↓
|
|
76
|
-
User Msg Format Prompt Generate Display
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**OSSA (Capability-Based Workflow)**:
|
|
80
|
-
```yaml
|
|
81
|
-
capabilities:
|
|
82
|
-
- accept_input # ChatInput
|
|
83
|
-
- format_prompt # PromptTemplate
|
|
84
|
-
- llm_generation # OpenAI
|
|
85
|
-
- return_output # ChatOutput
|
|
86
|
-
|
|
87
|
-
workflow:
|
|
88
|
-
steps:
|
|
89
|
-
- accept_input → format_prompt
|
|
90
|
-
- format_prompt → llm_generation
|
|
91
|
-
- llm_generation → return_output
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Architecture Comparison
|
|
97
|
-
|
|
98
|
-
### Langflow Architecture
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
┌─────────────────────────────────────┐
|
|
102
|
-
│ Visual Flow Builder (UI) │
|
|
103
|
-
├─────────────────────────────────────┤
|
|
104
|
-
│ Nodes (Components) + Edges (Flows) │
|
|
105
|
-
├─────────────────────────────────────┤
|
|
106
|
-
│ Langflow Runtime Engine │
|
|
107
|
-
├─────────────────────────────────────┤
|
|
108
|
-
│ Python Execution Environment │
|
|
109
|
-
└─────────────────────────────────────┘
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Characteristics**:
|
|
113
|
-
- Visual-first design
|
|
114
|
-
- Python-centric execution
|
|
115
|
-
- JSON export format
|
|
116
|
-
- Single runtime model
|
|
117
|
-
- Limited interoperability
|
|
118
|
-
|
|
119
|
-
### OSSA Architecture
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
┌─────────────────────────────────────┐
|
|
123
|
-
│ Agent Manifest (YAML Config) │
|
|
124
|
-
├─────────────────────────────────────┤
|
|
125
|
-
│ Capabilities + Operations + Schema │
|
|
126
|
-
├─────────────────────────────────────┤
|
|
127
|
-
│ Protocol Bridges (MCP/HTTP/A2A) │
|
|
128
|
-
├─────────────────────────────────────┤
|
|
129
|
-
│ Multi-Runtime (Local/K8s/Serverless)│
|
|
130
|
-
├─────────────────────────────────────┤
|
|
131
|
-
│ Monitoring + Metrics + Compliance │
|
|
132
|
-
└─────────────────────────────────────┘
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**Characteristics**:
|
|
136
|
-
- Code and config as infrastructure
|
|
137
|
-
- Multi-language support (TypeScript, Python, Go, etc.)
|
|
138
|
-
- YAML manifest format
|
|
139
|
-
- Multiple deployment targets
|
|
140
|
-
- Universal interoperability via bridges
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## Migration Strategy
|
|
145
|
-
|
|
146
|
-
### Phase 1: Analysis & Planning
|
|
147
|
-
|
|
148
|
-
#### 1.1 Export Langflow Configuration
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
# From Langflow UI
|
|
152
|
-
1. Open your flow
|
|
153
|
-
2. Click "Export" button
|
|
154
|
-
3. Select "Save with my API keys" (optional)
|
|
155
|
-
4. Save as FLOW_NAME.json
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
#### 1.2 Analyze Flow Structure
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Use jq to inspect flow structure
|
|
162
|
-
jq '.data.nodes[] | {id: .id, type: .data.type, display_name: .data.node.display_name}' flow.json
|
|
163
|
-
|
|
164
|
-
# Count components
|
|
165
|
-
jq '.data.nodes | length' flow.json
|
|
166
|
-
|
|
167
|
-
# List edges (connections)
|
|
168
|
-
jq '.data.edges[] | {source: .source, target: .target}' flow.json
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
#### 1.3 Identify Migration Patterns
|
|
172
|
-
|
|
173
|
-
- **Sequential Processing**: Linear node chains → Workflow steps
|
|
174
|
-
- **Conditional Logic**: Switch nodes → Conditional capabilities
|
|
175
|
-
- **Parallel Processing**: Multiple edge branches → Parallel execution
|
|
176
|
-
- **Memory/State**: Context nodes → Context management
|
|
177
|
-
- **API Integrations**: HTTP nodes → Integration endpoints
|
|
178
|
-
|
|
179
|
-
### Phase 2: Component Mapping
|
|
180
|
-
|
|
181
|
-
#### 2.1 Create Capability Inventory
|
|
182
|
-
|
|
183
|
-
Map each unique Langflow node type to OSSA capabilities:
|
|
184
|
-
|
|
185
|
-
```yaml
|
|
186
|
-
# Example mapping table
|
|
187
|
-
langflow_components:
|
|
188
|
-
ChatInput: { ossa_capability: "accept_user_input", category: "input" }
|
|
189
|
-
PromptTemplate: { ossa_capability: "format_prompt", category: "processing" }
|
|
190
|
-
OpenAI: { ossa_capability: "llm_generation", category: "ai" }
|
|
191
|
-
ConversationChain: { ossa_capability: "conversation_management", category: "ai" }
|
|
192
|
-
ChatOutput: { ossa_capability: "return_response", category: "output" }
|
|
193
|
-
VectorStore: { ossa_capability: "vector_storage", category: "storage" }
|
|
194
|
-
Retriever: { ossa_capability: "semantic_search", category: "retrieval" }
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
#### 2.2 Define JSON Schemas
|
|
198
|
-
|
|
199
|
-
For each capability, create input/output schemas:
|
|
200
|
-
|
|
201
|
-
```yaml
|
|
202
|
-
capabilities:
|
|
203
|
-
- name: format_prompt
|
|
204
|
-
description: "Format user input into LLM prompt"
|
|
205
|
-
input_schema:
|
|
206
|
-
type: object
|
|
207
|
-
required: ["user_message", "template"]
|
|
208
|
-
properties:
|
|
209
|
-
user_message:
|
|
210
|
-
type: string
|
|
211
|
-
description: "User's input message"
|
|
212
|
-
template:
|
|
213
|
-
type: string
|
|
214
|
-
description: "Prompt template with placeholders"
|
|
215
|
-
variables:
|
|
216
|
-
type: object
|
|
217
|
-
description: "Template variable values"
|
|
218
|
-
output_schema:
|
|
219
|
-
type: object
|
|
220
|
-
required: ["formatted_prompt"]
|
|
221
|
-
properties:
|
|
222
|
-
formatted_prompt:
|
|
223
|
-
type: string
|
|
224
|
-
description: "Fully formatted prompt ready for LLM"
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Phase 3: OSSA Manifest Creation
|
|
228
|
-
|
|
229
|
-
#### 3.1 Base Agent Structure
|
|
230
|
-
|
|
231
|
-
```yaml
|
|
232
|
-
apiVersion: ossa/v1
|
|
233
|
-
kind: Agent
|
|
234
|
-
metadata:
|
|
235
|
-
name: migrated-chatbot-agent
|
|
236
|
-
version: 1.0.0
|
|
237
|
-
description: "Migrated from Langflow chatbot flow"
|
|
238
|
-
labels:
|
|
239
|
-
migration_source: langflow
|
|
240
|
-
original_flow: chatbot-v1
|
|
241
|
-
created_date: "2025-11-10"
|
|
242
|
-
|
|
243
|
-
spec:
|
|
244
|
-
role: workflow
|
|
245
|
-
|
|
246
|
-
runtime:
|
|
247
|
-
type: local
|
|
248
|
-
command: [node, dist/index.js]
|
|
249
|
-
resources:
|
|
250
|
-
cpu: 500m
|
|
251
|
-
memory: 512Mi
|
|
252
|
-
|
|
253
|
-
capabilities:
|
|
254
|
-
# Define all capabilities from mapping
|
|
255
|
-
|
|
256
|
-
integration:
|
|
257
|
-
protocol: http
|
|
258
|
-
endpoints:
|
|
259
|
-
base_url: http://localhost:3000
|
|
260
|
-
execute: /api/v1/execute
|
|
261
|
-
authentication:
|
|
262
|
-
type: api-key
|
|
263
|
-
|
|
264
|
-
monitoring:
|
|
265
|
-
traces: true
|
|
266
|
-
metrics: true
|
|
267
|
-
logs: true
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Phase 4: Implementation
|
|
271
|
-
|
|
272
|
-
#### 4.1 Generate Agent Scaffold
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
# Use BuildKit to create agent structure
|
|
276
|
-
buildkit agents create \
|
|
277
|
-
--name migrated-chatbot-agent \
|
|
278
|
-
--type workflow \
|
|
279
|
-
--capabilities "accept_input,format_prompt,llm_generation,return_response" \
|
|
280
|
-
--enable-mcp \
|
|
281
|
-
--interactive
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
#### 4.2 Implement Capability Handlers
|
|
285
|
-
|
|
286
|
-
```typescript
|
|
287
|
-
// src/capabilities/format-prompt.ts
|
|
288
|
-
import { CapabilityHandler } from '@ossa/agent-sdk';
|
|
289
|
-
|
|
290
|
-
export const formatPromptHandler: CapabilityHandler = async (input, context) => {
|
|
291
|
-
const { user_message, template, variables } = input;
|
|
292
|
-
|
|
293
|
-
// Replace template placeholders
|
|
294
|
-
let formatted_prompt = template;
|
|
295
|
-
for (const [key, value] of Object.entries(variables || {})) {
|
|
296
|
-
formatted_prompt = formatted_prompt.replace(`{${key}}`, value);
|
|
297
|
-
}
|
|
298
|
-
formatted_prompt = formatted_prompt.replace('{user_input}', user_message);
|
|
299
|
-
|
|
300
|
-
return { formatted_prompt };
|
|
301
|
-
};
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Phase 5: Testing & Validation
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
# Validate agent manifest
|
|
308
|
-
buildkit agents validate ./migrated-chatbot-agent.yaml
|
|
309
|
-
|
|
310
|
-
# Test individual capabilities
|
|
311
|
-
buildkit agents test \
|
|
312
|
-
--name migrated-chatbot-agent \
|
|
313
|
-
--capability format_prompt \
|
|
314
|
-
--input '{"user_message": "Hello", "template": "User said: {user_input}"}'
|
|
315
|
-
|
|
316
|
-
# Integration test
|
|
317
|
-
buildkit agents deploy --name migrated-chatbot-agent --env dev
|
|
318
|
-
curl -X POST http://localhost:3000/api/v1/execute \
|
|
319
|
-
-H "Content-Type: application/json" \
|
|
320
|
-
-d '{"operation": "process_conversation", "input": {"message": "Hello world"}}'
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
## Component Mapping Reference
|
|
326
|
-
|
|
327
|
-
### Input Components
|
|
328
|
-
|
|
329
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
330
|
-
|-------------------|------------------------|-------|
|
|
331
|
-
| `ChatInput` | `accept_user_input` | HTTP endpoint or stdio |
|
|
332
|
-
| `TextInput` | `accept_text_input` | Structured text input |
|
|
333
|
-
| `File` | `accept_file_upload` | File handling capability |
|
|
334
|
-
| `URLInput` | `fetch_url_content` | Web scraping capability |
|
|
335
|
-
|
|
336
|
-
### Processing Components
|
|
337
|
-
|
|
338
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
339
|
-
|-------------------|------------------------|-------|
|
|
340
|
-
| `PromptTemplate` | `format_prompt` | Template string processing |
|
|
341
|
-
| `TextSplitter` | `split_text` | Chunking logic |
|
|
342
|
-
| `CharacterTextSplitter` | `split_by_character` | Character-based splitting |
|
|
343
|
-
| `RecursiveCharacterTextSplitter` | `recursive_split` | Recursive chunking |
|
|
344
|
-
| `PythonFunction` | `execute_custom_logic` | Custom code execution |
|
|
345
|
-
| `ConditionalRouter` | `route_conditionally` | Conditional branching |
|
|
346
|
-
|
|
347
|
-
### AI/LLM Components
|
|
348
|
-
|
|
349
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
350
|
-
|-------------------|------------------------|-------|
|
|
351
|
-
| `OpenAI` | `openai_completion` | LLM generation |
|
|
352
|
-
| `ChatOpenAI` | `openai_chat` | Chat completion |
|
|
353
|
-
| `Anthropic` | `anthropic_completion` | Claude integration |
|
|
354
|
-
| `HuggingFace` | `huggingface_inference` | HF models |
|
|
355
|
-
| `Ollama` | `ollama_inference` | Local LLM |
|
|
356
|
-
| `ConversationChain` | `conversation_management` | Stateful conversation |
|
|
357
|
-
| `LLMChain` | `llm_chain_execution` | Chain processing |
|
|
358
|
-
|
|
359
|
-
### Vector Store Components
|
|
360
|
-
|
|
361
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
362
|
-
|-------------------|------------------------|-------|
|
|
363
|
-
| `Chroma` | `chroma_vector_store` | Chroma DB integration |
|
|
364
|
-
| `Pinecone` | `pinecone_vector_store` | Pinecone integration |
|
|
365
|
-
| `FAISS` | `faiss_vector_store` | Local vector DB |
|
|
366
|
-
| `Qdrant` | `qdrant_vector_store` | Qdrant integration |
|
|
367
|
-
| `Weaviate` | `weaviate_vector_store` | Weaviate integration |
|
|
368
|
-
|
|
369
|
-
### Retrieval Components
|
|
370
|
-
|
|
371
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
372
|
-
|-------------------|------------------------|-------|
|
|
373
|
-
| `VectorStoreRetriever` | `semantic_search` | Vector similarity search |
|
|
374
|
-
| `MultiQueryRetriever` | `multi_query_search` | Query expansion |
|
|
375
|
-
| `ContextualCompressionRetriever` | `compressed_retrieval` | Result compression |
|
|
376
|
-
|
|
377
|
-
### Memory Components
|
|
378
|
-
|
|
379
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
380
|
-
|-------------------|------------------------|-------|
|
|
381
|
-
| `ConversationBufferMemory` | `buffer_memory_management` | Full history storage |
|
|
382
|
-
| `ConversationSummaryMemory` | `summary_memory_management` | Summarized history |
|
|
383
|
-
| `ConversationBufferWindowMemory` | `window_memory_management` | Sliding window |
|
|
384
|
-
|
|
385
|
-
### Output Components
|
|
386
|
-
|
|
387
|
-
| Langflow Component | OSSA Capability Pattern | Notes |
|
|
388
|
-
|-------------------|------------------------|-------|
|
|
389
|
-
| `ChatOutput` | `return_chat_response` | Chat response |
|
|
390
|
-
| `TextOutput` | `return_text_output` | Plain text output |
|
|
391
|
-
| `JSONOutput` | `return_json_output` | Structured JSON |
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
## Migration Examples
|
|
396
|
-
|
|
397
|
-
### Example 1: Simple Chatbot Flow
|
|
398
|
-
|
|
399
|
-
#### Langflow JSON Export
|
|
400
|
-
|
|
401
|
-
```json
|
|
402
|
-
{
|
|
403
|
-
"data": {
|
|
404
|
-
"nodes": [
|
|
405
|
-
{
|
|
406
|
-
"id": "ChatInput-abc123",
|
|
407
|
-
"type": "ChatInput",
|
|
408
|
-
"position": { "x": 100, "y": 100 },
|
|
409
|
-
"data": {
|
|
410
|
-
"node": {
|
|
411
|
-
"display_name": "Chat Input",
|
|
412
|
-
"description": "Accept user messages",
|
|
413
|
-
"template": {
|
|
414
|
-
"input_value": {
|
|
415
|
-
"type": "str",
|
|
416
|
-
"required": true,
|
|
417
|
-
"placeholder": "Enter your message"
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"id": "PromptTemplate-def456",
|
|
425
|
-
"type": "PromptTemplate",
|
|
426
|
-
"position": { "x": 300, "y": 100 },
|
|
427
|
-
"data": {
|
|
428
|
-
"node": {
|
|
429
|
-
"display_name": "Prompt Formatter",
|
|
430
|
-
"template": {
|
|
431
|
-
"template": {
|
|
432
|
-
"type": "str",
|
|
433
|
-
"value": "You are a helpful assistant. User: {user_input}\nAssistant:"
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
"id": "OpenAI-ghi789",
|
|
441
|
-
"type": "ChatOpenAI",
|
|
442
|
-
"position": { "x": 500, "y": 100 },
|
|
443
|
-
"data": {
|
|
444
|
-
"node": {
|
|
445
|
-
"display_name": "OpenAI GPT-4",
|
|
446
|
-
"template": {
|
|
447
|
-
"model_name": {
|
|
448
|
-
"value": "gpt-4"
|
|
449
|
-
},
|
|
450
|
-
"temperature": {
|
|
451
|
-
"value": 0.7
|
|
452
|
-
},
|
|
453
|
-
"max_tokens": {
|
|
454
|
-
"value": 500
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
"id": "ChatOutput-jkl012",
|
|
462
|
-
"type": "ChatOutput",
|
|
463
|
-
"position": { "x": 700, "y": 100 },
|
|
464
|
-
"data": {
|
|
465
|
-
"node": {
|
|
466
|
-
"display_name": "Chat Output",
|
|
467
|
-
"description": "Display response to user"
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
],
|
|
472
|
-
"edges": [
|
|
473
|
-
{
|
|
474
|
-
"id": "edge-1",
|
|
475
|
-
"source": "ChatInput-abc123",
|
|
476
|
-
"target": "PromptTemplate-def456",
|
|
477
|
-
"sourceHandle": "output",
|
|
478
|
-
"targetHandle": "user_input"
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
"id": "edge-2",
|
|
482
|
-
"source": "PromptTemplate-def456",
|
|
483
|
-
"target": "OpenAI-ghi789",
|
|
484
|
-
"sourceHandle": "prompt",
|
|
485
|
-
"targetHandle": "messages"
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
"id": "edge-3",
|
|
489
|
-
"source": "OpenAI-ghi789",
|
|
490
|
-
"target": "ChatOutput-jkl012",
|
|
491
|
-
"sourceHandle": "response",
|
|
492
|
-
"targetHandle": "input"
|
|
493
|
-
}
|
|
494
|
-
]
|
|
495
|
-
},
|
|
496
|
-
"description": "Simple chatbot with OpenAI",
|
|
497
|
-
"name": "Simple Chatbot"
|
|
498
|
-
}
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
#### OSSA YAML Manifest
|
|
502
|
-
|
|
503
|
-
```yaml
|
|
504
|
-
apiVersion: ossa/v1
|
|
505
|
-
kind: Agent
|
|
506
|
-
metadata:
|
|
507
|
-
name: simple-chatbot
|
|
508
|
-
version: 1.0.0
|
|
509
|
-
description: "Simple chatbot with OpenAI - migrated from Langflow"
|
|
510
|
-
labels:
|
|
511
|
-
migration_source: langflow
|
|
512
|
-
original_flow: simple-chatbot
|
|
513
|
-
annotations:
|
|
514
|
-
langflow.original_nodes: "4"
|
|
515
|
-
langflow.original_edges: "3"
|
|
516
|
-
|
|
517
|
-
spec:
|
|
518
|
-
role: workflow
|
|
519
|
-
|
|
520
|
-
# LLM Configuration (from OpenAI node)
|
|
521
|
-
llm:
|
|
522
|
-
provider: openai
|
|
523
|
-
model: gpt-4
|
|
524
|
-
temperature: 0.7
|
|
525
|
-
maxTokens: 500
|
|
526
|
-
|
|
527
|
-
# Capabilities (mapped from nodes)
|
|
528
|
-
capabilities:
|
|
529
|
-
- name: accept_chat_input
|
|
530
|
-
description: "Accept user messages (from ChatInput node)"
|
|
531
|
-
input_schema:
|
|
532
|
-
type: object
|
|
533
|
-
required: ["message"]
|
|
534
|
-
properties:
|
|
535
|
-
message:
|
|
536
|
-
type: string
|
|
537
|
-
description: "User's chat message"
|
|
538
|
-
output_schema:
|
|
539
|
-
type: object
|
|
540
|
-
properties:
|
|
541
|
-
user_message:
|
|
542
|
-
type: string
|
|
543
|
-
|
|
544
|
-
- name: format_prompt
|
|
545
|
-
description: "Format message into LLM prompt (from PromptTemplate node)"
|
|
546
|
-
input_schema:
|
|
547
|
-
type: object
|
|
548
|
-
required: ["user_input"]
|
|
549
|
-
properties:
|
|
550
|
-
user_input:
|
|
551
|
-
type: string
|
|
552
|
-
output_schema:
|
|
553
|
-
type: object
|
|
554
|
-
properties:
|
|
555
|
-
formatted_prompt:
|
|
556
|
-
type: string
|
|
557
|
-
|
|
558
|
-
- name: generate_response
|
|
559
|
-
description: "Generate AI response (from ChatOpenAI node)"
|
|
560
|
-
input_schema:
|
|
561
|
-
type: object
|
|
562
|
-
required: ["prompt"]
|
|
563
|
-
properties:
|
|
564
|
-
prompt:
|
|
565
|
-
type: string
|
|
566
|
-
output_schema:
|
|
567
|
-
type: object
|
|
568
|
-
properties:
|
|
569
|
-
response:
|
|
570
|
-
type: string
|
|
571
|
-
description: "AI-generated response"
|
|
572
|
-
|
|
573
|
-
- name: return_response
|
|
574
|
-
description: "Return chat response (from ChatOutput node)"
|
|
575
|
-
input_schema:
|
|
576
|
-
type: object
|
|
577
|
-
required: ["response"]
|
|
578
|
-
properties:
|
|
579
|
-
response:
|
|
580
|
-
type: string
|
|
581
|
-
output_schema:
|
|
582
|
-
type: object
|
|
583
|
-
properties:
|
|
584
|
-
output:
|
|
585
|
-
type: string
|
|
586
|
-
|
|
587
|
-
# Runtime Configuration
|
|
588
|
-
runtime:
|
|
589
|
-
type: local
|
|
590
|
-
command: [node, dist/index.js]
|
|
591
|
-
environment:
|
|
592
|
-
OPENAI_API_KEY: ${OPENAI_API_KEY}
|
|
593
|
-
NODE_ENV: production
|
|
594
|
-
resources:
|
|
595
|
-
cpu: 500m
|
|
596
|
-
memory: 512Mi
|
|
597
|
-
|
|
598
|
-
# Integration Protocol
|
|
599
|
-
integration:
|
|
600
|
-
protocol: http
|
|
601
|
-
endpoints:
|
|
602
|
-
base_url: http://localhost:3000
|
|
603
|
-
execute: /api/v1/chat
|
|
604
|
-
health: /health
|
|
605
|
-
metrics: /metrics
|
|
606
|
-
authentication:
|
|
607
|
-
type: api-key
|
|
608
|
-
config:
|
|
609
|
-
header: X-API-Key
|
|
610
|
-
|
|
611
|
-
# Monitoring
|
|
612
|
-
monitoring:
|
|
613
|
-
traces: true
|
|
614
|
-
metrics: true
|
|
615
|
-
logs: true
|
|
616
|
-
alerts:
|
|
617
|
-
- type: error_rate
|
|
618
|
-
threshold: 0.05
|
|
619
|
-
action: notify
|
|
620
|
-
|
|
621
|
-
# Policies
|
|
622
|
-
policies:
|
|
623
|
-
encryption: true
|
|
624
|
-
audit: true
|
|
625
|
-
compliance:
|
|
626
|
-
- ISO42001
|
|
627
|
-
- SOC2
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
#### Implementation Code
|
|
631
|
-
|
|
632
|
-
```typescript
|
|
633
|
-
// src/index.ts
|
|
634
|
-
import { OSSAAgent, CapabilityHandler } from '@ossa/agent-sdk';
|
|
635
|
-
import OpenAI from 'openai';
|
|
636
|
-
|
|
637
|
-
const openai = new OpenAI({
|
|
638
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
639
|
-
});
|
|
640
|
-
|
|
641
|
-
// Capability: accept_chat_input
|
|
642
|
-
const acceptChatInput: CapabilityHandler = async (input) => {
|
|
643
|
-
return { user_message: input.message };
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
// Capability: format_prompt
|
|
647
|
-
const formatPrompt: CapabilityHandler = async (input) => {
|
|
648
|
-
const template = "You are a helpful assistant. User: {user_input}\nAssistant:";
|
|
649
|
-
const formatted_prompt = template.replace('{user_input}', input.user_input);
|
|
650
|
-
return { formatted_prompt };
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
// Capability: generate_response
|
|
654
|
-
const generateResponse: CapabilityHandler = async (input) => {
|
|
655
|
-
const completion = await openai.chat.completions.create({
|
|
656
|
-
model: 'gpt-4',
|
|
657
|
-
messages: [{ role: 'user', content: input.prompt }],
|
|
658
|
-
temperature: 0.7,
|
|
659
|
-
max_tokens: 500,
|
|
660
|
-
});
|
|
661
|
-
return { response: completion.choices[0].message.content };
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
// Capability: return_response
|
|
665
|
-
const returnResponse: CapabilityHandler = async (input) => {
|
|
666
|
-
return { output: input.response };
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
// Agent initialization
|
|
670
|
-
const agent = new OSSAAgent({
|
|
671
|
-
manifestPath: './simple-chatbot.yaml',
|
|
672
|
-
capabilities: {
|
|
673
|
-
accept_chat_input: acceptChatInput,
|
|
674
|
-
format_prompt: formatPrompt,
|
|
675
|
-
generate_response: generateResponse,
|
|
676
|
-
return_response: returnResponse,
|
|
677
|
-
},
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
// Workflow orchestration
|
|
681
|
-
agent.defineWorkflow('chat', async (input) => {
|
|
682
|
-
const step1 = await agent.execute('accept_chat_input', { message: input.message });
|
|
683
|
-
const step2 = await agent.execute('format_prompt', { user_input: step1.user_message });
|
|
684
|
-
const step3 = await agent.execute('generate_response', { prompt: step2.formatted_prompt });
|
|
685
|
-
const step4 = await agent.execute('return_response', { response: step3.response });
|
|
686
|
-
return step4.output;
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
agent.start();
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
---
|
|
693
|
-
|
|
694
|
-
### Example 2: RAG System with Vector Store
|
|
695
|
-
|
|
696
|
-
#### Langflow JSON Export
|
|
697
|
-
|
|
698
|
-
```json
|
|
699
|
-
{
|
|
700
|
-
"data": {
|
|
701
|
-
"nodes": [
|
|
702
|
-
{
|
|
703
|
-
"id": "TextInput-rag001",
|
|
704
|
-
"type": "TextInput",
|
|
705
|
-
"data": {
|
|
706
|
-
"node": {
|
|
707
|
-
"display_name": "User Query",
|
|
708
|
-
"template": {
|
|
709
|
-
"input_value": { "type": "str" }
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
"id": "Embeddings-rag002",
|
|
716
|
-
"type": "OpenAIEmbeddings",
|
|
717
|
-
"data": {
|
|
718
|
-
"node": {
|
|
719
|
-
"display_name": "Query Embeddings",
|
|
720
|
-
"template": {
|
|
721
|
-
"model": { "value": "text-embedding-3-small" }
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
},
|
|
726
|
-
{
|
|
727
|
-
"id": "VectorStore-rag003",
|
|
728
|
-
"type": "Qdrant",
|
|
729
|
-
"data": {
|
|
730
|
-
"node": {
|
|
731
|
-
"display_name": "Vector Database",
|
|
732
|
-
"template": {
|
|
733
|
-
"collection_name": { "value": "knowledge_base" },
|
|
734
|
-
"url": { "value": "http://localhost:6333" }
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
"id": "Retriever-rag004",
|
|
741
|
-
"type": "VectorStoreRetriever",
|
|
742
|
-
"data": {
|
|
743
|
-
"node": {
|
|
744
|
-
"display_name": "Semantic Search",
|
|
745
|
-
"template": {
|
|
746
|
-
"search_type": { "value": "similarity" },
|
|
747
|
-
"k": { "value": 5 }
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
"id": "PromptTemplate-rag005",
|
|
754
|
-
"type": "PromptTemplate",
|
|
755
|
-
"data": {
|
|
756
|
-
"node": {
|
|
757
|
-
"template": {
|
|
758
|
-
"template": {
|
|
759
|
-
"value": "Context: {context}\n\nQuestion: {question}\n\nAnswer based on context:"
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
"id": "LLM-rag006",
|
|
767
|
-
"type": "ChatOpenAI",
|
|
768
|
-
"data": {
|
|
769
|
-
"node": {
|
|
770
|
-
"template": {
|
|
771
|
-
"model_name": { "value": "gpt-4" },
|
|
772
|
-
"temperature": { "value": 0.3 }
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
"id": "Output-rag007",
|
|
779
|
-
"type": "TextOutput",
|
|
780
|
-
"data": {
|
|
781
|
-
"node": { "display_name": "Final Answer" }
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
],
|
|
785
|
-
"edges": [
|
|
786
|
-
{
|
|
787
|
-
"source": "TextInput-rag001",
|
|
788
|
-
"target": "Embeddings-rag002"
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
"source": "Embeddings-rag002",
|
|
792
|
-
"target": "VectorStore-rag003"
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
"source": "VectorStore-rag003",
|
|
796
|
-
"target": "Retriever-rag004"
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
"source": "Retriever-rag004",
|
|
800
|
-
"target": "PromptTemplate-rag005",
|
|
801
|
-
"sourceHandle": "documents",
|
|
802
|
-
"targetHandle": "context"
|
|
803
|
-
},
|
|
804
|
-
{
|
|
805
|
-
"source": "TextInput-rag001",
|
|
806
|
-
"target": "PromptTemplate-rag005",
|
|
807
|
-
"targetHandle": "question"
|
|
808
|
-
},
|
|
809
|
-
{
|
|
810
|
-
"source": "PromptTemplate-rag005",
|
|
811
|
-
"target": "LLM-rag006"
|
|
812
|
-
},
|
|
813
|
-
{
|
|
814
|
-
"source": "LLM-rag006",
|
|
815
|
-
"target": "Output-rag007"
|
|
816
|
-
}
|
|
817
|
-
]
|
|
818
|
-
},
|
|
819
|
-
"name": "RAG Knowledge Base",
|
|
820
|
-
"description": "RAG system with Qdrant vector store"
|
|
821
|
-
}
|
|
822
|
-
```
|
|
823
|
-
|
|
824
|
-
#### OSSA YAML Manifest
|
|
825
|
-
|
|
826
|
-
```yaml
|
|
827
|
-
apiVersion: ossa/v1
|
|
828
|
-
kind: Agent
|
|
829
|
-
metadata:
|
|
830
|
-
name: rag-knowledge-base
|
|
831
|
-
version: 1.0.0
|
|
832
|
-
description: "RAG system with vector store - migrated from Langflow"
|
|
833
|
-
labels:
|
|
834
|
-
migration_source: langflow
|
|
835
|
-
pattern: retrieval-augmented-generation
|
|
836
|
-
vector_db: qdrant
|
|
837
|
-
|
|
838
|
-
spec:
|
|
839
|
-
role: workflow
|
|
840
|
-
|
|
841
|
-
# LLM Configuration
|
|
842
|
-
llm:
|
|
843
|
-
provider: openai
|
|
844
|
-
model: gpt-4
|
|
845
|
-
temperature: 0.3
|
|
846
|
-
maxTokens: 1000
|
|
847
|
-
|
|
848
|
-
# Capabilities
|
|
849
|
-
capabilities:
|
|
850
|
-
- name: accept_query
|
|
851
|
-
description: "Accept user query"
|
|
852
|
-
input_schema:
|
|
853
|
-
type: object
|
|
854
|
-
required: ["question"]
|
|
855
|
-
properties:
|
|
856
|
-
question:
|
|
857
|
-
type: string
|
|
858
|
-
description: "User's question"
|
|
859
|
-
output_schema:
|
|
860
|
-
type: object
|
|
861
|
-
properties:
|
|
862
|
-
query:
|
|
863
|
-
type: string
|
|
864
|
-
|
|
865
|
-
- name: generate_embeddings
|
|
866
|
-
description: "Generate query embeddings"
|
|
867
|
-
input_schema:
|
|
868
|
-
type: object
|
|
869
|
-
required: ["text"]
|
|
870
|
-
properties:
|
|
871
|
-
text:
|
|
872
|
-
type: string
|
|
873
|
-
output_schema:
|
|
874
|
-
type: object
|
|
875
|
-
properties:
|
|
876
|
-
embeddings:
|
|
877
|
-
type: array
|
|
878
|
-
items:
|
|
879
|
-
type: number
|
|
880
|
-
|
|
881
|
-
- name: vector_search
|
|
882
|
-
description: "Search vector database"
|
|
883
|
-
input_schema:
|
|
884
|
-
type: object
|
|
885
|
-
required: ["embeddings", "k"]
|
|
886
|
-
properties:
|
|
887
|
-
embeddings:
|
|
888
|
-
type: array
|
|
889
|
-
items:
|
|
890
|
-
type: number
|
|
891
|
-
k:
|
|
892
|
-
type: integer
|
|
893
|
-
default: 5
|
|
894
|
-
description: "Number of results to return"
|
|
895
|
-
collection:
|
|
896
|
-
type: string
|
|
897
|
-
default: "knowledge_base"
|
|
898
|
-
output_schema:
|
|
899
|
-
type: object
|
|
900
|
-
properties:
|
|
901
|
-
documents:
|
|
902
|
-
type: array
|
|
903
|
-
items:
|
|
904
|
-
type: object
|
|
905
|
-
properties:
|
|
906
|
-
content:
|
|
907
|
-
type: string
|
|
908
|
-
score:
|
|
909
|
-
type: number
|
|
910
|
-
metadata:
|
|
911
|
-
type: object
|
|
912
|
-
|
|
913
|
-
- name: format_rag_prompt
|
|
914
|
-
description: "Format RAG prompt with context"
|
|
915
|
-
input_schema:
|
|
916
|
-
type: object
|
|
917
|
-
required: ["question", "documents"]
|
|
918
|
-
properties:
|
|
919
|
-
question:
|
|
920
|
-
type: string
|
|
921
|
-
documents:
|
|
922
|
-
type: array
|
|
923
|
-
items:
|
|
924
|
-
type: object
|
|
925
|
-
output_schema:
|
|
926
|
-
type: object
|
|
927
|
-
properties:
|
|
928
|
-
prompt:
|
|
929
|
-
type: string
|
|
930
|
-
|
|
931
|
-
- name: generate_answer
|
|
932
|
-
description: "Generate contextual answer"
|
|
933
|
-
input_schema:
|
|
934
|
-
type: object
|
|
935
|
-
required: ["prompt"]
|
|
936
|
-
properties:
|
|
937
|
-
prompt:
|
|
938
|
-
type: string
|
|
939
|
-
output_schema:
|
|
940
|
-
type: object
|
|
941
|
-
properties:
|
|
942
|
-
answer:
|
|
943
|
-
type: string
|
|
944
|
-
description: "Generated answer with citations"
|
|
945
|
-
|
|
946
|
-
# Runtime Configuration
|
|
947
|
-
runtime:
|
|
948
|
-
type: docker
|
|
949
|
-
image: ossa/rag-agent:1.0.0
|
|
950
|
-
environment:
|
|
951
|
-
OPENAI_API_KEY: ${OPENAI_API_KEY}
|
|
952
|
-
QDRANT_URL: http://qdrant:6333
|
|
953
|
-
QDRANT_API_KEY: ${QDRANT_API_KEY}
|
|
954
|
-
EMBEDDING_MODEL: text-embedding-3-small
|
|
955
|
-
resources:
|
|
956
|
-
cpu: 1000m
|
|
957
|
-
memory: 1Gi
|
|
958
|
-
|
|
959
|
-
# Integration
|
|
960
|
-
integration:
|
|
961
|
-
protocol: http
|
|
962
|
-
endpoints:
|
|
963
|
-
base_url: http://localhost:3000
|
|
964
|
-
execute: /api/v1/query
|
|
965
|
-
health: /health
|
|
966
|
-
authentication:
|
|
967
|
-
type: bearer
|
|
968
|
-
config:
|
|
969
|
-
token_env: API_TOKEN
|
|
970
|
-
|
|
971
|
-
# External Integrations
|
|
972
|
-
dependencies:
|
|
973
|
-
- name: qdrant
|
|
974
|
-
type: vector_database
|
|
975
|
-
endpoint: http://qdrant:6333
|
|
976
|
-
authentication:
|
|
977
|
-
type: api-key
|
|
978
|
-
- name: openai
|
|
979
|
-
type: llm_provider
|
|
980
|
-
endpoint: https://api.openai.com/v1
|
|
981
|
-
|
|
982
|
-
# Monitoring
|
|
983
|
-
monitoring:
|
|
984
|
-
traces: true
|
|
985
|
-
metrics: true
|
|
986
|
-
logs: true
|
|
987
|
-
custom_metrics:
|
|
988
|
-
- name: retrieval_latency_ms
|
|
989
|
-
type: histogram
|
|
990
|
-
- name: embedding_generation_time_ms
|
|
991
|
-
type: histogram
|
|
992
|
-
- name: documents_retrieved
|
|
993
|
-
type: gauge
|
|
994
|
-
|
|
995
|
-
# Performance
|
|
996
|
-
performance:
|
|
997
|
-
throughput:
|
|
998
|
-
requestsPerSecond: 20
|
|
999
|
-
concurrentRequests: 5
|
|
1000
|
-
latency:
|
|
1001
|
-
p50: 2000
|
|
1002
|
-
p95: 5000
|
|
1003
|
-
p99: 8000
|
|
1004
|
-
```
|
|
1005
|
-
|
|
1006
|
-
#### Implementation Code
|
|
1007
|
-
|
|
1008
|
-
```typescript
|
|
1009
|
-
// src/index.ts
|
|
1010
|
-
import { OSSAAgent } from '@ossa/agent-sdk';
|
|
1011
|
-
import OpenAI from 'openai';
|
|
1012
|
-
import { QdrantClient } from '@qdrant/js-client-rest';
|
|
1013
|
-
|
|
1014
|
-
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
|
|
1015
|
-
const qdrant = new QdrantClient({ url: process.env.QDRANT_URL });
|
|
1016
|
-
|
|
1017
|
-
const agent = new OSSAAgent({ manifestPath: './rag-knowledge-base.yaml' });
|
|
1018
|
-
|
|
1019
|
-
// Capability: accept_query
|
|
1020
|
-
agent.registerCapability('accept_query', async (input) => {
|
|
1021
|
-
return { query: input.question };
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1024
|
-
// Capability: generate_embeddings
|
|
1025
|
-
agent.registerCapability('generate_embeddings', async (input) => {
|
|
1026
|
-
const response = await openai.embeddings.create({
|
|
1027
|
-
model: 'text-embedding-3-small',
|
|
1028
|
-
input: input.text,
|
|
1029
|
-
});
|
|
1030
|
-
return { embeddings: response.data[0].embedding };
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
// Capability: vector_search
|
|
1034
|
-
agent.registerCapability('vector_search', async (input) => {
|
|
1035
|
-
const results = await qdrant.search(input.collection || 'knowledge_base', {
|
|
1036
|
-
vector: input.embeddings,
|
|
1037
|
-
limit: input.k || 5,
|
|
1038
|
-
with_payload: true,
|
|
1039
|
-
});
|
|
1040
|
-
|
|
1041
|
-
const documents = results.map(result => ({
|
|
1042
|
-
content: result.payload?.text || '',
|
|
1043
|
-
score: result.score,
|
|
1044
|
-
metadata: result.payload || {},
|
|
1045
|
-
}));
|
|
1046
|
-
|
|
1047
|
-
return { documents };
|
|
1048
|
-
});
|
|
1049
|
-
|
|
1050
|
-
// Capability: format_rag_prompt
|
|
1051
|
-
agent.registerCapability('format_rag_prompt', async (input) => {
|
|
1052
|
-
const context = input.documents
|
|
1053
|
-
.map((doc: any) => doc.content)
|
|
1054
|
-
.join('\n\n');
|
|
1055
|
-
|
|
1056
|
-
const prompt = `Context: ${context}\n\nQuestion: ${input.question}\n\nAnswer based on context:`;
|
|
1057
|
-
return { prompt };
|
|
1058
|
-
});
|
|
1059
|
-
|
|
1060
|
-
// Capability: generate_answer
|
|
1061
|
-
agent.registerCapability('generate_answer', async (input) => {
|
|
1062
|
-
const completion = await openai.chat.completions.create({
|
|
1063
|
-
model: 'gpt-4',
|
|
1064
|
-
messages: [{ role: 'user', content: input.prompt }],
|
|
1065
|
-
temperature: 0.3,
|
|
1066
|
-
max_tokens: 1000,
|
|
1067
|
-
});
|
|
1068
|
-
|
|
1069
|
-
return { answer: completion.choices[0].message.content };
|
|
1070
|
-
});
|
|
1071
|
-
|
|
1072
|
-
// Workflow: RAG query processing
|
|
1073
|
-
agent.defineWorkflow('rag_query', async (input) => {
|
|
1074
|
-
// Step 1: Accept and validate query
|
|
1075
|
-
const { query } = await agent.execute('accept_query', { question: input.question });
|
|
1076
|
-
|
|
1077
|
-
// Step 2: Generate embeddings
|
|
1078
|
-
const { embeddings } = await agent.execute('generate_embeddings', { text: query });
|
|
1079
|
-
|
|
1080
|
-
// Step 3: Search vector database
|
|
1081
|
-
const { documents } = await agent.execute('vector_search', {
|
|
1082
|
-
embeddings,
|
|
1083
|
-
k: input.k || 5,
|
|
1084
|
-
collection: input.collection || 'knowledge_base'
|
|
1085
|
-
});
|
|
1086
|
-
|
|
1087
|
-
// Step 4: Format RAG prompt
|
|
1088
|
-
const { prompt } = await agent.execute('format_rag_prompt', {
|
|
1089
|
-
question: query,
|
|
1090
|
-
documents
|
|
1091
|
-
});
|
|
1092
|
-
|
|
1093
|
-
// Step 5: Generate answer
|
|
1094
|
-
const { answer } = await agent.execute('generate_answer', { prompt });
|
|
1095
|
-
|
|
1096
|
-
return {
|
|
1097
|
-
answer,
|
|
1098
|
-
sources: documents,
|
|
1099
|
-
metadata: {
|
|
1100
|
-
query,
|
|
1101
|
-
num_sources: documents.length,
|
|
1102
|
-
timestamp: new Date().toISOString(),
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
});
|
|
1106
|
-
|
|
1107
|
-
agent.start();
|
|
1108
|
-
```
|
|
1109
|
-
|
|
1110
|
-
---
|
|
1111
|
-
|
|
1112
|
-
### Example 3: Multi-Agent Workflow with Conditional Routing
|
|
1113
|
-
|
|
1114
|
-
#### Langflow JSON Export
|
|
1115
|
-
|
|
1116
|
-
```json
|
|
1117
|
-
{
|
|
1118
|
-
"data": {
|
|
1119
|
-
"nodes": [
|
|
1120
|
-
{
|
|
1121
|
-
"id": "Input-multi001",
|
|
1122
|
-
"type": "ChatInput",
|
|
1123
|
-
"data": {
|
|
1124
|
-
"node": {
|
|
1125
|
-
"display_name": "User Request"
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
"id": "Classifier-multi002",
|
|
1131
|
-
"type": "ChatOpenAI",
|
|
1132
|
-
"data": {
|
|
1133
|
-
"node": {
|
|
1134
|
-
"display_name": "Intent Classifier",
|
|
1135
|
-
"template": {
|
|
1136
|
-
"system_message": {
|
|
1137
|
-
"value": "Classify user intent: QUESTION, CODE_HELP, or GENERAL_CHAT"
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
"id": "Router-multi003",
|
|
1145
|
-
"type": "ConditionalRouter",
|
|
1146
|
-
"data": {
|
|
1147
|
-
"node": {
|
|
1148
|
-
"display_name": "Route by Intent",
|
|
1149
|
-
"template": {
|
|
1150
|
-
"rules": [
|
|
1151
|
-
{ "condition": "intent == 'QUESTION'", "route": "qa_agent" },
|
|
1152
|
-
{ "condition": "intent == 'CODE_HELP'", "route": "code_agent" },
|
|
1153
|
-
{ "condition": "intent == 'GENERAL_CHAT'", "route": "chat_agent" }
|
|
1154
|
-
]
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
},
|
|
1159
|
-
{
|
|
1160
|
-
"id": "QAAgent-multi004",
|
|
1161
|
-
"type": "ConversationChain",
|
|
1162
|
-
"data": {
|
|
1163
|
-
"node": {
|
|
1164
|
-
"display_name": "Q&A Specialist",
|
|
1165
|
-
"template": {
|
|
1166
|
-
"llm": { "value": "gpt-4" },
|
|
1167
|
-
"system_message": { "value": "You are a Q&A expert." }
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
"id": "CodeAgent-multi005",
|
|
1174
|
-
"type": "ConversationChain",
|
|
1175
|
-
"data": {
|
|
1176
|
-
"node": {
|
|
1177
|
-
"display_name": "Code Assistant",
|
|
1178
|
-
"template": {
|
|
1179
|
-
"llm": { "value": "gpt-4" },
|
|
1180
|
-
"system_message": { "value": "You are a coding expert." }
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
"id": "ChatAgent-multi006",
|
|
1187
|
-
"type": "ConversationChain",
|
|
1188
|
-
"data": {
|
|
1189
|
-
"node": {
|
|
1190
|
-
"display_name": "General Chatbot",
|
|
1191
|
-
"template": {
|
|
1192
|
-
"llm": { "value": "gpt-3.5-turbo" }
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
},
|
|
1197
|
-
{
|
|
1198
|
-
"id": "Merger-multi007",
|
|
1199
|
-
"type": "MergeData",
|
|
1200
|
-
"data": {
|
|
1201
|
-
"node": {
|
|
1202
|
-
"display_name": "Merge Responses"
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
"id": "Output-multi008",
|
|
1208
|
-
"type": "ChatOutput",
|
|
1209
|
-
"data": {
|
|
1210
|
-
"node": {
|
|
1211
|
-
"display_name": "Final Response"
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
],
|
|
1216
|
-
"edges": [
|
|
1217
|
-
{ "source": "Input-multi001", "target": "Classifier-multi002" },
|
|
1218
|
-
{ "source": "Classifier-multi002", "target": "Router-multi003" },
|
|
1219
|
-
{ "source": "Router-multi003", "target": "QAAgent-multi004", "sourceHandle": "qa_agent" },
|
|
1220
|
-
{ "source": "Router-multi003", "target": "CodeAgent-multi005", "sourceHandle": "code_agent" },
|
|
1221
|
-
{ "source": "Router-multi003", "target": "ChatAgent-multi006", "sourceHandle": "chat_agent" },
|
|
1222
|
-
{ "source": "QAAgent-multi004", "target": "Merger-multi007" },
|
|
1223
|
-
{ "source": "CodeAgent-multi005", "target": "Merger-multi007" },
|
|
1224
|
-
{ "source": "ChatAgent-multi006", "target": "Merger-multi007" },
|
|
1225
|
-
{ "source": "Merger-multi007", "target": "Output-multi008" }
|
|
1226
|
-
]
|
|
1227
|
-
},
|
|
1228
|
-
"name": "Multi-Agent Router",
|
|
1229
|
-
"description": "Intelligent routing to specialized agents"
|
|
1230
|
-
}
|
|
1231
|
-
```
|
|
1232
|
-
|
|
1233
|
-
#### OSSA YAML Manifest
|
|
1234
|
-
|
|
1235
|
-
```yaml
|
|
1236
|
-
apiVersion: ossa/v1
|
|
1237
|
-
kind: Agent
|
|
1238
|
-
metadata:
|
|
1239
|
-
name: multi-agent-router
|
|
1240
|
-
version: 1.0.0
|
|
1241
|
-
description: "Multi-agent system with intelligent routing - migrated from Langflow"
|
|
1242
|
-
labels:
|
|
1243
|
-
migration_source: langflow
|
|
1244
|
-
pattern: multi-agent-orchestration
|
|
1245
|
-
routing: intent-based
|
|
1246
|
-
|
|
1247
|
-
spec:
|
|
1248
|
-
role: orchestration
|
|
1249
|
-
|
|
1250
|
-
# Capabilities
|
|
1251
|
-
capabilities:
|
|
1252
|
-
- name: classify_intent
|
|
1253
|
-
description: "Classify user intent for routing"
|
|
1254
|
-
input_schema:
|
|
1255
|
-
type: object
|
|
1256
|
-
required: ["message"]
|
|
1257
|
-
properties:
|
|
1258
|
-
message:
|
|
1259
|
-
type: string
|
|
1260
|
-
output_schema:
|
|
1261
|
-
type: object
|
|
1262
|
-
required: ["intent", "confidence"]
|
|
1263
|
-
properties:
|
|
1264
|
-
intent:
|
|
1265
|
-
type: string
|
|
1266
|
-
enum: ["QUESTION", "CODE_HELP", "GENERAL_CHAT"]
|
|
1267
|
-
confidence:
|
|
1268
|
-
type: number
|
|
1269
|
-
minimum: 0
|
|
1270
|
-
maximum: 1
|
|
1271
|
-
|
|
1272
|
-
- name: route_to_specialist
|
|
1273
|
-
description: "Route to appropriate specialist agent"
|
|
1274
|
-
input_schema:
|
|
1275
|
-
type: object
|
|
1276
|
-
required: ["intent", "message"]
|
|
1277
|
-
properties:
|
|
1278
|
-
intent:
|
|
1279
|
-
type: string
|
|
1280
|
-
message:
|
|
1281
|
-
type: string
|
|
1282
|
-
output_schema:
|
|
1283
|
-
type: object
|
|
1284
|
-
properties:
|
|
1285
|
-
agent_id:
|
|
1286
|
-
type: string
|
|
1287
|
-
description: "Selected specialist agent"
|
|
1288
|
-
|
|
1289
|
-
- name: qa_specialist
|
|
1290
|
-
description: "Q&A expert agent"
|
|
1291
|
-
input_schema:
|
|
1292
|
-
type: object
|
|
1293
|
-
required: ["question"]
|
|
1294
|
-
properties:
|
|
1295
|
-
question:
|
|
1296
|
-
type: string
|
|
1297
|
-
output_schema:
|
|
1298
|
-
type: object
|
|
1299
|
-
properties:
|
|
1300
|
-
answer:
|
|
1301
|
-
type: string
|
|
1302
|
-
|
|
1303
|
-
- name: code_specialist
|
|
1304
|
-
description: "Code assistant agent"
|
|
1305
|
-
input_schema:
|
|
1306
|
-
type: object
|
|
1307
|
-
required: ["code_query"]
|
|
1308
|
-
properties:
|
|
1309
|
-
code_query:
|
|
1310
|
-
type: string
|
|
1311
|
-
output_schema:
|
|
1312
|
-
type: object
|
|
1313
|
-
properties:
|
|
1314
|
-
code_response:
|
|
1315
|
-
type: string
|
|
1316
|
-
description: "Code help with examples"
|
|
1317
|
-
|
|
1318
|
-
- name: chat_specialist
|
|
1319
|
-
description: "General conversation agent"
|
|
1320
|
-
input_schema:
|
|
1321
|
-
type: object
|
|
1322
|
-
required: ["message"]
|
|
1323
|
-
properties:
|
|
1324
|
-
message:
|
|
1325
|
-
type: string
|
|
1326
|
-
output_schema:
|
|
1327
|
-
type: object
|
|
1328
|
-
properties:
|
|
1329
|
-
chat_response:
|
|
1330
|
-
type: string
|
|
1331
|
-
|
|
1332
|
-
# Sub-agents (specialist agents)
|
|
1333
|
-
agents:
|
|
1334
|
-
- id: qa-specialist-agent
|
|
1335
|
-
name: Q&A Specialist
|
|
1336
|
-
role: workflow
|
|
1337
|
-
llm:
|
|
1338
|
-
provider: openai
|
|
1339
|
-
model: gpt-4
|
|
1340
|
-
temperature: 0.2
|
|
1341
|
-
systemMessage: "You are a Q&A expert. Provide accurate, detailed answers."
|
|
1342
|
-
|
|
1343
|
-
- id: code-specialist-agent
|
|
1344
|
-
name: Code Assistant
|
|
1345
|
-
role: workflow
|
|
1346
|
-
llm:
|
|
1347
|
-
provider: openai
|
|
1348
|
-
model: gpt-4
|
|
1349
|
-
temperature: 0.1
|
|
1350
|
-
systemMessage: "You are a coding expert. Provide code examples and explanations."
|
|
1351
|
-
|
|
1352
|
-
- id: chat-specialist-agent
|
|
1353
|
-
name: General Chatbot
|
|
1354
|
-
role: workflow
|
|
1355
|
-
llm:
|
|
1356
|
-
provider: openai
|
|
1357
|
-
model: gpt-3.5-turbo
|
|
1358
|
-
temperature: 0.7
|
|
1359
|
-
systemMessage: "You are a friendly general chatbot."
|
|
1360
|
-
|
|
1361
|
-
# Runtime
|
|
1362
|
-
runtime:
|
|
1363
|
-
type: kubernetes
|
|
1364
|
-
image: ossa/multi-agent-router:1.0.0
|
|
1365
|
-
replicas: 2
|
|
1366
|
-
resources:
|
|
1367
|
-
cpu: 1000m
|
|
1368
|
-
memory: 1Gi
|
|
1369
|
-
|
|
1370
|
-
# Integration
|
|
1371
|
-
integration:
|
|
1372
|
-
protocol: http
|
|
1373
|
-
endpoints:
|
|
1374
|
-
base_url: http://localhost:3000
|
|
1375
|
-
execute: /api/v1/route
|
|
1376
|
-
|
|
1377
|
-
# Monitoring
|
|
1378
|
-
monitoring:
|
|
1379
|
-
traces: true
|
|
1380
|
-
metrics: true
|
|
1381
|
-
logs: true
|
|
1382
|
-
custom_metrics:
|
|
1383
|
-
- name: intent_classification_accuracy
|
|
1384
|
-
type: gauge
|
|
1385
|
-
- name: routing_decisions
|
|
1386
|
-
type: counter
|
|
1387
|
-
labels: ["intent", "agent"]
|
|
1388
|
-
- name: specialist_response_time_ms
|
|
1389
|
-
type: histogram
|
|
1390
|
-
labels: ["agent"]
|
|
1391
|
-
```
|
|
1392
|
-
|
|
1393
|
-
#### Implementation Code
|
|
1394
|
-
|
|
1395
|
-
```typescript
|
|
1396
|
-
// src/index.ts
|
|
1397
|
-
import { OSSAAgent, OrchestratorAgent } from '@ossa/agent-sdk';
|
|
1398
|
-
import OpenAI from 'openai';
|
|
1399
|
-
|
|
1400
|
-
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
|
|
1401
|
-
|
|
1402
|
-
// Main orchestrator agent
|
|
1403
|
-
const orchestrator = new OrchestratorAgent({
|
|
1404
|
-
manifestPath: './multi-agent-router.yaml',
|
|
1405
|
-
});
|
|
1406
|
-
|
|
1407
|
-
// Capability: classify_intent
|
|
1408
|
-
orchestrator.registerCapability('classify_intent', async (input) => {
|
|
1409
|
-
const completion = await openai.chat.completions.create({
|
|
1410
|
-
model: 'gpt-4',
|
|
1411
|
-
messages: [
|
|
1412
|
-
{
|
|
1413
|
-
role: 'system',
|
|
1414
|
-
content: 'Classify user intent. Respond ONLY with JSON: {"intent": "QUESTION"|"CODE_HELP"|"GENERAL_CHAT", "confidence": 0.0-1.0}',
|
|
1415
|
-
},
|
|
1416
|
-
{ role: 'user', content: input.message },
|
|
1417
|
-
],
|
|
1418
|
-
temperature: 0.1,
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
const result = JSON.parse(completion.choices[0].message.content);
|
|
1422
|
-
return result;
|
|
1423
|
-
});
|
|
1424
|
-
|
|
1425
|
-
// Capability: route_to_specialist
|
|
1426
|
-
orchestrator.registerCapability('route_to_specialist', async (input) => {
|
|
1427
|
-
const routingMap = {
|
|
1428
|
-
QUESTION: 'qa-specialist-agent',
|
|
1429
|
-
CODE_HELP: 'code-specialist-agent',
|
|
1430
|
-
GENERAL_CHAT: 'chat-specialist-agent',
|
|
1431
|
-
};
|
|
1432
|
-
|
|
1433
|
-
return { agent_id: routingMap[input.intent] || 'chat-specialist-agent' };
|
|
1434
|
-
});
|
|
1435
|
-
|
|
1436
|
-
// Specialist Agents
|
|
1437
|
-
const qaAgent = new OSSAAgent({
|
|
1438
|
-
id: 'qa-specialist-agent',
|
|
1439
|
-
name: 'Q&A Specialist',
|
|
1440
|
-
});
|
|
1441
|
-
|
|
1442
|
-
qaAgent.registerCapability('qa_specialist', async (input) => {
|
|
1443
|
-
const completion = await openai.chat.completions.create({
|
|
1444
|
-
model: 'gpt-4',
|
|
1445
|
-
messages: [
|
|
1446
|
-
{
|
|
1447
|
-
role: 'system',
|
|
1448
|
-
content: 'You are a Q&A expert. Provide accurate, detailed answers.',
|
|
1449
|
-
},
|
|
1450
|
-
{ role: 'user', content: input.question },
|
|
1451
|
-
],
|
|
1452
|
-
temperature: 0.2,
|
|
1453
|
-
});
|
|
1454
|
-
|
|
1455
|
-
return { answer: completion.choices[0].message.content };
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
const codeAgent = new OSSAAgent({
|
|
1459
|
-
id: 'code-specialist-agent',
|
|
1460
|
-
name: 'Code Assistant',
|
|
1461
|
-
});
|
|
1462
|
-
|
|
1463
|
-
codeAgent.registerCapability('code_specialist', async (input) => {
|
|
1464
|
-
const completion = await openai.chat.completions.create({
|
|
1465
|
-
model: 'gpt-4',
|
|
1466
|
-
messages: [
|
|
1467
|
-
{
|
|
1468
|
-
role: 'system',
|
|
1469
|
-
content: 'You are a coding expert. Provide code examples and explanations.',
|
|
1470
|
-
},
|
|
1471
|
-
{ role: 'user', content: input.code_query },
|
|
1472
|
-
],
|
|
1473
|
-
temperature: 0.1,
|
|
1474
|
-
});
|
|
1475
|
-
|
|
1476
|
-
return { code_response: completion.choices[0].message.content };
|
|
1477
|
-
});
|
|
1478
|
-
|
|
1479
|
-
const chatAgent = new OSSAAgent({
|
|
1480
|
-
id: 'chat-specialist-agent',
|
|
1481
|
-
name: 'General Chatbot',
|
|
1482
|
-
});
|
|
1483
|
-
|
|
1484
|
-
chatAgent.registerCapability('chat_specialist', async (input) => {
|
|
1485
|
-
const completion = await openai.chat.completions.create({
|
|
1486
|
-
model: 'gpt-3.5-turbo',
|
|
1487
|
-
messages: [
|
|
1488
|
-
{
|
|
1489
|
-
role: 'system',
|
|
1490
|
-
content: 'You are a friendly general chatbot.',
|
|
1491
|
-
},
|
|
1492
|
-
{ role: 'user', content: input.message },
|
|
1493
|
-
],
|
|
1494
|
-
temperature: 0.7,
|
|
1495
|
-
});
|
|
1496
|
-
|
|
1497
|
-
return { chat_response: completion.choices[0].message.content };
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
// Register specialist agents with orchestrator
|
|
1501
|
-
orchestrator.registerAgent(qaAgent);
|
|
1502
|
-
orchestrator.registerAgent(codeAgent);
|
|
1503
|
-
orchestrator.registerAgent(chatAgent);
|
|
1504
|
-
|
|
1505
|
-
// Orchestration workflow
|
|
1506
|
-
orchestrator.defineWorkflow('intelligent_routing', async (input) => {
|
|
1507
|
-
// Step 1: Classify intent
|
|
1508
|
-
const { intent, confidence } = await orchestrator.execute('classify_intent', {
|
|
1509
|
-
message: input.message,
|
|
1510
|
-
});
|
|
1511
|
-
|
|
1512
|
-
// Step 2: Route to specialist
|
|
1513
|
-
const { agent_id } = await orchestrator.execute('route_to_specialist', {
|
|
1514
|
-
intent,
|
|
1515
|
-
message: input.message,
|
|
1516
|
-
});
|
|
1517
|
-
|
|
1518
|
-
// Step 3: Execute on specialist agent
|
|
1519
|
-
let response;
|
|
1520
|
-
switch (agent_id) {
|
|
1521
|
-
case 'qa-specialist-agent':
|
|
1522
|
-
const qaResult = await orchestrator.delegateTo(agent_id, 'qa_specialist', {
|
|
1523
|
-
question: input.message,
|
|
1524
|
-
});
|
|
1525
|
-
response = qaResult.answer;
|
|
1526
|
-
break;
|
|
1527
|
-
|
|
1528
|
-
case 'code-specialist-agent':
|
|
1529
|
-
const codeResult = await orchestrator.delegateTo(agent_id, 'code_specialist', {
|
|
1530
|
-
code_query: input.message,
|
|
1531
|
-
});
|
|
1532
|
-
response = codeResult.code_response;
|
|
1533
|
-
break;
|
|
1534
|
-
|
|
1535
|
-
case 'chat-specialist-agent':
|
|
1536
|
-
const chatResult = await orchestrator.delegateTo(agent_id, 'chat_specialist', {
|
|
1537
|
-
message: input.message,
|
|
1538
|
-
});
|
|
1539
|
-
response = chatResult.chat_response;
|
|
1540
|
-
break;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
return {
|
|
1544
|
-
response,
|
|
1545
|
-
metadata: {
|
|
1546
|
-
intent,
|
|
1547
|
-
confidence,
|
|
1548
|
-
routed_to: agent_id,
|
|
1549
|
-
timestamp: new Date().toISOString(),
|
|
1550
|
-
},
|
|
1551
|
-
};
|
|
1552
|
-
});
|
|
1553
|
-
|
|
1554
|
-
orchestrator.start();
|
|
1555
|
-
```
|
|
1556
|
-
|
|
1557
|
-
---
|
|
1558
|
-
|
|
1559
|
-
## Advanced Patterns
|
|
1560
|
-
|
|
1561
|
-
### Pattern 1: Memory/State Management
|
|
1562
|
-
|
|
1563
|
-
**Langflow**: `ConversationBufferMemory` node
|
|
1564
|
-
|
|
1565
|
-
**OSSA**: Context management capability
|
|
1566
|
-
|
|
1567
|
-
```yaml
|
|
1568
|
-
capabilities:
|
|
1569
|
-
- name: manage_conversation_context
|
|
1570
|
-
description: "Manage conversation history and context"
|
|
1571
|
-
input_schema:
|
|
1572
|
-
type: object
|
|
1573
|
-
properties:
|
|
1574
|
-
session_id:
|
|
1575
|
-
type: string
|
|
1576
|
-
message:
|
|
1577
|
-
type: string
|
|
1578
|
-
action:
|
|
1579
|
-
type: string
|
|
1580
|
-
enum: ["add", "retrieve", "clear"]
|
|
1581
|
-
output_schema:
|
|
1582
|
-
type: object
|
|
1583
|
-
properties:
|
|
1584
|
-
context:
|
|
1585
|
-
type: array
|
|
1586
|
-
items:
|
|
1587
|
-
type: object
|
|
1588
|
-
properties:
|
|
1589
|
-
role:
|
|
1590
|
-
type: string
|
|
1591
|
-
content:
|
|
1592
|
-
type: string
|
|
1593
|
-
timestamp:
|
|
1594
|
-
type: string
|
|
1595
|
-
|
|
1596
|
-
configuration:
|
|
1597
|
-
context_management:
|
|
1598
|
-
backend: redis
|
|
1599
|
-
max_history: 10
|
|
1600
|
-
ttl_seconds: 3600
|
|
1601
|
-
compression: true
|
|
1602
|
-
```
|
|
1603
|
-
|
|
1604
|
-
### Pattern 2: Parallel Processing
|
|
1605
|
-
|
|
1606
|
-
**Langflow**: Multiple parallel edge branches
|
|
1607
|
-
|
|
1608
|
-
**OSSA**: Parallel execution in workflow
|
|
1609
|
-
|
|
1610
|
-
```typescript
|
|
1611
|
-
// Parallel execution
|
|
1612
|
-
orchestrator.defineWorkflow('parallel_processing', async (input) => {
|
|
1613
|
-
// Execute multiple capabilities in parallel
|
|
1614
|
-
const [result1, result2, result3] = await Promise.all([
|
|
1615
|
-
orchestrator.execute('process_option_a', input),
|
|
1616
|
-
orchestrator.execute('process_option_b', input),
|
|
1617
|
-
orchestrator.execute('process_option_c', input),
|
|
1618
|
-
]);
|
|
1619
|
-
|
|
1620
|
-
// Merge results
|
|
1621
|
-
return {
|
|
1622
|
-
combined: [result1, result2, result3],
|
|
1623
|
-
best_result: selectBestResult([result1, result2, result3]),
|
|
1624
|
-
};
|
|
1625
|
-
});
|
|
1626
|
-
```
|
|
1627
|
-
|
|
1628
|
-
### Pattern 3: Error Handling & Retry
|
|
1629
|
-
|
|
1630
|
-
**Langflow**: Limited error handling
|
|
1631
|
-
|
|
1632
|
-
**OSSA**: Built-in retry policies and error handling
|
|
1633
|
-
|
|
1634
|
-
```yaml
|
|
1635
|
-
policies:
|
|
1636
|
-
retry:
|
|
1637
|
-
max_attempts: 3
|
|
1638
|
-
backoff_strategy: exponential
|
|
1639
|
-
backoff_multiplier: 2
|
|
1640
|
-
initial_delay_ms: 1000
|
|
1641
|
-
max_delay_ms: 10000
|
|
1642
|
-
retry_on:
|
|
1643
|
-
- network_error
|
|
1644
|
-
- timeout
|
|
1645
|
-
- rate_limit
|
|
1646
|
-
|
|
1647
|
-
circuit_breaker:
|
|
1648
|
-
enabled: true
|
|
1649
|
-
failure_threshold: 5
|
|
1650
|
-
recovery_timeout_ms: 30000
|
|
1651
|
-
|
|
1652
|
-
fallback:
|
|
1653
|
-
enabled: true
|
|
1654
|
-
fallback_agent: backup-agent
|
|
1655
|
-
conditions:
|
|
1656
|
-
- primary_agent_unavailable
|
|
1657
|
-
- response_time_exceeded
|
|
1658
|
-
```
|
|
1659
|
-
|
|
1660
|
-
---
|
|
1661
|
-
|
|
1662
|
-
## Testing & Validation
|
|
1663
|
-
|
|
1664
|
-
### Pre-Migration Testing Checklist
|
|
1665
|
-
|
|
1666
|
-
```bash
|
|
1667
|
-
# 1. Export Langflow flow
|
|
1668
|
-
# Download flow.json from Langflow UI
|
|
1669
|
-
|
|
1670
|
-
# 2. Validate JSON structure
|
|
1671
|
-
jq '.' flow.json > /dev/null && echo "Valid JSON" || echo "Invalid JSON"
|
|
1672
|
-
|
|
1673
|
-
# 3. Document flow behavior
|
|
1674
|
-
# Test in Langflow UI and record:
|
|
1675
|
-
# - Input examples
|
|
1676
|
-
# - Expected outputs
|
|
1677
|
-
# - Edge cases
|
|
1678
|
-
# - Error scenarios
|
|
1679
|
-
|
|
1680
|
-
# 4. Identify external dependencies
|
|
1681
|
-
jq '.data.nodes[] | select(.data.node.template.api_key != null) | .data.node.display_name' flow.json
|
|
1682
|
-
```
|
|
1683
|
-
|
|
1684
|
-
### Post-Migration Testing
|
|
1685
|
-
|
|
1686
|
-
```bash
|
|
1687
|
-
# 1. Validate OSSA manifest
|
|
1688
|
-
buildkit agents validate ./migrated-agent.yaml
|
|
1689
|
-
|
|
1690
|
-
# 2. Test individual capabilities
|
|
1691
|
-
buildkit agents test \
|
|
1692
|
-
--name migrated-agent \
|
|
1693
|
-
--capability format_prompt \
|
|
1694
|
-
--input '{"user_input": "test message"}' \
|
|
1695
|
-
--expect-output '{"formatted_prompt": ".*test message.*"}'
|
|
1696
|
-
|
|
1697
|
-
# 3. Integration test
|
|
1698
|
-
buildkit agents deploy --name migrated-agent --env test
|
|
1699
|
-
|
|
1700
|
-
# Test HTTP endpoint
|
|
1701
|
-
curl -X POST http://localhost:3000/api/v1/execute \
|
|
1702
|
-
-H "Content-Type: application/json" \
|
|
1703
|
-
-d '{
|
|
1704
|
-
"operation": "process_conversation",
|
|
1705
|
-
"input": {"message": "Hello world"},
|
|
1706
|
-
"context": {"session_id": "test-123"}
|
|
1707
|
-
}'
|
|
1708
|
-
|
|
1709
|
-
# 4. Load testing
|
|
1710
|
-
npx autocannon -c 10 -d 30 http://localhost:3000/api/v1/execute \
|
|
1711
|
-
-m POST \
|
|
1712
|
-
-H "Content-Type: application/json" \
|
|
1713
|
-
-b '{"operation":"process_conversation","input":{"message":"test"}}'
|
|
1714
|
-
|
|
1715
|
-
# 5. Compare outputs
|
|
1716
|
-
# Run same inputs through Langflow and OSSA
|
|
1717
|
-
# Compare outputs for consistency
|
|
1718
|
-
```
|
|
1719
|
-
|
|
1720
|
-
### Regression Test Suite
|
|
1721
|
-
|
|
1722
|
-
```typescript
|
|
1723
|
-
// tests/migration-regression.test.ts
|
|
1724
|
-
import { describe, test, expect } from 'vitest';
|
|
1725
|
-
import { OSSAAgent } from '@ossa/agent-sdk';
|
|
1726
|
-
|
|
1727
|
-
describe('Migration Regression Tests', () => {
|
|
1728
|
-
const agent = new OSSAAgent({ manifestPath: './migrated-agent.yaml' });
|
|
1729
|
-
|
|
1730
|
-
test('should match Langflow output for simple query', async () => {
|
|
1731
|
-
const input = { message: 'What is the capital of France?' };
|
|
1732
|
-
|
|
1733
|
-
const ossaResult = await agent.executeWorkflow('chat', input);
|
|
1734
|
-
|
|
1735
|
-
// Compare with known Langflow output
|
|
1736
|
-
expect(ossaResult.output).toContain('Paris');
|
|
1737
|
-
});
|
|
1738
|
-
|
|
1739
|
-
test('should handle edge case: empty input', async () => {
|
|
1740
|
-
const input = { message: '' };
|
|
1741
|
-
|
|
1742
|
-
await expect(
|
|
1743
|
-
agent.executeWorkflow('chat', input)
|
|
1744
|
-
).rejects.toThrow('Input validation failed');
|
|
1745
|
-
});
|
|
1746
|
-
|
|
1747
|
-
test('should preserve response quality', async () => {
|
|
1748
|
-
const input = { message: 'Explain quantum computing' };
|
|
1749
|
-
|
|
1750
|
-
const result = await agent.executeWorkflow('chat', input);
|
|
1751
|
-
|
|
1752
|
-
// Quality checks
|
|
1753
|
-
expect(result.output.length).toBeGreaterThan(100);
|
|
1754
|
-
expect(result.output).toMatch(/quantum|qubit|superposition/i);
|
|
1755
|
-
});
|
|
1756
|
-
});
|
|
1757
|
-
```
|
|
1758
|
-
|
|
1759
|
-
---
|
|
1760
|
-
|
|
1761
|
-
## Best Practices
|
|
1762
|
-
|
|
1763
|
-
### 1. Incremental Migration
|
|
1764
|
-
|
|
1765
|
-
Migrate flows incrementally rather than all at once:
|
|
1766
|
-
|
|
1767
|
-
```bash
|
|
1768
|
-
# Phase 1: Migrate simple flows (1-5 nodes)
|
|
1769
|
-
# Phase 2: Migrate medium flows (6-15 nodes)
|
|
1770
|
-
# Phase 3: Migrate complex flows (16+ nodes)
|
|
1771
|
-
# Phase 4: Integrate all migrated agents
|
|
1772
|
-
```
|
|
1773
|
-
|
|
1774
|
-
### 2. Preserve Original Flows
|
|
1775
|
-
|
|
1776
|
-
Keep Langflow flows as reference:
|
|
1777
|
-
|
|
1778
|
-
```bash
|
|
1779
|
-
# Create migration archive
|
|
1780
|
-
mkdir -p ./migration-archive/langflow-exports
|
|
1781
|
-
cp *.json ./migration-archive/langflow-exports/
|
|
1782
|
-
git add ./migration-archive
|
|
1783
|
-
git commit -m "Archive original Langflow flows for reference"
|
|
1784
|
-
```
|
|
1785
|
-
|
|
1786
|
-
### 3. Documentation
|
|
1787
|
-
|
|
1788
|
-
Document migration decisions:
|
|
1789
|
-
|
|
1790
|
-
```yaml
|
|
1791
|
-
# In agent manifest
|
|
1792
|
-
metadata:
|
|
1793
|
-
annotations:
|
|
1794
|
-
migration.source: "langflow"
|
|
1795
|
-
migration.original_flow: "chatbot-v1.json"
|
|
1796
|
-
migration.date: "2025-11-10"
|
|
1797
|
-
migration.notes: |
|
|
1798
|
-
- Converted PromptTemplate node to format_prompt capability
|
|
1799
|
-
- Replaced ConversationBufferMemory with Redis-backed context management
|
|
1800
|
-
- Added retry policy for OpenAI API calls
|
|
1801
|
-
- Enhanced error handling with circuit breaker
|
|
1802
|
-
```
|
|
1803
|
-
|
|
1804
|
-
### 4. Type Safety
|
|
1805
|
-
|
|
1806
|
-
Leverage OSSA's JSON Schema validation:
|
|
1807
|
-
|
|
1808
|
-
```yaml
|
|
1809
|
-
capabilities:
|
|
1810
|
-
- name: process_data
|
|
1811
|
-
input_schema:
|
|
1812
|
-
type: object
|
|
1813
|
-
required: ["data", "format"]
|
|
1814
|
-
properties:
|
|
1815
|
-
data:
|
|
1816
|
-
type: string
|
|
1817
|
-
minLength: 1
|
|
1818
|
-
maxLength: 10000
|
|
1819
|
-
format:
|
|
1820
|
-
type: string
|
|
1821
|
-
enum: ["json", "xml", "yaml"]
|
|
1822
|
-
options:
|
|
1823
|
-
type: object
|
|
1824
|
-
additionalProperties: false
|
|
1825
|
-
properties:
|
|
1826
|
-
pretty:
|
|
1827
|
-
type: boolean
|
|
1828
|
-
default: false
|
|
1829
|
-
output_schema:
|
|
1830
|
-
type: object
|
|
1831
|
-
required: ["processed_data", "metadata"]
|
|
1832
|
-
properties:
|
|
1833
|
-
processed_data:
|
|
1834
|
-
type: string
|
|
1835
|
-
metadata:
|
|
1836
|
-
type: object
|
|
1837
|
-
required: ["processing_time_ms", "format"]
|
|
1838
|
-
```
|
|
1839
|
-
|
|
1840
|
-
### 5. Monitoring & Observability
|
|
1841
|
-
|
|
1842
|
-
Add comprehensive monitoring:
|
|
1843
|
-
|
|
1844
|
-
```yaml
|
|
1845
|
-
monitoring:
|
|
1846
|
-
traces: true
|
|
1847
|
-
metrics: true
|
|
1848
|
-
logs: true
|
|
1849
|
-
|
|
1850
|
-
custom_metrics:
|
|
1851
|
-
- name: langflow_compatibility_score
|
|
1852
|
-
type: gauge
|
|
1853
|
-
description: "Compatibility with original Langflow flow behavior"
|
|
1854
|
-
|
|
1855
|
-
- name: migration_regression_errors
|
|
1856
|
-
type: counter
|
|
1857
|
-
description: "Regression errors vs. original flow"
|
|
1858
|
-
|
|
1859
|
-
alerts:
|
|
1860
|
-
- type: regression_detected
|
|
1861
|
-
condition: "migration_regression_errors > 0"
|
|
1862
|
-
action: notify
|
|
1863
|
-
channels: ["slack", "pagerduty"]
|
|
1864
|
-
|
|
1865
|
-
- type: performance_degradation
|
|
1866
|
-
condition: "avg_response_time > langflow_baseline * 1.5"
|
|
1867
|
-
action: notify
|
|
1868
|
-
```
|
|
1869
|
-
|
|
1870
|
-
### 6. Version Control Strategy
|
|
1871
|
-
|
|
1872
|
-
```bash
|
|
1873
|
-
# Create migration branch
|
|
1874
|
-
git checkout -b migration/langflow-to-ossa
|
|
1875
|
-
|
|
1876
|
-
# Commit structure
|
|
1877
|
-
git add .agents/migrated-agent/
|
|
1878
|
-
git commit -m "feat: migrate chatbot flow from Langflow to OSSA
|
|
1879
|
-
|
|
1880
|
-
- Convert 4 nodes to OSSA capabilities
|
|
1881
|
-
- Add JSON Schema validation
|
|
1882
|
-
- Implement error handling and retries
|
|
1883
|
-
- Add comprehensive monitoring
|
|
1884
|
-
|
|
1885
|
-
Migration notes:
|
|
1886
|
-
- Source: langflow-chatbot-v1.json
|
|
1887
|
-
- All regression tests passing
|
|
1888
|
-
- Performance within 5% of original"
|
|
1889
|
-
```
|
|
1890
|
-
|
|
1891
|
-
---
|
|
1892
|
-
|
|
1893
|
-
## Troubleshooting
|
|
1894
|
-
|
|
1895
|
-
### Common Issues
|
|
1896
|
-
|
|
1897
|
-
#### Issue 1: Missing Langflow Component Equivalent
|
|
1898
|
-
|
|
1899
|
-
**Problem**: Langflow component has no direct OSSA equivalent
|
|
1900
|
-
|
|
1901
|
-
**Solution**: Create custom capability
|
|
1902
|
-
|
|
1903
|
-
```typescript
|
|
1904
|
-
// Example: Custom Langflow component
|
|
1905
|
-
agent.registerCapability('custom_langflow_component', async (input) => {
|
|
1906
|
-
// Replicate Langflow component logic
|
|
1907
|
-
const result = await customLogic(input);
|
|
1908
|
-
return result;
|
|
1909
|
-
});
|
|
1910
|
-
```
|
|
1911
|
-
|
|
1912
|
-
#### Issue 2: Complex Edge Routing
|
|
1913
|
-
|
|
1914
|
-
**Problem**: Langflow has complex conditional edges
|
|
1915
|
-
|
|
1916
|
-
**Solution**: Implement workflow logic with conditionals
|
|
1917
|
-
|
|
1918
|
-
```typescript
|
|
1919
|
-
orchestrator.defineWorkflow('complex_routing', async (input) => {
|
|
1920
|
-
const step1 = await orchestrator.execute('initial_process', input);
|
|
1921
|
-
|
|
1922
|
-
// Conditional routing
|
|
1923
|
-
if (step1.condition === 'A') {
|
|
1924
|
-
return await orchestrator.execute('route_a', step1);
|
|
1925
|
-
} else if (step1.condition === 'B') {
|
|
1926
|
-
return await orchestrator.execute('route_b', step1);
|
|
1927
|
-
} else {
|
|
1928
|
-
return await orchestrator.execute('default_route', step1);
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
```
|
|
1932
|
-
|
|
1933
|
-
#### Issue 3: State Management Differences
|
|
1934
|
-
|
|
1935
|
-
**Problem**: Langflow memory components work differently
|
|
1936
|
-
|
|
1937
|
-
**Solution**: Implement external state store
|
|
1938
|
-
|
|
1939
|
-
```yaml
|
|
1940
|
-
configuration:
|
|
1941
|
-
state_management:
|
|
1942
|
-
backend: redis
|
|
1943
|
-
redis_url: redis://localhost:6379
|
|
1944
|
-
key_prefix: "agent:state:"
|
|
1945
|
-
ttl: 3600
|
|
1946
|
-
```
|
|
1947
|
-
|
|
1948
|
-
```typescript
|
|
1949
|
-
import Redis from 'ioredis';
|
|
1950
|
-
|
|
1951
|
-
const redis = new Redis(process.env.REDIS_URL);
|
|
1952
|
-
|
|
1953
|
-
agent.registerCapability('manage_state', async (input) => {
|
|
1954
|
-
const key = `agent:state:${input.session_id}`;
|
|
1955
|
-
|
|
1956
|
-
if (input.action === 'save') {
|
|
1957
|
-
await redis.setex(key, 3600, JSON.stringify(input.state));
|
|
1958
|
-
} else if (input.action === 'retrieve') {
|
|
1959
|
-
const state = await redis.get(key);
|
|
1960
|
-
return { state: state ? JSON.parse(state) : null };
|
|
1961
|
-
}
|
|
1962
|
-
});
|
|
1963
|
-
```
|
|
1964
|
-
|
|
1965
|
-
#### Issue 4: Performance Degradation
|
|
1966
|
-
|
|
1967
|
-
**Problem**: OSSA agent slower than Langflow
|
|
1968
|
-
|
|
1969
|
-
**Solution**: Optimize capability execution and add caching
|
|
1970
|
-
|
|
1971
|
-
```yaml
|
|
1972
|
-
configuration:
|
|
1973
|
-
caching:
|
|
1974
|
-
enabled: true
|
|
1975
|
-
backend: redis
|
|
1976
|
-
ttl_seconds: 300
|
|
1977
|
-
cache_key_strategy: input_hash
|
|
1978
|
-
|
|
1979
|
-
performance:
|
|
1980
|
-
enable_parallel_execution: true
|
|
1981
|
-
max_concurrent_capabilities: 5
|
|
1982
|
-
timeout_ms: 5000
|
|
1983
|
-
```
|
|
1984
|
-
|
|
1985
|
-
#### Issue 5: API Key Management
|
|
1986
|
-
|
|
1987
|
-
**Problem**: Langflow's API key handling differs
|
|
1988
|
-
|
|
1989
|
-
**Solution**: Use OSSA environment variables and secret management
|
|
1990
|
-
|
|
1991
|
-
```yaml
|
|
1992
|
-
runtime:
|
|
1993
|
-
environment:
|
|
1994
|
-
OPENAI_API_KEY: ${OPENAI_API_KEY}
|
|
1995
|
-
QDRANT_API_KEY: ${QDRANT_API_KEY}
|
|
1996
|
-
|
|
1997
|
-
secrets:
|
|
1998
|
-
- name: api-keys
|
|
1999
|
-
type: kubernetes-secret
|
|
2000
|
-
mount_path: /secrets
|
|
2001
|
-
```
|
|
2002
|
-
|
|
2003
|
-
---
|
|
2004
|
-
|
|
2005
|
-
## Migration Automation Tools
|
|
2006
|
-
|
|
2007
|
-
### Langflow-to-OSSA CLI Tool
|
|
2008
|
-
|
|
2009
|
-
```bash
|
|
2010
|
-
# Install migration tool
|
|
2011
|
-
npm install -g @ossa/langflow-migrator
|
|
2012
|
-
|
|
2013
|
-
# Analyze Langflow flow
|
|
2014
|
-
ossa-migrate analyze langflow-flow.json
|
|
2015
|
-
|
|
2016
|
-
# Output:
|
|
2017
|
-
# Flow Complexity: Medium (7 nodes, 6 edges)
|
|
2018
|
-
# Estimated Migration Time: 2-3 hours
|
|
2019
|
-
# Components:
|
|
2020
|
-
# - ChatInput (1) → accept_user_input capability
|
|
2021
|
-
# - PromptTemplate (1) → format_prompt capability
|
|
2022
|
-
# - OpenAI (1) → llm_generation capability
|
|
2023
|
-
# - VectorStore (1) → vector_storage capability
|
|
2024
|
-
# - Retriever (1) → semantic_search capability
|
|
2025
|
-
# - ConversationMemory (1) → context_management capability
|
|
2026
|
-
# - ChatOutput (1) → return_response capability
|
|
2027
|
-
|
|
2028
|
-
# Generate OSSA manifest
|
|
2029
|
-
ossa-migrate convert langflow-flow.json \
|
|
2030
|
-
--output ./agents/migrated-agent.yaml \
|
|
2031
|
-
--generate-code \
|
|
2032
|
-
--add-tests
|
|
2033
|
-
|
|
2034
|
-
# Output:
|
|
2035
|
-
# ✓ Generated OSSA manifest: ./agents/migrated-agent.yaml
|
|
2036
|
-
# ✓ Generated TypeScript implementation: ./agents/migrated-agent/src/index.ts
|
|
2037
|
-
# ✓ Generated test suite: ./agents/migrated-agent/tests/
|
|
2038
|
-
# ✓ Generated documentation: ./agents/migrated-agent/README.md
|
|
2039
|
-
|
|
2040
|
-
# Validate migration
|
|
2041
|
-
ossa-migrate validate \
|
|
2042
|
-
--langflow langflow-flow.json \
|
|
2043
|
-
--ossa ./agents/migrated-agent.yaml \
|
|
2044
|
-
--test-inputs test-cases.json
|
|
2045
|
-
```
|
|
2046
|
-
|
|
2047
|
-
---
|
|
2048
|
-
|
|
2049
|
-
## Additional Resources
|
|
2050
|
-
|
|
2051
|
-
### Documentation
|
|
2052
|
-
|
|
2053
|
-
- **OSSA Specification**: https://github.com/blueflyio/openstandardagents/wiki/home
|
|
2054
|
-
- **OSSA Quick Reference**: [OSSA-QUICK-REFERENCE.md](../OSSA-QUICK-REFERENCE.md)
|
|
2055
|
-
- **BuildKit CLI**: https://github.com/blueflyio/documentation/-/wikis/BuildKit-CLI-Reference
|
|
2056
|
-
- **Langflow Documentation**: https://docs.langflow.org/
|
|
2057
|
-
|
|
2058
|
-
### Example Repositories
|
|
2059
|
-
|
|
2060
|
-
- **OSSA Agent Examples**: `.agents/` directory in agent-buildkit
|
|
2061
|
-
- **Migration Examples**: `examples/migrations/langflow/`
|
|
2062
|
-
|
|
2063
|
-
### Community & Support
|
|
2064
|
-
|
|
2065
|
-
- **GitLab Issues**: https://github.com/blueflyio/documentation/-/issues
|
|
2066
|
-
- **Migration Support**: Tag issues with `migration::langflow`
|
|
2067
|
-
|
|
2068
|
-
---
|
|
2069
|
-
|
|
2070
|
-
**Version:** 1.0
|
|
2071
|
-
**Last Updated:** 2025-11-10
|
|
2072
|
-
**Maintained By:** OSSA Team
|
|
2073
|
-
**License:** MIT
|
|
2074
|
-
|
|
2075
|
-
**Feedback**: Please report issues or suggestions at https://github.com/blueflyio/documentation/-/issues/new?issue[title]=Langflow%20Migration%20Guide%20Feedback
|