| title | Examples Guide |
|---|---|
| description | Comprehensive examples showcasing Ax framework capabilities |
This page lists every runnable example in src/examples/, grouped by theme and linked to GitHub for easy browsing.
- chat.ts - Basic chat example with function calling and conversation flow.
- extract.ts - Extract structured fields from free-form text.
- extract-test.ts - Small extraction test case with typed outputs.
- summarize.ts - Summarize a list of updates into multiple output formats.
- simple-classify.ts - Lightweight text classification with labeled classes.
- marketing.ts - Generate marketing-style copy from prompts.
- embed.ts - Create embeddings and inspect the returned vectors.
- prime.ts - Simple reasoning task around prime number generation.
- fibonacci.ts - Use an AI call plus runtime execution to compute Fibonacci numbers.
- structured_output.ts - Structured output with validation constraints and nested objects.
- fluent-signature-example.ts - Build signatures with the fluent
f()API. - debug_schema.ts - Inspect generated JSON schema from constrained signatures.
- use-examples.ts - Attach few-shot examples to a generator.
- sample-count.ts - Generate multiple samples from a single prompt program.
- result-picker.ts - Pick the best result from multiple generated samples.
- function.ts - Basic function-calling setup with Ax.
- signature-tool-calling.ts - Combine agent signatures with tool execution.
- function-result-formatter.ts - Customize how tool results are formatted back to the model.
- function-result-picker.ts - Choose among multiple tool results before returning an answer.
- stop-function.ts - Stop a tool-driven workflow with a terminating function.
- food-search.ts - Tool-driven restaurant search and selection flow.
- react.ts - ReAct-style prompting with tools and intermediate reasoning.
- smart-home.ts - Multi-tool smart home assistant simulation.
- streaming.ts - Stream structured results while validating output fields.
- streaming-asserts.ts - Enforce line-by-line validation during streaming.
- asserts.ts - Add output assertions and retry behavior.
- abort-simple.ts - Cancel a request with
AbortController. - abort-patterns.ts - Compare several request cancellation patterns and edge cases.
- agent.ts - Basic multi-agent composition with a shared runtime.
- agent-migration-example.ts - Migrate to the newer
agent()factory API. - customer-support.ts - Parse support emails into structured support fields.
- meetings.ts - Meeting-oriented assistant workflow example.
- show-thoughts.ts - Surface provider reasoning or thought traces when supported.
- self-improving-agent.ts - Persist traces and checkpoints for a self-improving workflow.
- codingWithMemory.ts - Agentic coding flow backed by an MCP memory server.
- rlm.ts - Core RLM example for long-context analysis with runtime tools.
- rlm-test.ts - Compact RLM test agent with namespaced tools.
- rlm-discovery.ts - Runtime discovery of tools and permissions in an agent.
- rlm-long-task.ts - Context-policy example for long-running tasks and checkpoint summaries.
- rlm-truncated-context.ts - Keep only the most relevant tail of a long conversation in prompt context.
- rlm-shared-fields.ts - Propagate shared fields automatically into subagents.
- rlm-adaptive-replay.ts - Collapse older turns into checkpoint summaries during replay.
- rlm-live-runtime-state.ts - Inspect the structured live runtime-state block in prompts.
- rlm-clarification-resume.ts - Pause for clarification, save state, and resume later.
- rlm-agent-controlled.ts - Agent-controlled workflow termination and clarification handling.
- rlm-agent-optimize.ts - Optimize an RLM agent and persist the resulting artifact.
- ax-flow.ts - End-to-end AxFlow example with nodes, descriptions, and execution.
- ax-flow-enhanced-demo.ts - Explore richer AxFlow composition patterns.
- ax-flow-async-map.ts - Use async mapping steps inside a flow.
- ax-flow-auto-parallel.ts - Demonstrate AxFlow automatic parallelization.
- ax-flow-map-merge-test.ts - Test mapping and merge behavior in flows.
- ax-flow-signature-inference.ts - Infer flow signatures from connected nodes.
- ax-flow-to-function.ts - Convert flow logic into function-like execution patterns.
- fluent-flow-example.ts - Build flows with the fluent builder API.
- flow-type-inference-demo.ts - Show state evolution and type inference across flow steps.
- flow-type-safe-output.ts - Produce strongly typed final outputs from a flow.
- flow-logging-simple.ts - Attach a simple color logger to a flow.
- flow-verbose-logging.ts - Enable more verbose runtime logging for flow execution.
- teacher-student-optimization.ts - MiPRO teacher-student optimization with a small model target.
- mipro-python-optimizer.ts - Run MiPRO with the Python optimizer backend.
- simple-optimizer-test.ts - Minimal optimizer setup for a classification task.
- optimizer-metrics.ts - Track and inspect optimizer metrics over time.
- checkpoint-recovery.ts - Save and restore optimization checkpoints.
- gepa.ts - Introductory GEPA optimization example.
- gepa-flow.ts - Apply GEPA optimization to a flow-based program.
- gepa-train-inference.ts - Train with GEPA and reuse the result for inference.
- gepa-quality-vs-speed-optimization.ts - Multi-objective GEPA example balancing quality and speed.
- ace-train-inference.ts - Train and update an ACE playbook from labeled examples.
- vectordb.ts - Insert text into an in-memory vector DB and query it.
- rag-docs.ts - Build a simple document ingestion and retrieval pipeline.
- advanced-rag.ts - Extend RAG with custom retrieval behavior.
- multi-modal.ts - Basic multimodal prompt with image input.
- multi-modal-abstraction.ts - Higher-level abstractions for multimodal workflows.
- image-arrays-test.ts - Send multiple images in a single request.
- image-arrays-multi-provider-test.ts - Compare multi-image support across providers.
- audio-arrays-test.ts - Send multiple audio clips and inspect the response.
- anthropic-thinking-function.ts - Combine Claude thinking mode with function calls.
- anthropic-thinking-separation.ts - Capture reasoning separately from final output.
- anthropic-web-search.ts - Use Anthropic web search tooling through Ax.
- test-anthropic-cache.ts - Exercise Anthropic prompt caching behavior.
- gemini-context-cache.ts - Reuse cached context with Gemini models.
- gemini-empty-params-function.ts - Call Gemini tools with an empty parameter schema.
- gemini-file-support.ts - Upload files and reference them in Gemini prompts.
- gemini-function-cache.ts - Combine Gemini function calls with caching.
- gemini-google-maps.ts - Connect Gemini with Google Maps tool usage.
- gemini-parallel-test.ts - Try parallel Gemini requests and compare outputs.
- vertex-auth-example.ts - Authenticate against Vertex AI with dynamic Google auth.
- openai-responses.ts - Use the OpenAI Responses API through Ax.
- openai-web-search.ts - Run a web-search-enabled OpenAI example.
- reasoning-o3-example.ts - Reasoning-focused example using OpenAI
o3.
- grok-live-search.ts - Query Grok with live search enabled.
- openrouter.ts - Route requests through OpenRouter.
- mcp-client-memory.ts - Connect to an MCP memory server.
- mcp-client-blender.ts - Drive Blender through an MCP client.
- mcp-client-pipedream.ts - Use Pipedream via MCP transport.
- mcp-client-notion-http-oauth.ts - Connect to Notion MCP over HTTP with OAuth.
- mcp-client-notion-sse-oauth.ts - Connect to Notion MCP over SSE with OAuth.
- balancer.ts - Balance requests across multiple configured services.
- ax-multiservice-router.ts - Route requests between providers with shared model aliases.
- debug-logging.ts - Enable debug logging for model calls and tool steps.
- telemetry.ts - Export traces with OpenTelemetry.
- metrics-export.ts - Export runtime metrics for external monitoring.
- web-chat.html - Browser chat UI using the Ax bundle.
- webllm-chat.html - Browser chat example powered by WebLLM.
- cors-proxy.js - Small CORS proxy helper for browser-based development.
- docker.ts - Run tool-like tasks inside a Docker session.