DeepAgents Integration — GOAP as Tool or Subagent#

LangGOAP’s planning loop can be embedded inside a larger agent architecture in two ways:

  1. create_goap_tool — wraps a GoapGraph as a LangChain StructuredTool. The calling agent invokes it via the standard tool-calling flow.

  2. create_goap_subagent — returns a CompiledSubAgent-compatible dict whose runnable accepts {messages: [HumanMessage(...)]} and returns {messages: [AIMessage(...)]} — the DeepAgents subagent protocol.

Both use GoalInterpreter under the hood to convert a natural-language request into a GoalSpec before running the planner.

Domain — Content Analysis Pipeline#

Four LLM-powered actions form a sequential pipeline:

Action

What the LLM does

extract_topics

Extract 3-5 key topics from a document

analyze_sentiment

Analyze sentiment and tone

generate_summary

Write an executive summary

write_recommendations

Produce actionable recommendations

GOAP replaces the orchestration — the LLM calls inside each action are real.

Setup#

from dotenv import load_dotenv

load_dotenv()

from langchain_openai import ChatOpenAI

from langgoap import GoapGraph, GoalSpec, successful_action_names
from langgoap.integrations.deepagents import (
    create_goap_tool,
    create_goap_subagent,
    format_goap_result,
)
from tutorial_examples.deepagents_integration import (
    content_analysis_actions,
    content_analysis_goal,
)
from tutorial_examples.data.deepagents_instance import SAMPLE_DOCUMENT

llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
actions = content_analysis_actions(llm)
goal = content_analysis_goal()

print(f"Actions: {[a.name for a in actions]}")
print(f"Goal:    {dict(goal.conditions)}")
print(f"Document preview: {SAMPLE_DOCUMENT[:120]}...")
Actions: ['extract_topics', 'analyze_sentiment', 'generate_summary', 'write_recommendations']
Goal:    {'has_recommendations': True}
Document preview: The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that pre...

Direct GOAP Execution#

Before wrapping as a tool, run the pipeline directly to see what the actions produce.

from IPython.display import Image, display

graph = GoapGraph(actions=actions)
display(Image(graph.compile().get_graph().draw_mermaid_png()))
../../_images/d203e373178a0dc06fff2c111d0586811c8dcb2466c9a8c1d741df7bb3c2bb7d.png
result = graph.invoke(
    goal=goal,
    world_state={"has_document": True, "document": SAMPLE_DOCUMENT},
)

print(f"Status: {result['status']}")
print(f"Actions: {successful_action_names(result)}")
print()
ws = result["world_state"]
print("=== Topics ===")
for topic in ws.get("topics", []):
    print(f"  - {topic}")
print()
print("=== Sentiment ===")
print(ws.get("sentiment", ""))
print()
print("=== Summary ===")
print(ws.get("summary", ""))
print()
print("=== Recommendations ===")
print(ws.get("recommendations", ""))
Status: goal_achieved
Actions: ['extract_topics', 'analyze_sentiment', 'generate_summary', 'write_recommendations']

=== Topics ===
  - Adoption of cloud-native architectures and migration to microservices
  - Operational complexity and challenges in observability and configuration management
  - Security concerns related to container images and supply-chain attacks
  - Improvements in developer experience through self-service portals and GitOps workflows
  - Future trends in AI-assisted operations (AIOps) and FinOps practices

=== Sentiment ===
The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.

=== Summary ===
The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image vulnerabilities and supply-chain attacks. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges like high cognitive load and debugging latency persist. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.

=== Recommendations ===
1. Implement a robust observability framework that integrates monitoring, logging, and tracing tools to enhance visibility into microservices and reduce operational complexity. This should include automated alerts and dashboards to help teams quickly identify and resolve issues.

2. Establish a comprehensive security strategy for container images that includes regular vulnerability scanning, automated image signing, and a supply-chain security policy to mitigate risks associated with container vulnerabilities and attacks.

3. Invest in self-service portals and GitOps workflows to empower developers, streamline deployment processes, and reduce cognitive load. This can include providing templates and best practices for common tasks to enhance developer productivity and reduce debugging latency.

4. Explore and adopt AIOps solutions to leverage AI for predictive analytics and automated incident response, while also integrating FinOps practices to ensure that cloud spending aligns with business objectives and optimizes resource allocation.

create_goap_tool — Wrap as a LangChain Tool#

create_goap_tool returns a StructuredTool with a single request parameter. The tool:

  1. Passes the request through GoalInterpreter to get a GoalSpec.

  2. Runs GoapGraph.invoke_nl with the interpreted goal.

  3. Returns a formatted string via format_goap_result.

