;
+ setAnswers(parsed);
+ } else {
+ setAnswers({});
+ }
+ setIsSubmitted(false);
+ } catch {
+ setAnswers({});
+ setIsSubmitted(false);
+ }
+ lastSessionIdRef.current = sessionId;
+ }, [sessionId]);
+
+ useEffect(() => {
+ if (lastSessionIdRef.current !== sessionId) {
+ return;
+ }
+ const storageKey = getStorageKey(sessionId);
+ if (!storageKey) return;
+
+ const hasAnswers = Object.values(answers).some((v) => v.trim());
+ try {
+ if (hasAnswers) {
+ localStorage.setItem(storageKey, JSON.stringify(answers));
+ } else {
+ localStorage.removeItem(storageKey);
+ }
+ } catch {}
+ }, [answers, sessionId]);
function handleAnswerChange(keyword: string, value: string) {
setAnswers((prev) => ({ ...prev, [keyword]: value }));
}
function handleSubmit() {
- // Check if all questions are answered
const allAnswered = questions.every((q) => answers[q.keyword]?.trim());
if (!allAnswered) {
return;
}
setIsSubmitted(true);
onSubmitAnswers(answers);
+
+ const storageKey = getStorageKey(sessionId);
+ try {
+ if (storageKey) {
+ localStorage.removeItem(storageKey);
+ }
+ } catch {}
}
const allAnswered = questions.every((q) => answers[q.keyword]?.trim());
- // Show submitted state after answers are submitted
- if (isSubmitted) {
+ if (isAnswered || isSubmitted) {
return (
;
- if (response.error) return stripInternalReasoning(String(response.error));
if (response.message)
return stripInternalReasoning(String(response.message));
+ if (response.error) return stripInternalReasoning(String(response.error));
}
return "An error occurred";
}
@@ -363,8 +363,8 @@ export function formatToolResponse(result: unknown, toolName: string): string {
case "error":
const errorMsg =
- (response.error as string) || response.message || "An error occurred";
- return `Error: ${errorMsg}`;
+ (response.message as string) || response.error || "An error occurred";
+ return stripInternalReasoning(String(errorMsg));
case "no_results":
const suggestions = (response.suggestions as string[]) || [];
diff --git a/docs/platform/create-basic-agent.md b/docs/platform/create-basic-agent.md
index 7721fb9b9c..ffe654ba99 100644
--- a/docs/platform/create-basic-agent.md
+++ b/docs/platform/create-basic-agent.md
@@ -4,6 +4,28 @@
This guide walks through creating a simple question-answer AI agent using AutoGPT's visual builder. This is a basic example that can be expanded into more complex agents.
+## **Prerequisites**
+
+### **Cloud-Hosted AutoGPT**
+If you're using the cloud-hosted version at [agpt.co](https://agpt.co), you're ready to go! AI blocks come with **built-in credits** — no API keys required to get started. If you'd prefer to use your own API keys, you can add them via **Profile → Integrations**.
+
+### **Self-Hosted (Docker)**
+If you're running AutoGPT locally with Docker, you'll need to add your own API keys to `autogpt_platform/backend/.env`:
+
+```bash
+# Create or edit backend/.env
+OPENAI_API_KEY=sk-your-key-here
+ANTHROPIC_API_KEY=sk-ant-your-key-here
+# Add other provider keys as needed
+```
+
+After adding keys, restart the services:
+```bash
+docker compose down && docker compose up -d
+```
+
+**Note:** The Calculator example below doesn't require any API credentials — it's a good way to test your setup before adding AI blocks.
+
## **Example Agent: Q&A (with AI)**
A step-by-step guide to creating a simple Q&A agent using input and output blocks.