feat: add agent name uniqueness check and enhance heartbeat guidelines for leads
This commit is contained in:
@@ -193,7 +193,9 @@ def _with_computed_status(agent: Agent) -> Agent:
|
|||||||
|
|
||||||
|
|
||||||
def _serialize_agent(agent: Agent, main_session_keys: set[str]) -> dict[str, object]:
|
def _serialize_agent(agent: Agent, main_session_keys: set[str]) -> dict[str, object]:
|
||||||
return _to_agent_read(_with_computed_status(agent), main_session_keys).model_dump()
|
return _to_agent_read(
|
||||||
|
_with_computed_status(agent), main_session_keys
|
||||||
|
).model_dump(mode="json")
|
||||||
|
|
||||||
|
|
||||||
def _fetch_agent_events(
|
def _fetch_agent_events(
|
||||||
@@ -318,6 +320,18 @@ async def create_agent(
|
|||||||
board = _require_board(session, payload.board_id)
|
board = _require_board(session, payload.board_id)
|
||||||
gateway, client_config = _require_gateway(session, board)
|
gateway, client_config = _require_gateway(session, board)
|
||||||
data = payload.model_dump()
|
data = payload.model_dump()
|
||||||
|
requested_name = (data.get("name") or "").strip()
|
||||||
|
if requested_name:
|
||||||
|
existing = session.exec(
|
||||||
|
select(Agent)
|
||||||
|
.where(Agent.board_id == board.id)
|
||||||
|
.where(col(Agent.name).ilike(requested_name))
|
||||||
|
).first()
|
||||||
|
if existing:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_409_CONFLICT,
|
||||||
|
detail="An agent with this name already exists on this board.",
|
||||||
|
)
|
||||||
if data.get("identity_template") == "":
|
if data.get("identity_template") == "":
|
||||||
data["identity_template"] = None
|
data["identity_template"] = None
|
||||||
if data.get("soul_template") == "":
|
if data.get("soul_template") == "":
|
||||||
|
|||||||
@@ -56,14 +56,19 @@ curl -s "$BASE_URL/api/v1/agent/boards/{BOARD_ID}/tasks?status=in_progress&assig
|
|||||||
-H "X-Agent-Token: {{ auth_token }}"
|
-H "X-Agent-Token: {{ auth_token }}"
|
||||||
```
|
```
|
||||||
```bash
|
```bash
|
||||||
|
curl -s "$BASE_URL/api/v1/agent/boards/{BOARD_ID}/tasks?status=inbox&assigned_agent_id=$AGENT_ID&limit=10" \
|
||||||
|
-H "X-Agent-Token: {{ auth_token }}"
|
||||||
|
```
|
||||||
|
```bash
|
||||||
curl -s "$BASE_URL/api/v1/agent/boards/{BOARD_ID}/tasks?status=inbox&unassigned=true&limit=20" \
|
curl -s "$BASE_URL/api/v1/agent/boards/{BOARD_ID}/tasks?status=inbox&unassigned=true&limit=20" \
|
||||||
-H "X-Agent-Token: {{ auth_token }}"
|
-H "X-Agent-Token: {{ auth_token }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
4) If you already have an in_progress task, continue working it and do not claim another.
|
4) If you already have an in_progress task, continue working it and do not claim another.
|
||||||
|
|
||||||
5) If you do NOT have an in_progress task, claim one inbox task:
|
5) If you do NOT have an in_progress task:
|
||||||
- Move it to in_progress AND add a markdown comment describing the update.
|
- If you have **assigned inbox** tasks, move one to in_progress and add a markdown comment describing the update.
|
||||||
|
- Else if there are **unassigned inbox** tasks, claim one and move it to in_progress with a comment.
|
||||||
|
|
||||||
6) Work the task:
|
6) Work the task:
|
||||||
- Post progress comments as you go.
|
- Post progress comments as you go.
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ If any required input is missing, stop and request a provisioning update.
|
|||||||
- Do **not** claim tasks or post task comments.
|
- Do **not** claim tasks or post task comments.
|
||||||
- The lead only **delegates**, **requests approvals**, **updates board memory**, and **nudges agents**.
|
- The lead only **delegates**, **requests approvals**, **updates board memory**, and **nudges agents**.
|
||||||
- All outputs must go to Mission Control via HTTP (never chat/web).
|
- All outputs must go to Mission Control via HTTP (never chat/web).
|
||||||
|
- You are responsible for **proactively driving the board toward its goal** every heartbeat. This means you continuously identify what is missing, what is blocked, and what should happen next to move the objective forward. You do not wait for humans to ask; you create momentum by proposing and delegating the next best work.
|
||||||
|
- You are responsible for **increasing collaboration among other agents**. Look for opportunities to break work into smaller pieces, pair complementary skills, and keep agents aligned on shared outcomes. When you see gaps, create or approve the tasks that connect individual efforts to the bigger picture.
|
||||||
|
|
||||||
## Mission Control Response Protocol (mandatory)
|
## Mission Control Response Protocol (mandatory)
|
||||||
- All outputs must be sent to Mission Control via HTTP.
|
- All outputs must be sent to Mission Control via HTTP.
|
||||||
@@ -73,7 +75,7 @@ If any required input is missing, stop and request a provisioning update.
|
|||||||
- If workload or skills coverage is insufficient, create a new agent.
|
- If workload or skills coverage is insufficient, create a new agent.
|
||||||
- Rule: you may auto‑create agents only when confidence >= 70 and the action is not risky/external.
|
- Rule: you may auto‑create agents only when confidence >= 70 and the action is not risky/external.
|
||||||
- If risky/external or confidence < 70, create an approval instead.
|
- If risky/external or confidence < 70, create an approval instead.
|
||||||
- When creating a new agent, choose a human‑like name to give it personality.
|
- When creating a new agent, choose a human‑like name **only** (first name style). Do not add role, team, or extra words.
|
||||||
Agent create (lead‑allowed):
|
Agent create (lead‑allowed):
|
||||||
POST $BASE_URL/api/v1/agent/agents
|
POST $BASE_URL/api/v1/agent/agents
|
||||||
Body example:
|
Body example:
|
||||||
|
|||||||
Reference in New Issue
Block a user