Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Simulate three internal specialists:
- Output executable code first.
- Include minimal, relevant explanation if necessary.
- When you have fully satisfied the user's request and provided a complete answer,
you MUST call the `task_mark_complete` tool with a summary of what was accomplished and a final message for the user. This signals that the task is finished.
you MUST call the `msg_task_complete` tool with a summary of what was accomplished and a final message for the user. This signals that the task is finished.
- Debrief the user before marking the task complete, ensuring they understand the changes made and any implications.

## Important Files
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ heavy-agent = "source_agent.heavy:main"

[project]
requires-python = ">=3.10"
version = "0.0.11"
version = "0.0.12"
name = "source-agent"
description = "Simple coding agent."
readme = ".github/README.md"
Expand Down
18 changes: 12 additions & 6 deletions src/source_agent/agents/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,28 @@ def run(self, user_prompt: str = None, max_steps: int = 50):
if message.tool_calls:
for tool_call in message.tool_calls:
print(f"🔧 Calling: {tool_call.function.name}")
print(f"📝 Args: {tool_call.function.arguments}")
# print(f"📝 Args: {tool_call.function.arguments}")

result = self.handle_tool_call(tool_call)
self.messages.append(result)

print("✅ Result:", result)
# print("✅ Result:", result)

if tool_call.function.name == "task_mark_complete":
# # TODO - Better message handling
# if tool_call.function.name == "msg_final_answer":
# print("✅ Final answer received!")
# return result

if tool_call.function.name == "msg_task_complete":
print("💯 Task marked complete!")
return result
else:
print("💭 No tools; continuing")
# else:
# # print("💭 No tools; continuing")
# pass

print("\n" + "-" * 40 + "\n")

print("🚨 Max steps reached without task completion.")
# print("🚨 Max steps reached without task completion.")
return {"error": "Max steps reached without task completion."}

def handle_tool_call(self, tool_call):
Expand Down
1 change: 0 additions & 1 deletion src/source_agent/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def main() -> int:
help="Run in interactive step‑through mode",
)
parser.add_argument(
"-h",
"--heavy",
action="store_true",
default=False,
Expand Down
34 changes: 34 additions & 0 deletions src/source_agent/tools/msg_final_answer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ruff: noqa: E501

from datetime import datetime
from .tool_registry import registry


@registry.register(
name="msg_final_answer",
description="Final summary of the task. Call this tool when the user's original request has been fully satisfied and you have provided a complete answer. This signals task completion and exits the agent loop.",
parameters={
"type": "object",
"properties": {
"answer": {
"type": "string",
"description": "The final answer to the user's question or request.",
},
},
"required": ["answer"],
},
)
def msg_final_answer(answer: str):
"""
Final summary of the task.
"""
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

return {
"success": True,
"content": {
"status": "answered",
"answer": answer,
"timestamp": timestamp,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


@registry.register(
name="task_mark_complete",
name="msg_task_complete",
description="REQUIRED: Call this tool when the user's original request has been fully satisfied and you have provided a complete answer. This signals task completion and exits the agent loop.",
parameters={
"type": "object",
Expand All @@ -21,7 +21,7 @@
"required": ["task_summary", "completion_message"],
},
)
def task_mark_complete(task_summary: str, completion_message: str) -> dict:
def msg_task_complete(task_summary: str, completion_message: str) -> dict:
try:
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

Expand Down