{
  "name": "agent_context_testing",
  "title": "智能体上下文测试",
  "description": "测试智能体上下文的隔离性、切换和归档，确保不同项目上下文互不干扰",
  "group": "agent",
  "version": "1.0.0",
  "input_schema": {
    "type": "object",
    "properties": {
      "task": {
        "type": "string",
        "description": "需要执行的任务描述"
      }
    },
    "required": ["task"]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "content": {
        "type": "string",
        "description": "执行结果"
      }
    }
  },
  "steps": [
    {
      "id": "check_input",
      "description": "校验任务描述非空",
      "operator": "validator",
      "handler": "required",
      "params": {
        "field": "task",
        "value": "{{ $input.task }}"
      }
    },
    {
      "id": "generate",
      "description": "按上下文测试流程生成执行结果",
      "operator": "executor",
      "handler": "llm",
      "on_error": {
        "retry": 2,
        "retry_delay": 500
      },
      "params": {
        "system_prompt": "{{ $meta.system_prompt }}",
        "user_prompt": "{{ $input.task }}\n\n请按流程执行：创建独立会话初始化上下文、维护上下文信息、保存当前上下文后进行切换、确保不同上下文之间的隔离性、项目结束后归档清理上下文。"
      }
    },
    {
      "id": "validate",
      "description": "校验生成内容非空",
      "operator": "validator",
      "handler": "required",
      "params": {
        "field": "content",
        "value": "{{ $steps.generate.content }}"
      }
    },
    {
      "id": "check_valid",
      "description": "校验失败则中止",
      "operator": "dispatcher",
      "handler": "condition",
      "params": {
        "source": "{{ $steps.validate.valid }}",
        "operator": "truthy",
        "else_jump": "end"
      }
    }
  ]
}
