|
6 | 6 |
|
7 | 7 | # AgentOS |
8 | 8 |
|
9 | | -**Open-source TypeScript runtime for production AI agents — multimodal RAG, multi-agent orchestration, 37 channel adapters, 5-tier guardrails, 21 LLM providers.** |
| 9 | +**Open-source TypeScript runtime for production AI agents — unified graph orchestration (AgentGraph / workflow / mission), multimodal RAG, 37 channel adapters, 5-tier guardrails, 21 LLM providers.** |
10 | 10 |
|
11 | 11 | [](https://www.npmjs.com/package/@framers/agentos) |
12 | 12 | [](https://github.com/framersai/agentos/actions) |
|
43 | 43 | - [Human-in-the-Loop (HITL)](#human-in-the-loop-hitl) |
44 | 44 | - [Channels System](#channels-system) |
45 | 45 | - [Voice and Telephony](#voice-and-telephony) |
46 | | - - [Workflows](#workflows) |
| 46 | + - [Unified Orchestration Layer](#unified-orchestration-layer) |
47 | 47 | - [Multi-Agent Coordination](#multi-agent-coordination) |
48 | 48 | - [Observability](#observability) |
49 | 49 | - [Skills](#skills) |
@@ -908,29 +908,73 @@ Voice providers are registered via `EXTENSION_KIND_TOOL` with the `voice-call-pr |
908 | 908 |
|
909 | 909 | --- |
910 | 910 |
|
911 | | -### Workflows |
| 911 | +### Unified Orchestration Layer |
912 | 912 |
|
913 | | -**Location:** `src/core/workflows/` |
| 913 | +**Location:** `src/orchestration/` |
914 | 914 |
|
915 | | -Declarative multi-step workflows with persistence and monitoring. |
| 915 | +Three authoring APIs compile to one `CompiledExecutionGraph` IR executed by a single `GraphRuntime`. Persistent checkpointing enables time-travel debugging and fault recovery. |
916 | 916 |
|
917 | | -- **WorkflowEngine** -- Instantiates and executes workflow definitions |
918 | | -- **IWorkflowStore** -- Persistence interface for workflow state (supports SQL and in-memory backends) |
919 | | -- **WorkflowTypes** -- Type definitions for workflow definitions, instances, tasks, and progress updates |
| 917 | +| API | Level | Use case | |
| 918 | +|-----|-------|----------| |
| 919 | +| **`AgentGraph`** | Low-level | Explicit nodes, edges, cycles, subgraphs — full graph control | |
| 920 | +| **`workflow()`** | Mid-level | Deterministic DAG chains with step/branch/parallel — Zod-typed I/O | |
| 921 | +| **`mission()`** | High-level | Intent-driven — declare goal + constraints, PlanningEngine decides steps | |
920 | 922 |
|
921 | | -Workflows integrate with the IAgentOS interface: |
| 923 | +**Differentiators vs LangGraph / Mastra:** memory-aware state, capability discovery routing, personality-driven edges, inter-step guardrails, streaming at every node transition. |
922 | 924 |
|
923 | 925 | ```typescript |
924 | | -// List available workflow definitions |
925 | | -const definitions = agent.listWorkflowDefinitions(); |
| 926 | +import { AgentGraph, toolNode, gmiNode, START, END } from '@framers/agentos/orchestration'; |
| 927 | +import { z } from 'zod'; |
| 928 | + |
| 929 | +// Low-level: explicit graph with conditional routing |
| 930 | +const graph = new AgentGraph({ |
| 931 | + input: z.object({ topic: z.string() }), |
| 932 | + scratch: z.object({ confidence: z.number().default(0) }), |
| 933 | + artifacts: z.object({ summary: z.string() }), |
| 934 | +}) |
| 935 | + .addNode('search', toolNode('web_search')) |
| 936 | + .addNode('evaluate', gmiNode({ instructions: 'Evaluate quality', executionMode: 'single_turn' })) |
| 937 | + .addNode('summarize', gmiNode({ instructions: 'Write summary', executionMode: 'single_turn' })) |
| 938 | + .addEdge(START, 'search') |
| 939 | + .addEdge('search', 'evaluate') |
| 940 | + .addConditionalEdge('evaluate', (s) => s.scratch.confidence > 0.8 ? 'summarize' : 'search') |
| 941 | + .addEdge('summarize', END) |
| 942 | + .compile(); |
| 943 | + |
| 944 | +const result = await graph.invoke({ topic: 'quantum computing' }); |
| 945 | + |
| 946 | +// Mid-level: deterministic workflow |
| 947 | +import { workflow } from '@framers/agentos/orchestration'; |
| 948 | + |
| 949 | +const flow = workflow('onboarding') |
| 950 | + .input(z.object({ email: z.string() })) |
| 951 | + .returns(z.object({ userId: z.string() })) |
| 952 | + .step('validate', { tool: 'email_validator' }) |
| 953 | + .then('create', { tool: 'user_service' }) |
| 954 | + .compile(); |
| 955 | + |
| 956 | +// High-level: intent-driven |
| 957 | +import { mission } from '@framers/agentos/orchestration'; |
| 958 | + |
| 959 | +const researcher = mission('research') |
| 960 | + .input(z.object({ topic: z.string() })) |
| 961 | + .goal('Research {topic} and produce a cited summary') |
| 962 | + .returns(z.object({ summary: z.string() })) |
| 963 | + .planner({ strategy: 'plan_and_execute', maxSteps: 8 }) |
| 964 | + .compile(); |
| 965 | + |
| 966 | +const plan = await researcher.explain({ topic: 'AI safety' }); // preview plan without executing |
| 967 | +``` |
926 | 968 |
|
927 | | -// Start a workflow instance |
928 | | -const instance = await agent.startWorkflow('data-pipeline-v1', input, { |
929 | | - context: { source: 'scheduled' }, |
930 | | - roleAssignments: { analyst: 'gmi-123', reviewer: 'gmi-456' }, |
931 | | -}); |
| 969 | +See [`docs/UNIFIED_ORCHESTRATION.md`](docs/UNIFIED_ORCHESTRATION.md), [`docs/AGENT_GRAPH.md`](docs/AGENT_GRAPH.md), [`docs/WORKFLOW_DSL.md`](docs/WORKFLOW_DSL.md), [`docs/MISSION_API.md`](docs/MISSION_API.md), [`docs/CHECKPOINTING.md`](docs/CHECKPOINTING.md). |
| 970 | + |
| 971 | +#### Legacy WorkflowEngine |
932 | 972 |
|
933 | | -// Monitor progress |
| 973 | +The original `WorkflowEngine` (`src/core/workflows/`) continues to work for existing consumers. The new orchestration layer is opt-in and runs alongside it. |
| 974 | + |
| 975 | +```typescript |
| 976 | +const definitions = agent.listWorkflowDefinitions(); |
| 977 | +const instance = await agent.startWorkflow('data-pipeline-v1', input); |
934 | 978 | const status = await agent.getWorkflow(instance.workflowId); |
935 | 979 | ``` |
936 | 980 |
|
|
0 commit comments