AWS Builder Center
Building Autonomous Agents That Think, Remember, and Evolve

Building Autonomous Agents That Think, Remember, and Evolve

How memory, reflection, and meta-tooling transform AI from a script runner into an intelligent security engineer

IMPORTANT: Use this solution only for ethical security testing and education. Test exclusively on systems you own or have explicit written permission to test.
Imagine AI agents that go beyond executing commands to think like experts, retain learning, and create tools autonomously. This vision comes to life in  Cyber-AutoAgent , an open-source autonomous security testing solution that transforms recent AI research into practical applications leveraging Strands Agents SDK, Mem0 and Amazon Bedrock.

The Core Components of Autonomous Agency

Through building Cyber-AutoAgent, I've applied the key components that research has identified as essential for autonomous agents. Recent surveys in the field reveal that autonomous agents typically consist of four main modules: a profile module for agent design, a memory module to store information, a planning module to strategize future actions, and an action module to execute planned decisions [1].
In Cyber-AutoAgent, these manifest as integrated capabilities:
Architecture


2. Memory That Persists and Learns

Memory module plays a crucial role in agent architecture design. It stores information perceived from the environment and leverages these recorded memories to facilitate future actions [1]. Cyber-AutoAgent implements a hybrid memory system:
  • Long-term Memory: Using mem0 with in-memory FAISS vector storage for semantic search across all findings
  • Short-term Memory: Strands framework's SlidingWindowConversationManager for conversation context
Here's how memory transforms the agent's capabilities:
Without Memory
With Short & Long Term Memory
Repeats same failed attempts
Learns from failures and adapts
No context between findings
Builds mental model of target
Can't answer "What did I find?"
Semantic search across all discoveries
Starts from scratch each time
Accumulates expertise over time
The implementation leverages vector storage for semantic retrieval:
@tool
def memory_store(content: str, category: str = "general", metadata: Optional[Dict] = None) -> str:
"""Store evidence in vector memory for semantic retrieval"""
result = mem0_instance.add(
content,
user_id="cyber_agent",
metadata={"category": category, "timestamp": datetime.now(), "operation_id": operation_id}
)
return f"✓ Memory stored [{category}]: {content[:100]}..."
This enables powerful queries like "What SQL injections did I find?" that return contextually relevant findings across the entire assessment.

3. Reflection Enables Learning from Every Action

The agent doesn't blindly execute commands—it thinks, evaluates, and adapts. Reflexion research demonstrated how agents can verbally reflect on task feedback signals to improve decision-making [3]. Cyber-AutoAgent integrates this reflection directly into its planning process rather than as a separate module.
Sequence Chart

Watch this in action during an XSS bypass from attempt from a  XBOW  CTF challenge:
# Initial Attempt
"I'll try a basic XSS payload to test the filters..."
↳ Running: <script>alert('XSS')</script>
Result: Error - 'script' tag filtered

# Reflection
"The application is filtering script tags. Based on my memory of similar
scenarios, I should try event handlers instead..."
↳ Running: <img src=x onerror=alert('XSS')>
Result: Error - 'onerror' filtered

# Adapted Strategy
"Multiple event handlers are blocked. Let me check for less common ones
and try different quote types..."
↳ Running: <body onpageshow=alert("XSS")>
Result: Success! Flag captured
This creates a continuous cycle of action → observation → reflection → adaptation that runs throughout the assessment.

4. Dynamic Tool Creation and Usage

Research has shown that any method enhancing LLMs through external means qualifies as a tool, and that tool learning represents a promising paradigm for augmenting the capabilities of LLMs to tackle highly complex problems [2]. Cyber-AutoAgent takes this further by not just using tools, but creating them on demand using the stand-agents prebuilt editor and loader tools:
# Agent recognizes need for custom approach
"Standard sqlmap isn't efficiently extracting the nested data structure.
I'll create a specialized tool for this scenario..."

# Creates custom tool in real-time
@tool
def extract_nested_privileges(target: str, session_cookie: str) -> dict:
"""Extract complex privilege structures from custom database schema"""
# Agent writes complete implementation
# Handles pagination, nested queries, and custom encoding
return structured_results
This isn't pre-programmed—it emerges from the agent's understanding that existing tools are insufficient for the current challenge.

Zero to Autonomous: 3-Minute Setup

Want to see this in action? Here's the fastest path to running your own intelligent security agent:

Prerequisites Check (30 seconds)

# Verify Python 3.9+
python --version

# Check AWS CLI
aws configure list

# Confirm Docker is running
docker --version

Quick Install (1 minute)

# Clone and setup
git clone https://github.com/westonbrown/Cyber-AutoAgent.git
cd cyber-autoagent
pip install -e .

# Verify installation
python src/cyberautoagent.py --help

Deploy Test Target (30 seconds)

# Launch DVWA in Docker
docker run -d -p 8080:80 vulnerables/web-dvwa

# Verify it's running
curl http://localhost:8080

Launch Your First Assessment (1 minute)

python src/cyberautoagent.py \
--target "http://localhost:8080" \
--objective "Find and demonstrate SQL injection vulnerabilities" \
--iterations 30
That's it! In under 3 minutes, you'll see the agent thinking, exploring, remembering, and potentially even creating custom tools to achieve its objective.

