convez.ai
AgenteAutomaçãoAvançado
vAirpower

Agentex Temporal Mission Demo

vAirpower/agentex-temporal-mission-demo

Agent durável que pausa para humanos e sobrevive a restarts

Ver no GitHub
InicialPluginScore · de 0 a 100

Agent durável com humano no loop para monitoramento de mudanças em missões críticas. Combina Agentex (framework de agents da Scale), Temporal (orquestração durável) e Claude via Amazon Bedrock para criar workflows que sobrevivem a crashes e pausam para revisão humana sem perder estado.

Instalação

$npx convez-ai vAirpower/agentex-temporal-mission-demo

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Monitoramento de ativos críticos com aprovação humana
  • Workflows de longa duração que precisam sobreviver a falhas
  • Sistemas de análise que geram dados de treinamento em produção

Veredito

Demonstração técnica sólida de um problema real: como manter estado de agent workflows quando processos morrem. Prova três princípios importantes (dados estruturados > raw data, human-in-the-loop como arquitetura, geração de dados de treinamento em produção). Código compacto e executável, ideal para times que precisam de durabilidade em agentes críticos.

README

A tradução para o português deste README ainda está na fila.

Durable Mission Change Monitoring: a Scale Agentex + Temporal demo

A compact, runnable, technically honest demo of Scale's open source agent framework Agentex applied to a realistic mission operations use case: monitoring a set of mission critical sites for change between two reporting windows, with a human analyst in the loop.

It is built to prove three claims that matter for serious AI systems, and to show the one capability that sets Agentex apart: durable, long running, human in the loop workflows that survive a process crash and resume exactly where they left off.

Measurement is the foundation of trust. This demo keeps the measurable, structured facts at the center and treats human review and the resulting training signal as first class parts of the architecture, not afterthoughts.


The thesis this demo proves

  1. You do not feed raw multimodal data into a language model. A pipeline of specialized models turns raw sensor feeds into structured observations, and only then does an agent reason over those observations. Here we represent that upstream output as a small fixture of structured facts. We never process raw sensor data and we never ask the model to invent an observation.
  2. Human review is part of the architecture, not an exception path. Low confidence findings, or any finding that touches a high mission criticality asset, escalate to a human analyst through a durable gate. High confidence, low criticality findings proceed automatically.
  3. The deployed system produces the next training and evaluation signal. Every adjudication (approve, reject, or correct) is persisted as a labeled record. In production this is the data flywheel that feeds Scale Data Engine and SGP evaluation.

The signature capability: durable human in the loop

The centerpiece is a Temporal workflow that pauses at the human adjudication gate and survives the agent worker being killed and restarted. Most agent frameworks lose all state when the process dies. Agentex builds on Temporal, so the pause lives in the workflow's event history on the Temporal server, not in the worker's memory. Kill the worker, restart it, send the analyst's decision, and the workflow resumes and finishes, provably, on screen, in the Temporal Web UI. See DEMO.md for the exact kill, restart, resume sequence.


Architecture: what is real vs represented

flowchart TB
    subgraph SENSING["SENSING LAYER  (represented in this demo)"]
        direction LR
        feeds["Raw sensor feeds<br/>multi source<br/><i>(not processed here)</i>"]
        models["Specialized models<br/>analysis / scoring<br/><i>(not built here)</i>"]
        feeds --> models
    end

    subgraph FACTS["STRUCTURED FACTS  (the fixture)"]
        direction LR
        obs[("observations<br/>type, confidence,<br/>evidence note")]
        assets[("asset_metadata<br/>site type,<br/>mission criticality")]
    end

    subgraph REASON["REASONING LAYER  (real: Agentex + Temporal + Amazon Bedrock)"]
        direction TB
        triage["1. Triage<br/>summarize change per window"]
        fusion["2. Fusion / impact<br/>join facts to asset criticality"]
        gate{"3. Adjudication gate<br/>low confidence OR<br/>high criticality?"}
        human["Human analyst<br/>approve / reject / correct<br/><b>durable pause</b>"]
        report["4. Evidence backed report<br/>every conclusion cites facts"]
        feedback[("5. Feedback store<br/>labeled training /<br/>evaluation signal")]
        triage --> fusion --> gate
        gate -- "escalate" --> human --> report
        gate -- "auto approve" --> report
        report --> feedback
    end

    models -. "in production" .-> obs
    obs --> triage
    assets --> fusion
    human -. "next training signal" .-> feedback

    classDef represented fill:#f5f5f5,stroke:#bbb,stroke-dasharray:5 5,color:#333;
    classDef real fill:#e7f0ff,stroke:#4a78c2,color:#13315c;
    class SENSING,feeds,models represented;
    class REASON,triage,fusion,gate,human,report,feedback real;

