Interactive Agent Development

Interactive Agent Development: Seamless Transitions Between Script Execution and Dialog Refinement

Creating and Importing Agents

Users can create agents using the timeline editor CLI script. After engaging in a dialogue with an LLM through the timeline editor, users can save this interaction as an agent. Once saved, the agent becomes readily available for use in Python scripts that utilize the underdogcowboy library.

To incorporate an agent into your scripts, use the following import statement:

from underdogcowboy import adm, gitbookdoc

Basic Agent Interaction

With the import in place, we can program our script to communicate with the agent:

# Enable dialogue with the agent via the Agent Dialog Manager (adm)
adm | [gitbookdoc]

# Send a simple message to the agent (the LLM)
response = gitbookdoc >> "Hi my friend, ready for making some documentation?"
print(response)

When executed, this script displays the agent's response in the console or CLI. While it ends after a single interaction, it serves as an excellent starting point for more complex development.

Enhancing Agent Interactions

To take this further, we can transform the script into an interactive experience, allowing for extended dialogues and more dynamic interactions. Here's how we might evolve our script:

  1. Implement a loop to keep the conversation going

  2. Add user input functionality for back-and-forth communication

  3. Include a mechanism to gracefully exit the conversation

This approach enables us to:

  • Explore ideas more thoroughly

  • Test the agent's responses to various inputs

  • Simulate real-world interactions more closely

Activating Interactive Mode

To achieve this enhanced interaction, simply add the following line to your script:

+adm

The +adm command activates the Dialog Manager's interactive mode, which is particularly useful for developing and refining agent interactions.

Key Features of Interactive Mode

  1. Interactive Environment: Pauses normal script execution and opens an environment similar to the timeline editor.

  2. Continued Conversation: Allows extended dialogue with your agent for testing and improvement.

  3. Mode Toggling: Switch between interactive and regular command modes as needed.

  4. Resume Functionality: Use the resume command to return to the normal script flow.

  5. On-the-Fly Refinement: Improve agent responses through dialogue during development.

  6. Dynamic Updates: The agent uses the most recent response from your dialogue when the script resumes.

  7. Iterative Development: Run, pause, interact, improve, and resume for immediate feedback on changes.

Benefits of Interactive Mode

  • Dynamically refine agent behavior while developing your script

  • Lead to more effective and tailored agent responses

  • No need to modify the underlying agent definition for each improvement

  • Easy way to tune agents to your standards with a simple +adm command

By leveraging this interactive mode, you can create more sophisticated AI-driven applications through an iterative process of development and refinement, key to building powerful, user-friendly AI tools with Underdog Cowboy.

Interactive mode while working on your scripts is an easy way to get your agents more tuned to your standards. A simple +adm in your source will pause your script and move into interactive mode.

Sample script during agent development

Last updated