Agents
Overview
An Agent is the quickest way to get started with Griptape. Agents take in tools and input directly, which the agent uses to add a Prompt Task.
You can access the final output of the Agent by using the output attribute.
Agent Tools
from griptape.structures import Agent
from griptape.tools import CalculatorTool
agent = Agent(input="Calculate the following: {{ args[0] }}", tools=[CalculatorTool()])
agent.run("what's 13^7?")
print("Answer:", agent.output)
[07/23/24 10:53:41] INFO PromptTask 487db777bc014193ba90b061451b69a6
Input: Calculate the following: what's 13^7?
[07/23/24 10:53:42] INFO Subtask 126cefa3ac5347b88495e25af52f3268
Actions: [
{
"tag": "call_ZSCH6vNoycOgtPJH2DL2U9ji",
"name": "CalculatorTool",
"path": "calculate",
"input": {
"values": {
"expression": "13**7"
}
}
}
]
INFO Subtask 126cefa3ac5347b88495e25af52f3268
Response: 62748517
[07/23/24 10:53:43] INFO PromptTask 487db777bc014193ba90b061451b69a6
Output: 62,748,517
Answer: 62,748,517