The reasoning layer is real and runnable. The sensing layer is represented by a small SQLite fixture so the demo needs no GPU, no raw sensor data, and no model training. The structured facts are the seam where, in production, an upstream model pipeline would hand off.

Where Scale and AWS sit in production

ConcernThis demo (open source, local)Production
Facts archivelocal SQLite fixtureAmazon S3
Specialized modelsrepresented as factsSageMaker / EKS, GPU
Agent runtimeAgentex ACP + Temporal worker, localAgentex on a managed Temporal, Kubernetes
Reasoning modelAmazon Bedrock (Claude Haiku 4.5)Amazon Bedrock, or air gapped / GovCloud endpoints
Task store, gateway, web UItalk to the ACP server and Temporal directlyScale's hosted Agentex control plane
Labeling + evaluation flywheellocal feedback SQLiteScale Data Engine + SGP
GovernancelocalIAM, KMS, CloudTrail, PrivateLink, audit

Use case

A mission operations team watches a handful of fictional sites across two reporting windows (Window A vs Window B). The operator question:

Which sites show a change in activity, structure, or availability between the two windows, what is the assessed mission impact, and what specific evidence supports each conclusion?

The represented facts cover three explainable change classes, activity_change, structural_change, and availability_change, with a deliberate mix of high and low confidence observations, joined to an asset table that carries mission criticality:

SiteTypeCriticalityOutlook
Site Alphaprimary distribution hubhighescalates (high criticality + low confidence observations)
Site Bravoprimary ground routemedescalates (low confidence availability change)
Site Charliebulk storage facilitylowauto approves (all high confidence)

All site names are fictional codenames. No real organizations or locations are referenced.


Quickstart

Prerequisites

  • Python 3.12, uv, and Docker (Docker Desktop is fine)
  • Amazon Bedrock access with the Anthropic models enabled (see Enabling Bedrock below). Or run fully offline with FAKE_BEDROCK=1 and skip AWS entirely.

1. Install and configure

cd agentex-temporal-mission-demo   # the project root; every command runs from here
uv sync
cp -n .env.example .env            # -n keeps an existing .env; then add AWS creds (or set FAKE_BEDROCK=1)
uv run python scripts/seed_facts.py

2. Start the local stack

docker compose up -d          # Temporal + Postgres; Temporal UI at http://localhost:8233

3. Run the agent

bash scripts/run_local.sh     # starts the ACP server and the Temporal worker

This runs the ACP server (port 8000) and the Temporal worker as two separate processes, so the worker can be killed and restarted on its own for the durability demo. Logs stream to .run/.

The all in one alternative is uv run agentex agents run --manifest manifest.yaml, which starts the same two processes under the Agentex CLI. Use run_local.sh when you want to kill the worker independently on camera.

4. Drive it

# Auto approve path (no human needed):
uv run python scripts/start_assessment.py --site charlie

# Human escalation path:
uv run python scripts/start_assessment.py --site alpha
# ... it pauses at the gate; send the analyst decision (either path works):
uv run python scripts/send_adjudication.py  --task-id <task_id> --decision approve   # native ACP event
uv run python scripts/signal_adjudication.py --task-id <task_id> --decision approve   # raw Temporal signal

Watch the workflow pause and resume in the Temporal Web UI at http://localhost:8233. Final reports are written to data/reports/<task_id>.md.

The full, scripted kill, restart, resume proof lives in DEMO.md and in scripts/e2e_durability.sh.


Human adjudication: two signal paths

The workflow pauses on a real Temporal wait_condition. The analyst's decision reaches it two ways, and both are real Temporal signals you can watch in the UI:

  • Native (Agentex): an SDK event/send to the ACP server becomes the workflow's receive_event signal. This exercises the full, realistic stack.
  • Raw Temporal: a direct submit_adjudication signal to the workflow. The most unambiguous proof of durability, visible directly in the event history.

Either way the workflow records the decision, drafts the report, and persists the labeled feedback.


Reasoning model (Amazon Bedrock)

