Implement custom logic
Overview
After creating a Warden Agent, you can update it, implementing custom logic.
There are two ways to do it:
- Update the Agent through the CLI, using an AI assistant
- Directly edit the Agent's code
To learn more, see the sections below.
Build with AI
You can edit your Agent through the CLI, in the AI-powered build mode. It supports the following LLM providers:
- OpenAI (default)
- Anthropic
To start building with AI, take these steps:
-
If your Agent is running, stop it with CTRL + C.
-
Navigate to your project's root directory and initiate Warden Code:
warden -
Then enter the build mode:
/build -
If needed, set your LLM provider and model:
/modeltipIf you created an OpenAI Agent and specified a correct API key, no action is required. Otherwise, select and configure one of the supported LLM providers: OpenAI or Anthropic.
-
Prompt the assistant to update the main Agent code or any file in the project.
tipIf you update your Agent's skills, reflect it in the Agent Card.
-
Build your Agent:
/rebuild -
In a separate terminal window, navigate to your project and run the Agent:
npm start -
To verify the update, return to the window where Warden Code is running and chat with the Agent:
/chattipThe Agent URL is resolved automatically from the
AGENT_URLin your.envfile. By default, it's set tohttp://localhost:3000. If needed, you can pass the URL explicitly:/chat http://localhost:3000. -
To exit the chat and the build modes, use this command:
/exit
Edit the code
You can directly edit your Agent's code in src/agent.ts.
To implement custom logic, use the functions exposed by Warden Code.
Next steps
Now you can do the following: