Tutorial: Your First Agent Task

Pro Only

Now you're ready to run your first AI agent task, the first step in building a small Flask web app from scratch. Each tutorial step will add one feature, refactor, or test. By the end you'll have a working app and a feel for what it's like to drive an AI agent from Wing.

You don't need to know anything about Flask to follow along; the agent writes all the code for you!

Submit the First Task

Copy and paste the following into the AI Agent tool, then press Enter:

Initialize this directory for git and ignore the venv and generated files. Then create a bookmarks Flask app.py running on port 5050 with auto-reload, using SQLite at bookmarks.db with bookmarks table (id, url, title, tags, created). Route / should list all bookmarks (empty list if none). Add a unittest under tests to smoke test / returns HTTP 200. Add files to the repo but don't commit yet.

The agent will set up the repository, write the scaffolding, run the test, and report back. This takes a few minutes to complete.

/images/doc/en/intro/ai-agent-first-task-starting.png/images/doc/en/intro/ai-agent-first-task-starting.png

While the task runs you could keep working in other tools - editing unrelated files, browsing code, reading ahead in this Tutorial. Wing tracks the agent's progress in the Tasks and AI Agent tools.

Don't be concerned if you see some errors in the agent's output. Some of those are the agent reacting to restrictions Wing or its own control system place on it. It will adjust and continue with the work in the way that we want it to.

Two Ways to Submit a Task

There are actually two equivalent ways to enter and submit agent requests:

  • The AI Agent tool that you just used is a conversational panel where you can type your requests and press Enter to run them immediately.
  • The Tasks tool is a structured queue with Plan, Execute, Review, and History tabs. This is useful for drafting a series of tasks before queueing them, usually while you are waiting for one or more other agent sessions to complete their work.

Both feed the same agent process and both track tasks through the same Plan -> Execute -> Review -> History lifecycle. Tasks move between these tabs depending on their status. If you entered your task in the AI Agent tool, Wing synthesizes a task in the Tasks tool, initially showing it under the Execute tab, and when the task completes it will transition to the Review tab.

Using the Tasks tool is optional, and it can be disabled. However, it makes it easier to manage the process of planning, executing, and reviewing many tasks in multiple potentially concurrently running agent sessions.