Twig's AI isn't just a chatbot - it's an agent that can take actions in your development environment. This page explains what that means and how to work with it effectively.
Traditional AI coding assistants work in a request-response pattern:
Twig's agent works differently:
The agent can read files, search code, run commands, and edit multiple files - all in service of completing your request.
The agent can:
Despite its capabilities, the agent doesn't act without oversight:
Think of it as a very capable assistant that checks with you before making important decisions.
Instead of:
fix the bug
Try:
the login form submits twice when the button is clicked quickly.
add debouncing to prevent duplicate submissions.
The agent can read your code, but it can't read your mind:
we use react-query for data fetching throughout the app.
add a mutation for updating user preferences using the same pattern.
For complex tasks, let the agent investigate first:
explore how authentication works in this codebase and
explain the flow before making any changes
If the first attempt isn't quite right, provide feedback:
this is close, but we should also handle the loading state.
update the component to show a spinner while the request is in progress.
Twig's agent is built on Anthropic's Claude Agent SDK, which provides the harness for agentic capabilities:
You can configure which language model the agent uses, giving you flexibility to choose the right model for your needs.