deepagents icon indicating copy to clipboard operation
deepagents copied to clipboard

feat: add option to start cli in interactive mode with arg as prompt

Open tode-rl opened this issue 1 month ago • 4 comments

Add ability to pass a prompt as a command-line argument that executes on entering interactive mode.

Usage: deepagents "create hello.py" deepagents --agent mybot "review the last commit" deepagents --auto-approve "add a new unit test"

Changes:

  • parse_args(): Detect if first positional arg is a prompt vs subcommand
  • simple_cli(): Accept and execute initial_prompt parameter
  • main(): Pass initial_prompt through
  • cli_main(): Extract prompt from args and pass to main()
  • ui.py: Update help text with [PROMPT] usage and example
  • README.md: Document command-line prompt execution feature

tode-rl avatar Nov 04 '25 16:11 tode-rl

looks good with added flags, but instead of entering interactive mode it should exit after it's done

vtrivedy avatar Nov 04 '25 19:11 vtrivedy

looks good with added flags, but instead of entering interactive mode it should exit after it's done

I think it can do that but I believe it should have a separate flag for this behaviour. My thought is that a larger task would benefit from having the context in the cli and the ability to do follow-ups

for a usecase like deepagents --auto-approve "Write a new unit test case" some flag like --script could exit from the loop on completion? (I've seen exec, and -p used in other clis to toggle this behaviour)

tode-rl avatar Nov 04 '25 20:11 tode-rl

@vtrivedy Any thoughts on https://github.com/langchain-ai/deepagents/pull/284#issuecomment-3487811596? I can do in a follow-up if you're ok with adding another arg in the cli. I don't mind the cli exiting after complete but would like some control over it

tode-rl avatar Nov 06 '25 14:11 tode-rl

agree on separate flag, we're leaning towards having the "exec" style only right now (shell exits) to bootstrap the run. if you want to make a new PR we can review it today

vtrivedy avatar Nov 06 '25 15:11 vtrivedy