Any agent that supports LangChain tools can call this.

tool = create_goap_tool(
    actions,
    llm=llm,
    name="content_analyzer",
    description="Analyze a document: extract topics, sentiment, summary, and recommendations.",
    world_state={"has_document": True, "document": SAMPLE_DOCUMENT},
)

print(f"Tool name:        {tool.name}")
print(f"Tool description: {tool.description}")
print(f"Tool type:        {type(tool).__name__}")
Tool name:        content_analyzer
Tool description: Analyze a document: extract topics, sentiment, summary, and recommendations.
Tool type:        StructuredTool
tool_result = tool.invoke({"request": "Analyze the document and provide recommendations"})

print(tool_result)
GOAP Result: goal_achieved

Executed actions:
  - ActionResult(action_name='extract_topics', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, error=None)
  - ActionResult(action_name='analyze_sentiment', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, error=None)
  - ActionResult(action_name='generate_summary', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image scanning and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges remain, particularly in debugging and managing cognitive load. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.'}, error=None)
  - ActionResult(action_name='write_recommendations', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image scanning and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges remain, particularly in debugging and managing cognitive load. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image scanning and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges remain, particularly in debugging and managing cognitive load. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.', 'has_recommendations': True, 'recommendations': '1. Implement a comprehensive observability strategy that includes centralized logging, monitoring, and tracing tools to address operational complexities and enhance visibility across microservices architectures.\n\n2. Establish a robust security framework for container image scanning and supply-chain management, incorporating automated tools to regularly assess vulnerabilities and ensure compliance with security best practices.\n\n3. Develop and promote self-service portals and GitOps workflows to empower developers, streamline deployment processes, and reduce cognitive load, thereby improving overall developer experience and productivity.\n\n4. Invest in AI-assisted operations (AIOps) tools to automate routine tasks, enhance incident response, and optimize resource allocation, while also integrating FinOps practices to ensure cloud spending aligns with business objectives and value delivery.'}, error=None)

Final world state:
  document: The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.

Security teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.

Developer experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.

Looking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.

  has_document: True
  has_recommendations: True
  has_sentiment: True
  has_summary: True
  has_topics: True
  recommendations: 1. Implement a comprehensive observability strategy that includes centralized logging, monitoring, and tracing tools to address operational complexities and enhance visibility across microservices architectures.

2. Establish a robust security framework for container image scanning and supply-chain management, incorporating automated tools to regularly assess vulnerabilities and ensure compliance with security best practices.

3. Develop and promote self-service portals and GitOps workflows to empower developers, streamline deployment processes, and reduce cognitive load, thereby improving overall developer experience and productivity.

4. Invest in AI-assisted operations (AIOps) tools to automate routine tasks, enhance incident response, and optimize resource allocation, while also integrating FinOps practices to ensure cloud spending aligns with business objectives and value delivery.
  sentiment: The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.
  summary: The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image scanning and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges remain, particularly in debugging and managing cognitive load. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.
  topics: ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container image scanning and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']

format_goap_result — Pretty-Print Results#

format_goap_result converts a raw GoapState dict into a human-readable report showing status, executed actions, and final world state.

# Format the direct execution result from earlier
formatted = format_goap_result(dict(result))
print(formatted)
GOAP Result: goal_achieved

Executed actions:
  - ActionResult(action_name='extract_topics', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, error=None)
  - ActionResult(action_name='analyze_sentiment', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, error=None)
  - ActionResult(action_name='generate_summary', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image vulnerabilities and supply-chain attacks. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges like high cognitive load and debugging latency persist. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.'}, error=None)
  - ActionResult(action_name='write_recommendations', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image vulnerabilities and supply-chain attacks. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges like high cognitive load and debugging latency persist. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image vulnerabilities and supply-chain attacks. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges like high cognitive load and debugging latency persist. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.', 'has_recommendations': True, 'recommendations': '1. Implement a robust observability framework that integrates monitoring, logging, and tracing tools to enhance visibility into microservices and reduce operational complexity. This should include automated alerts and dashboards to help teams quickly identify and resolve issues.\n\n2. Establish a comprehensive security strategy for container images that includes regular vulnerability scanning, automated image signing, and a supply-chain security policy to mitigate risks associated with container vulnerabilities and attacks.\n\n3. Invest in self-service portals and GitOps workflows to empower developers, streamline deployment processes, and reduce cognitive load. This can include providing templates and best practices for common tasks to enhance developer productivity and reduce debugging latency.\n\n4. Explore and adopt AIOps solutions to leverage AI for predictive analytics and automated incident response, while also integrating FinOps practices to ensure that cloud spending aligns with business objectives and optimizes resource allocation.'}, error=None)

Final world state:
  document: The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.

Security teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.

Developer experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.

Looking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.

  has_document: True
  has_recommendations: True
  has_sentiment: True
  has_summary: True
  has_topics: True
  recommendations: 1. Implement a robust observability framework that integrates monitoring, logging, and tracing tools to enhance visibility into microservices and reduce operational complexity. This should include automated alerts and dashboards to help teams quickly identify and resolve issues.

2. Establish a comprehensive security strategy for container images that includes regular vulnerability scanning, automated image signing, and a supply-chain security policy to mitigate risks associated with container vulnerabilities and attacks.

3. Invest in self-service portals and GitOps workflows to empower developers, streamline deployment processes, and reduce cognitive load. This can include providing templates and best practices for common tasks to enhance developer productivity and reduce debugging latency.

4. Explore and adopt AIOps solutions to leverage AI for predictive analytics and automated incident response, while also integrating FinOps practices to ensure that cloud spending aligns with business objectives and optimizes resource allocation.
  sentiment: The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.
  summary: The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside mixed sentiments from security teams regarding container image vulnerabilities and supply-chain attacks. While improvements such as self-service portals and GitOps workflows have streamlined development processes, challenges like high cognitive load and debugging latency persist. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic outlook on the future of cloud-native technologies.
  topics: ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']

create_goap_subagent — Messages-Protocol Subagent#

create_goap_subagent returns a dict with name, description, and runnable keys — matching the CompiledSubAgent protocol. The runnable is a compiled StateGraph that:

  1. Extracts the task from the last HumanMessage.

  2. Runs GoapGraph.invoke_nl.

  3. Returns an AIMessage with the formatted result.

This allows GOAP to be embedded in any multi-agent system that communicates via message passing.

from langchain_core.messages import HumanMessage

subagent = create_goap_subagent(
    actions,
    llm=llm,
    name="content_analyzer",
    description="Analyzes documents using GOAP planning.",
    world_state={"has_document": True, "document": SAMPLE_DOCUMENT},
)

print(f"Subagent name:        {subagent['name']}")
print(f"Subagent description: {subagent['description']}")
print(f"Runnable type:        {type(subagent['runnable']).__name__}")
Subagent name:        content_analyzer
Subagent description: Analyzes documents using GOAP planning.
Runnable type:        CompiledStateGraph
subagent_result = subagent["runnable"].invoke(
    {"messages": [HumanMessage(content="Analyze the document and provide recommendations")]}
)

final_message = subagent_result["messages"][-1]
print(f"Message type: {type(final_message).__name__}")
print()
print(final_message.content)
Message type: AIMessage

GOAP Result: goal_achieved

Executed actions:
  - ActionResult(action_name='extract_topics', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, error=None)
  - ActionResult(action_name='analyze_sentiment', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, error=None)
  - ActionResult(action_name='generate_summary', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside ongoing security concerns related to container images and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have emerged, the cognitive load on developers remains significant. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic sentiment about the future of cloud-native technologies.'}, error=None)
  - ActionResult(action_name='write_recommendations', success=True, state_before={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside ongoing security concerns related to container images and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have emerged, the cognitive load on developers remains significant. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic sentiment about the future of cloud-native technologies.'}, state_after={'has_document': True, 'document': 'The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.\n\nSecurity teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.\n\nDeveloper experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.\n\nLooking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.\n', 'has_topics': True, 'topics': ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices'], 'has_sentiment': True, 'sentiment': 'The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.', 'has_summary': True, 'summary': 'The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside ongoing security concerns related to container images and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have emerged, the cognitive load on developers remains significant. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic sentiment about the future of cloud-native technologies.', 'has_recommendations': True, 'recommendations': '1. Implement a robust observability framework that integrates monitoring, logging, and tracing tools to simplify operational complexity and enhance visibility into microservices performance and health.\n\n2. Establish a comprehensive security strategy for container images that includes regular vulnerability scanning, automated compliance checks, and supply-chain risk assessments to mitigate potential security threats.\n\n3. Develop and promote self-service portals and GitOps workflows that empower developers to manage their own deployments and configurations, thereby reducing cognitive load and improving overall developer experience.\n\n4. Invest in AI-assisted operations (AIOps) tools to automate routine operational tasks and enhance decision-making processes, while also adopting FinOps practices to ensure cloud spending aligns with business objectives and maximizes value.'}, error=None)

Final world state:
  document: The adoption of cloud-native architectures has accelerated dramatically over the past two years.  Organizations that previously relied on monolithic deployments are migrating to microservices orchestrated by Kubernetes, benefiting from improved scalability and fault isolation.  However, the transition introduces operational complexity: observability stacks must cover distributed traces, service meshes add latency overhead, and configuration drift across hundreds of services becomes a real risk.

Security teams report mixed feelings.  Container image scanning and runtime policies have matured, yet supply-chain attacks targeting base images and third-party dependencies remain a top concern.  Zero-trust networking principles are gaining traction, but retrofitting them into brownfield environments is expensive and disruptive.

Developer experience is improving.  Platform engineering teams now offer self-service portals backed by internal developer platforms (IDPs) that abstract away infrastructure provisioning.  GitOps workflows—where the desired state of every environment is declared in version control—have reduced deployment failures and shortened mean-time-to-recovery.  Nonetheless, cognitive load on individual developers remains high, and many teams still struggle with debugging latency issues that span multiple services.

Looking ahead, industry analysts predict that AI-assisted operations (AIOps) will play a larger role in anomaly detection and automated remediation.  FinOps practices are also maturing, helping organizations correlate cloud spend with business value rather than treating infrastructure costs as an undifferentiated overhead.

  has_document: True
  has_recommendations: True
  has_sentiment: True
  has_summary: True
  has_topics: True
  recommendations: 1. Implement a robust observability framework that integrates monitoring, logging, and tracing tools to simplify operational complexity and enhance visibility into microservices performance and health.

2. Establish a comprehensive security strategy for container images that includes regular vulnerability scanning, automated compliance checks, and supply-chain risk assessments to mitigate potential security threats.

3. Develop and promote self-service portals and GitOps workflows that empower developers to manage their own deployments and configurations, thereby reducing cognitive load and improving overall developer experience.

4. Invest in AI-assisted operations (AIOps) tools to automate routine operational tasks and enhance decision-making processes, while also adopting FinOps practices to ensure cloud spending aligns with business objectives and maximizes value.
  sentiment: The overall sentiment of the document is cautiously optimistic. It highlights the rapid adoption of cloud-native architectures and the benefits they bring, such as improved scalability and developer experience, while also acknowledging the challenges and complexities that come with this transition. The tone is balanced, recognizing both the advancements in technology and the ongoing concerns, particularly around security and operational difficulties.
  summary: The document outlines the rapid adoption of cloud-native architectures, with organizations transitioning from monolithic deployments to microservices managed by Kubernetes, resulting in enhanced scalability and developer experience. However, this shift introduces operational complexities, particularly in observability and configuration management, alongside ongoing security concerns related to container images and supply-chain vulnerabilities. While improvements such as self-service portals and GitOps workflows have emerged, the cognitive load on developers remains significant. Looking forward, the document anticipates a growing role for AI-assisted operations (AIOps) and the maturation of FinOps practices to better align cloud spending with business value, reflecting a cautiously optimistic sentiment about the future of cloud-native technologies.
  topics: ['Adoption of cloud-native architectures and migration to microservices', 'Operational complexity and challenges in observability and configuration management', 'Security concerns related to container images and supply-chain attacks', 'Improvements in developer experience through self-service portals and GitOps workflows', 'Future trends in AI-assisted operations (AIOps) and FinOps practices']

Tool vs. Subagent — When to Use Which#

create_goap_tool

create_goap_subagent

Protocol

BaseTool — string in, string out

Messages — HumanMessage in, AIMessage out

Use case

Tool-calling agents (ReAct, OpenAI function calling)

Multi-agent systems (supervisor, swarm)

Return type

str

dict["messages"]

Async

.ainvoke()

.ainvoke()

Both share the same underlying GoapGraph and GoalInterpreter machinery — the difference is only the input/output protocol.

Summary#

  • create_goap_tool wraps GOAP as a StructuredTool — any tool-calling agent can invoke it with a natural-language request.

  • create_goap_subagent wraps GOAP as a messages-protocol subagent — compatible with DeepAgents and similar multi-agent frameworks.

  • format_goap_result renders execution results as a human-readable report.

  • All four content-analysis actions use real LLM calls — GOAP handles the orchestration, not the intelligence.

Every scenario here is verified by tests/integration/test_deepagents_integration.py.