All reasoning runs through Amazon Bedrock using the Anthropic SDK's Bedrock client. There is no OpenAI dependency and no LiteLLM. The model is configurable:

BEDROCK_MODEL_ID=us.anthropic.claude-haiku-4-5-20251001-v1:0   # default: low cost, high accuracy
# fallback: us.anthropic.claude-3-5-haiku-20241022-v1:0

The numeric confidence that drives escalation comes from the structured observations, not the model. Claude writes the narrative, what changed and why it matters, while the escalation decision is deterministic policy (gate_reasons in project/workflow.py). That keeps the gate trustworthy and the workflow replayable.

Set FAKE_BEDROCK=1 to replace the Claude calls with a deterministic, rule based fallback. The test suite and CI use this, so they cost nothing and need no AWS.

Enabling Amazon Bedrock

Anthropic models on Bedrock require a one time, account level step: open the Bedrock console (region us-east-1), go to Model access, and submit the Anthropic use case details. After it propagates (the console says up to 15 minutes), the default model works. Until then, run with FAKE_BEDROCK=1.

Optional: alternative providers and AWS toggles

  • The facts fixture can be loaded from S3 by setting FACTS_SOURCE=s3 and FACTS_S3_URI=s3://.... It defaults to purely local; the running demo never requires S3.
  • Because Agentex builds on the model agnostic OpenAI Agents SDK, you could host the reasoning on a different provider; this demo deliberately uses Bedrock directly in activities, which is the cleanest path for a Claude on AWS deployment.

Prototype vs production

This repo is honest about its seams.

Open source and runnable here

  • The Agentex ACP server and the Temporal integration (BaseWorkflow, AgentexWorker, activities, signals, queries).
  • Real Temporal durability via a local Temporal server (Docker), watchable in the Temporal Web UI.
  • Amazon Bedrock for reasoning; local SQLite for the represented facts and the feedback store.

Represented, not built

  • The upstream sensing pipeline. We model its output as structured observations. Building the specialized analysis and scoring models is the job of SageMaker / EKS and a real data archive in production.

Scale managed product in a real deployment

  • The hosted Agentex control plane (the task gateway, multi tenant task store, and web UI) that this demo replaces by talking to the ACP server and Temporal directly. That is why AGENTEX_BASE_URL is empty here.
  • Scale Data Engine for turning the feedback records into curated labels, and SGP for evaluation and observability of the deployed agent. The data/feedback.db written by this demo is the local stand in for that flywheel.

Project layout

project/
  acp.py            ACP entrypoint: FastACP.create(type="temporal")
  workflow.py       the durable workflow: pipeline + adjudication gate + signals
  activities.py     reasoning layer: triage, fusion, report drafting, feedback
  bedrock.py        Amazon Bedrock gateway (Claude); FAKE_BEDROCK offline mode
  facts.py          SQLite access (observations + asset metadata + feedback)
  schemas.py        typed data shapes
  run_worker.py     the Temporal worker (the process you kill and restart)
  config.py         environment driven configuration
scripts/
  seed_facts.py         (re)generate the facts fixture
  start_assessment.py   start an assessment via the ACP server
  send_adjudication.py  deliver a decision via the native ACP event path
  signal_adjudication.py deliver a decision via a raw Temporal signal
  workflow_status.py    inspect / wait on a workflow's stage, status, result
  show_facts.py         print a site's represented facts (asset + observations)
  show_feedback.py      print the captured feedback records
  run_acp.sh            run only the ACP server (foreground)
  run_worker.sh         run only the worker (foreground; the process you kill)
  run_local.sh          run the ACP server + worker together (background)
  e2e_durability.sh     the scripted kill / restart / resume proof
tests/
  test_workflow.py  auto approve, escalation + resume, and worker restart while paused
docker-compose.yml  local Temporal + Postgres (UI on 8233)
manifest.yaml       Agentex manifest

Tests

uv run pytest        # offline (FAKE_BEDROCK), no Docker, no AWS

The suite runs entirely in Temporal's in process test environment and covers the auto approve path, the human escalation path (pause then resume on a signal), and the durability claim itself: a workflow paused at the gate while its worker is stopped, then resumed by a brand new worker after the signal arrives.

Credits

Built on scaleapi/scale-agentex-python and Temporal. Reasoning by Anthropic Claude on Amazon Bedrock.

Ver o original no GitHub

Bom para

Relacionados