File size: 1,509 Bytes
9d0fd45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Pipeline spec: ``stateful-react-agent``."""

from __future__ import annotations

from frontier_agent.models.pipeline_spec import (
    CompressionConfig,
    ContextPolicy,
    NodeDefinition,
    PipelineSpec,
    TransitionSpec,
)

REACT_SPEC = PipelineSpec(
    pipeline_id="stateful-react-agent",
    name="Stateful ReAct Agent",
    description=(
        "A single stateful ReAct agent in a per-task workspace. A no-tool "
        "assistant response is the final answer."
    ),
    entry_point="react_agent",
    terminal_nodes=["react_agent"],
    nodes=[
        NodeDefinition(
            node_id="react_agent",
            role_id="stateful_react",
            node_function=(
                "workflows.stateful_react_agent.nodes.main_agent.react_agent_node"
            ),
            context_policy=ContextPolicy(
                include_fields=[
                    "original_question", "current_query", "language",
                    "task_id", "metadata",
                ],
            ),
            compression=CompressionConfig(enabled=False),
            output_fields=[
                "final_answer", "final_content", "react_steps", "language",
                "session_turn",
                "answer_status", "answer_sentinel",
                "final_answer_rescued", "final_answer_rescue_mode",
                "final_answer_source", "stopped_by",
            ],
        ),
    ],
    transitions=[
        TransitionSpec(from_phase="react_agent", to_phase="__END__"),
    ],
)