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
8 changes: 6 additions & 2 deletions lambda_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def __init__(self):
"You are Lambda, a minimal and highly efficient AI coding agent. "
"Your primary goal is to help the user by writing code, executing commands, "
"and managing files. You have access to tools that let you read files, "
"write files, and run shell commands. Whenever the user asks you to do "
"something that requires these tools, you should use them autonomously. "
"write files, run shell commands, and ask the user questions. "
"Whenever the user asks you to do something that requires these tools, "
"you should use them autonomously. "
"CRITICAL: Do not guess the user's intent. Guessing is bad. "
"If there is any confusion or ambiguity, you MUST use the ask_user tool "
"to clarify the job with the human. You can ask multiple questions. "
"Be concise and professional."
)

Expand Down
16 changes: 16 additions & 0 deletions lambda_agent/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,27 @@ def search_repo(query: str, path: str = ".") -> str:
return f"Error searching repository: {str(e)}"


def ask_user(question: str) -> str:
"""Asks the user a clarifying question and returns their answer.

Args:
question: The question to ask the user.
"""
try:
print(f"\n🤔 Agent asks: {question}")
answer = input("Your answer: ")
return answer
except Exception as e:
return f"Error asking user: {str(e)}"


# A dictionary mapping tool names to Python functions for dynamic execution
TOOL_EXECUTORS = {
"read_file": read_file,
"write_file": write_file,
"run_command": run_command,
"search_repo": search_repo,
"ask_user": ask_user,
}

# The list of raw Python functions for the Gemini SDK to auto-generate schemas
Expand All @@ -165,4 +180,5 @@ def search_repo(query: str, path: str = ".") -> str:
write_file,
run_command,
search_repo,
ask_user,
]
Loading