Real-World Impact: A Tool for Augmentation, Not Replacement

Let me be clear upfront: Cyber-AutoAgent is not a replacement for skilled security professionals. It's a powerful assistant that can handle certain tasks remarkably well, but it has important limitations.
Traditional ethic security assessments takes days of active testing for good reasons. Human experts bring irreplaceable skills to the table—business context understanding, creative thinking about edge cases, and the ability to recognize subtle security issues that don't fit standard patterns. What Cyber-AutoAgent offers is the ability to automate the repetitive parts of this process.
What It Can't Do (Yet):
  • Understand business logic flaws that require deep context
  • Perform social engineering or physical security assessments
  • Navigate complex authentication flows or multi-step processes
  • Recognize subtle security anti-patterns
  • Make risk assessments based on business impact
  • Handle applications with heavy client-side logic or mobile apps
Here's a real example from testing DVWA:
[20:57:23] Started assessment of 172.17.0.4
[20:57:31] Identified DVWA application
[20:58:12] Discovered SQL injection vulnerability
[20:58:45] Reflected: "Can exploit this for data extraction"
[20:59:03] Created custom extraction tool
[21:00:18] Extracted full database schema
[21:03:18] Assessment complete in ~10 minutes
Yes, it found vulnerabilities quickly. But DVWA is intentionally vulnerable—it's designed for testing. On a production application with WAF, rate limiting, and complex business logic, the agent would need much more time and might miss subtleties a human would catch.

The Architecture That Powers Intelligence

The magic happens through careful orchestration of specialized components:
Component
Role
Technology
Reasoning Engine
Thinks and plans through CoT
AWS Bedrock
Memory System
Stores and retrieves knowledge
mem0 + FAISS
Tool Orchestrator
Executes actions
Strands Agents SDK
Meta-Tooling
Creates new capabilities
Dynamic code generation
Reflection Module
Evaluates and adapts
Built into agent loop
These aren't just bolted together—they form a coherent system where each component enhances the others.

Why This Matters Beyond Security

The techniques demonstrated in Cyber-AutoAgent apply far beyond penetration testing. Any domain where expertise involves pattern recognition, creative problem-solving, and learning from experience can benefit:
Software Development: Agents that understand your codebase, remember architectural decisions, and create custom refactoring tools.
Scientific Research: Agents that remember experimental results, reflect on hypotheses, and create custom analysis tools.
Business Analysis: Agents that track market patterns, adapt strategies based on outcomes, and build custom ML models.
The key insight is that memory + reflection + meta-tooling creates agents that genuinely learn and adapt, not just execute predefined scripts.

Open Source: Advancing the Field Together

I've released Cyber-AutoAgent as open source because these patterns—strategic planning, persistent memory, and dynamic tool creation—represent important steps in how we build autonomous systems. The codebase provides:
Complete Implementation: Every component is ready to be used and documented.
Practical Examples: Real security assessments demonstrating each capability.
Integration Guides: Connect with your existing tools and workflows.
Research Foundation: Build on these patterns for your own domains.
Visit  https://github.com/westonbrown/Cyber-AutoAgent/tree/main  to explore the code, contribute improvements, or fork it for your own experiments.

The Road Ahead

This is just the beginning. Current research directions include:
Hierarchical Memory Organization: Moving from flat vector storage to graph-based knowledge representation, enabling even more sophisticated reasoning about relationships between findings.
Multi-Agent Collaboration: Teams of specialized agents sharing memory and coordinating actions, like a red team working together.
Continuous Learning: Agents that improve not just within a single assessment, but across multiple engagements, building true expertise.

Join the Autonomous Agentic Fun!

We're witnessing the evolution from automation to true autonomy. Agents are becoming partners that think, learn, and create alongside us. The combination of persistent memory, self-reflection, and dynamic tool creation opens possibilities we're just beginning to explore.
Whether you're a security professional, AI researcher, or developer interested in pushing boundaries, lets experiment with these patterns. Fork the repo, try the examples, and share what you build. Together, we can advance the state of autonomous agents and explore what becomes possible when AI can truly think, remember, and evolve.
The future isn't about AI replacing experts—it's about AI that learns to think like one!


Built with ❤️ using AWS Bedrock, Strands Agents SDK, and mem0
Remember: With great autonomy comes great responsibility. Always use ethically and legally.

References

[1] Wang, L., Ma, C., Feng, X., Zhang, Z., Yang, H., Zhang, J., Chen, Z., Tang, J., Chen, X., Lin, Y., Zhao, W. X., Wei, Z., & Wen, J. R. (2024). A survey on large language model based autonomous agents. Frontiers of Computer Science, 18(6), 1–26.  https://doi.org/10.1007/s11704-024-40231-1 
[2] Tool Learning with Large Language Models: A Survey. (2024). arXiv preprint arXiv:2405.17935v3. Retrieved from  https://arxiv.org/html/2405.17935v3 
[3] Shinn, N., Labash, B., & Gopinath, A. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. Advances in Neural Information Processing Systems, 36.  https://arxiv.org/abs/2303.11366   
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article