feat: harden agent verification and runtime contracts
Introduce two-gate checker settlement, explicit graph visibility and checkpoints, structured LLM reliability, centralized action specifications, and corresponding tests and design documentation.
This commit is contained in:
1 parent
ddfa420945
commit
cbe8f4f0c6
106 files changed
+11542
-4445
No files matched your search
+10
-82
@@ -16,10 +16,8 @@ from typing import Any
|
||||
|
||||
from langchain_core.messages import ToolMessage
|
||||
from langchain_core.tools.base import BaseTool
|
||||
from langgraph.types import Command
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from artemis.constants import VALIDATOR_MESSAGES_KEY
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.data_engine.trace import trace_langchain_tool
|
||||
from artemis.drivers.base import BaseDeviceDriver
|
||||
@@ -155,27 +153,13 @@ class SaveNoteTool(ArtemisTool):
|
||||
agent_outcome = f"Failed to save note {k}.md: {e}"
|
||||
status = "error"
|
||||
|
||||
if st and callable(getattr(st, "asanitize_update", None)):
|
||||
tool_message = ToolMessage(
|
||||
if st is not None:
|
||||
return ToolMessage(
|
||||
tool_call_id=tcid,
|
||||
content=agent_outcome,
|
||||
status=status,
|
||||
)
|
||||
|
||||
current_agent = "operator"
|
||||
if hasattr(st, "current_agent") and st.current_agent:
|
||||
current_agent = st.current_agent
|
||||
|
||||
return Command(
|
||||
update=await st.asanitize_update(
|
||||
ctx=ctx,
|
||||
update={
|
||||
VALIDATOR_MESSAGES_KEY: [tool_message],
|
||||
},
|
||||
agent=current_agent,
|
||||
),
|
||||
)
|
||||
|
||||
return agent_outcome
|
||||
|
||||
|
||||
@@ -249,27 +233,13 @@ class AppendNoteTool(ArtemisTool):
|
||||
agent_outcome = f"Failed to append note {k}.md: {e}"
|
||||
status = "error"
|
||||
|
||||
if st and callable(getattr(st, "asanitize_update", None)):
|
||||
tool_message = ToolMessage(
|
||||
if st is not None:
|
||||
return ToolMessage(
|
||||
tool_call_id=tcid,
|
||||
content=agent_outcome,
|
||||
status=status,
|
||||
)
|
||||
|
||||
current_agent = "operator"
|
||||
if hasattr(st, "current_agent") and st.current_agent:
|
||||
current_agent = st.current_agent
|
||||
|
||||
return Command(
|
||||
update=await st.asanitize_update(
|
||||
ctx=ctx,
|
||||
update={
|
||||
VALIDATOR_MESSAGES_KEY: [tool_message],
|
||||
},
|
||||
agent=current_agent,
|
||||
),
|
||||
)
|
||||
|
||||
return agent_outcome
|
||||
|
||||
|
||||
@@ -348,27 +318,13 @@ class UpdateNoteTool(ArtemisTool):
|
||||
agent_outcome = f"Failed to update note '{k}': {e}"
|
||||
status = "error"
|
||||
|
||||
if st and callable(getattr(st, "asanitize_update", None)):
|
||||
tool_message = ToolMessage(
|
||||
if st is not None:
|
||||
return ToolMessage(
|
||||
tool_call_id=tcid,
|
||||
content=agent_outcome,
|
||||
status=status,
|
||||
)
|
||||
|
||||
current_agent = "operator"
|
||||
if hasattr(st, "current_agent") and st.current_agent:
|
||||
current_agent = st.current_agent
|
||||
|
||||
return Command(
|
||||
update=await st.asanitize_update(
|
||||
ctx=ctx,
|
||||
update={
|
||||
VALIDATOR_MESSAGES_KEY: [tool_message],
|
||||
},
|
||||
agent=current_agent,
|
||||
),
|
||||
)
|
||||
|
||||
return agent_outcome
|
||||
|
||||
|
||||
@@ -447,27 +403,13 @@ class ReadNoteTool(ArtemisTool):
|
||||
agent_outcome = f"Failed to read note '{k}': {e}"
|
||||
status = "error"
|
||||
|
||||
if st and callable(getattr(st, "asanitize_update", None)):
|
||||
tool_message = ToolMessage(
|
||||
if st is not None:
|
||||
return ToolMessage(
|
||||
tool_call_id=tcid,
|
||||
content=agent_outcome,
|
||||
status=status,
|
||||
)
|
||||
|
||||
current_agent = "operator"
|
||||
if hasattr(st, "current_agent") and st.current_agent:
|
||||
current_agent = st.current_agent
|
||||
|
||||
return Command(
|
||||
update=await st.asanitize_update(
|
||||
ctx=ctx,
|
||||
update={
|
||||
VALIDATOR_MESSAGES_KEY: [tool_message],
|
||||
},
|
||||
agent=current_agent,
|
||||
),
|
||||
)
|
||||
|
||||
return agent_outcome
|
||||
|
||||
|
||||
@@ -523,27 +465,13 @@ class ListNotesTool(ArtemisTool):
|
||||
agent_outcome = f"Failed to list notes: {e}"
|
||||
status = "error"
|
||||
|
||||
if st and callable(getattr(st, "asanitize_update", None)):
|
||||
tool_message = ToolMessage(
|
||||
if st is not None:
|
||||
return ToolMessage(
|
||||
tool_call_id=tcid,
|
||||
content=agent_outcome,
|
||||
status=status,
|
||||
)
|
||||
|
||||
current_agent = "operator"
|
||||
if hasattr(st, "current_agent") and st.current_agent:
|
||||
current_agent = st.current_agent
|
||||
|
||||
return Command(
|
||||
update=await st.asanitize_update(
|
||||
ctx=ctx,
|
||||
update={
|
||||
VALIDATOR_MESSAGES_KEY: [tool_message],
|
||||
},
|
||||
agent=current_agent,
|
||||
),
|
||||
)
|
||||
|
||||
return agent_outcome
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user