Show HN: Agent in 9 Lines Python

(gist.github.com)

17 points | by tosh a day ago ago

8 comments

  • gabrielsroka a day ago

    Nice.

    Do you have an ungolfed version? I was going to ask my LLM to make one.

    • tosh a day ago
      • gabrielsroka a day ago

        ty. a little easier to read.

        i'd move the headers out of the loop (u can prolly just hard-code it), and move context_usage to inside the if (and maybe hard-code it, too)

        • tosh a day ago

          oh right, good point @ move outside of the loop (or move directly into the Request), ty!

          • gabrielsroka 20 hours ago

            Ty, i commented on both gists.

            • tosh 14 hours ago

              ty for looking into it, i like your http.client take (still stdlib, keeps connection open)

  • JSR_FDED a day ago

    Super cool for how compact yet still readable it is. Shouldn’t there be a tool description passed to the LLM though?

    • tosh a day ago

      Great question!

      I had a tool description earlier but 'sh' as tool name seems to be sufficient, the agent behaviour was the same.

      There might be performance gains if a description is added though, or worth trying different ways of telling the agent about what is available in the environment.

      That said, the newer models are fairly good at driving a harness to explore the environment.