Examples#
Every example below is a runnable Jupyter notebook committed to the
repository under examples/.
Flagship screencast#
screencast/research_agent/screencast.ipynb— four-way head-to-head (create_react_agentbaseline vs. hand-wiredStateGraphvs. LangGOAP vs. LangGOAP-under-disruption) with real OpenAI + Tavily costs and Tavily-key revocation as the climax.
LangGraph tutorial refactors#
Official LangGraph tutorials rewritten as GOAP. Each notebook runs the condensed hand-wired original, the GOAP version and the GOAP version under disruption, hermetically, backed by an integration test.
screencast/llm_compiler/llm_compiler_screencast.ipynb— LLMCompiler:$Ndependency references, a hand-written scheduler and a joiner that emitsReplanbecome preconditions,executor="parallel"and the observer’s blacklist-and-replan loop.screencast/email_assistant/email_assistant_screencast.ipynb— executive-ai-assistant: three message-shape routers withValueErrorfall-throughs and four Agent Inbox handlers become triage facts as preconditions,require_human_approval=Trueand a Pydantic form; a denied send is re-planned around, and a new process resumes a paused thread.screencast/weather_alert/weather_alert_screencast.ipynb— GenAI_Agents weather disaster management: a router with an unreachable branch, aninput()approval node and a swallowed SMTP failure become a sensor’s facts as preconditions,require_human_approval=Trueonapprove_alert, anActionQosretry with an SMS fallback, and a stuck handler that relaxes the goal when the operator says no.
Basics#
Short primers — each notebook exercises a single mechanic.
plan_visualization.ipynb— Mermaid, DOT, ASCII, and Gantt renderers over an A* → CSP plan.nl_goal_interpreter.ipynb— Plain-English request →GoalSpecvia anyBaseChatModel.create_goap_agent_quickstart.ipynb— The Layer A one-liner: LangChain tools + goal → compiledStateGraph.termination_policies.ipynb—MaxCostPolicy,MaxActionsPolicy, andFirstOfPolicycomposition.stuck_handlers.ipynb—FunctionalStuckHandlerandMulticastStuckHandlerrecovering planning failures.typed_form_hitl.ipynb— Typed-forminterrupt()with Pydantic validation on resume.action_qos.ipynb— In-executor retry withActionQosand exponential backoff.cli.ipynb— ThelanggoapCLI:plan,actions,explain,visualize,deploy-init.goap_subgraph.ipynb— Embedding aGoapGraphas a node of a largerStateGraphwithadd_goap_subgraph.tracing.ipynb— Observability hooks withLoggingTracer,LangSmithTracer, andMultiTracer.stochastic_gridworld.ipynb—TransitionModelseparating declared effects from sampled dynamics on FrozenLake-4x4.mcts_vs_astar_stochastic.ipynb— When to useMCTSStrategyinstead of A* on stochastic domains.
Tutorials#
Complete end-to-end walkthroughs across three tiers of complexity.
Tier 1 — Primers
directory_handler.ipynb— GOAP basics on a file-system world state.robot_navigation.ipynb— A* primer on a linear graph.hungry_agent.ipynb— Natural-language goal + cost-driven action selection.from_routing_graphs_to_goap.ipynb— Hand-wired LangGraph routing graph rewritten as a GOAP plan that absorbs runtime disruptions.
Tier 2 — Workflows and constraint optimization
cloud_balancing.ipynb— VM bin-packing with thecreate_goap_agentone-liner.vehicle_routing.ipynb— Capacity-constrained routing with CSP temporal scheduling.nurse_rostering.ipynb— Shift assignment withHardSoftScoreand skill matching.project_job_scheduling.ipynb— RCPSP with precedence constraints and makespan minimization.task_assigning.ipynb— Ticket routing with the fluentConstraintBuilder.sql_query_agent.ipynb— Schema-explore → generate → test → refine loop usingeffect_validator.vulnerability_scanner.ipynb— Phased discovery with action blacklisting.cost_bounded_research_agent.ipynb— Token / USD budget enforced viaMaxCostPolicy.personal_shopper_agent.ipynb— Utility-maximizing planning withUtilityStrategyandNirvanaGoal.scheduled_delivery_confirmer.ipynb— Typed-form HITL with Pydantic validation.deepagents_integration.ipynb— Embed aGoapGraphas aStructuredToolor Deep Agents subagent.
Tier 3 — Full-stack showcases
deep_research_agent.ipynb— LLM-heavy research loop withStoreExecutionHistoryand tracing.hierarchical_product_launch.ipynb—MultiGoalsequential decomposition.content_builder_agent.ipynb— Multi-objective CSP with conditional format generation.temporal_match_cellar.ipynb— Durative actions with overlap constraints and parallel scheduling.flexible_job_shop.ipynb— Every v0.1.0 feature in one notebook.supply_chain_disruption_mediator.ipynb— Stuck handlers and goal relaxation under cascading disruption.code_review_agent_mcp_deployment.ipynb—langgoap deploy-initscaffolds alanggraph dev-ready deployment with an/mcpendpoint.