设定目标
目标挂在部门或岗位上,在一个周期内追求,拆成可度量的关键结果,周期末评分一次。变量:BASE 是 API 地址;写入需要组织所有者或管理员,或目标所在部门的负责人。
在控制台里设定
- 打开控制台 → 组织 → 目标(
/org/objectives)。还没有周期时,先点「新建周期」。 - 点「设定目标」,选它挂在哪个部门或岗位、哪个周期,写标题,点「设定目标」。
- 在目标上点「设定关键结果」,拆成可度量的关键结果。
开周期
整个组织只有一份日历,由年、半年、季度三级周期组成。周期的状态由日期推出,不用你设:start_on 之前是 planning,start_on 到 end_on(含)是 active,之后是 grading,只有你手动关闭后才是 closed。日期是 YYYY-MM-DD,今天按 UTC 日期算。
curl -X POST "$BASE/workforce/v1/periods" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "2026 Q4", "cadence": "quarter", "start_on": "2026-10-01", "end_on": "2026-12-31"}'期望:HTTP 201,返回 prd_ 开头的 ID 和 status。同一级别的周期不能重叠,否则返回 400 PERIOD_OVERLAP。用 parent_id 把半年或季度放进完整包含它的更粗周期(年、半年、季度)里。
设目标
目标属于一个部门或一个岗位;公司级目标挂在根部门上。
curl -X POST "$BASE/workforce/v1/objectives" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"period_id": "prd_123", "scope": {"kind": "department", "id": "dept_123"}, "title": "Cut first-response time", "description": "Median first response under 2 hours."}'scope.kind 是 department 或 position;title 1 到 200 字符,description 最多 2000 字符。期望:HTTP 201,status 为 active,parents 为空,result、score 为 null。
目标只能向上对齐:用 PUT /workforce/v1/objectives/{id}/parents 一次性替换它贡献的上级目标,每个上级必须挂在本部门或上级部门,weight 大于 0 且不超过 1,同一个上级只能出现一次。
curl -X PUT "$BASE/workforce/v1/objectives/$OBJECTIVE_ID/parents" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"parents": [{"objective_id": "obj_456", "weight": 1}]}'期望:HTTP 200,parents 里是你给的项。上级挂在别处返回 400 SCOPE_MISMATCH,形成环返回 400 ALIGNMENT_CYCLE。
关键结果
关键结果由一个岗位负责,由当前任职者推进进度。数字型关键结果带 metric:initial(起点)、target(目标值,不能等于起点)、可选的 current,以及单位 unit,取 none、percent、currency_micro_usd、count、seconds 之一。省略 metric 就是二元关键结果,进度看 done。commitment 是 committed(承诺)或 aspirational(挑战)。
curl -X POST "$BASE/workforce/v1/key_results" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"objective_id": "obj_123", "title": "Median first response under 2 hours", "owner_position_id": "pos_123", "commitment": "committed", "metric": {"initial": 6, "target": 2, "unit": "none"}}'期望:HTTP 201,metric.current 等于 initial,health 为 on_track,done 为 false,score 为 null。
进度没有打卡记录,直接改关键结果:
curl -X PATCH "$BASE/workforce/v1/key_results/$KEY_RESULT_ID" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"metric": {"initial": 6, "current": 3.5, "target": 2, "unit": "none"}, "health": "at_risk"}'health 取 on_track、at_risk、off_track。数字型的进度是 (current − initial) ÷ (target − initial),限制在 0 到 1 之间;二元型 done 为 true 时是 1,否则是 0。done 只能用于没有 metric 的关键结果,否则返回 400 INVALID_PARAMS。metric 整体替换,改进度时把 initial、target、unit 一并带上。
谁能改:管理员和目标所在部门(或上级部门)的负责人可以改任何字段;担任负责岗位的成员只能改 metric.current、health 和 done,改别的返回 403 PERMISSION_DENIED;担任负责岗位的智能体不能写,由管理员或负责人代它更新。既不是管理者也不是任职成员返回 403 NOT_POSITION_HOLDER。
评分
评分一次,同时关闭目标:
curl -X POST "$BASE/workforce/v1/objectives/$OBJECTIVE_ID/grade" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"result": "partial", "score": 0.6, "note": "Median fell from 6h to 3.5h.", "key_result_scores": [{"id": "kr_123", "score": 0.6}]}'result取achieved、partial、missed、dropped;score在 0 到 1 之间,超出返回 400SCORE_OUT_OF_RANGE。- 目标下有
committed关键结果、结果又不是achieved时,必须写note,否则返回 400GRADE_NOTE_REQUIRED;note最多 2000 字符。 key_result_scores里列出的关键结果记下得分,没列的不记分。
期望:HTTP 200,status 为 closed,result、score、grade_note 有值;列出的关键结果的 score 有值。已关闭的目标不能再评分、改写或改关键结果,一律返回 409 PERIOD_CLOSED。
周期评完分后关闭它:POST /workforce/v1/periods/{id}/close,之后这个周期里不能再设目标或关键结果。关闭不会替你评分,也不可恢复。