Skip to content

Conversation

@tulga-bytes
Copy link
Contributor

@tulga-bytes tulga-bytes commented Dec 1, 2025

Add comprehensive Python SDK examples and documentation

This PR introduces a complete set of examples demonstrating how to use the Augment Python SDK, making it easier for developers to get started and understand key features.

What's Added

Core Examples

  • basic_usage.py - Fundamental SDK features including typed responses, dataclasses, enums, and session management
  • session_usage.py - Session context manager usage for conversation continuity
  • function_calling_example.py - How to provide Python functions that the agent can call during execution
  • event_listener_demo.py - Comprehensive demonstration of all AgentEventListener events

ACP Client Examples

  • acp_demo.py - Simple demo of AuggieACPClient for persistent sessions
  • acp_example_usage.py - Advanced ACP client usage with event listeners and context managers

Utility Examples

  • list_models.py - List available models
  • list_prs.py - Working with GitHub PRs using the SDK
  • cli_analyzer.py - CLI analysis example
  • mock_client_example.py - Using mock clients for testing
  • success_criteria_example.py - Success criteria patterns
  • demo_session_continuity.py - Session continuity demonstration

Documentation

  • README.md - Comprehensive guide covering all examples, workflow patterns, and templates
  • README_PROMPT_TO_CODE.md - Guide for converting natural language prompts to SDK code
  • example_prompt.txt - Sample prompt for testing prompt-to-SDK conversion

Key Features Demonstrated

  • Typed responses - Get structured data (int, bool, list, dict, dataclasses, enums)
  • Session management - Maintain context across multiple agent calls
  • Function calling - Provide Python functions for the agent to use
  • Event listeners - Monitor agent execution in real-time
  • ACP clients - Persistent sessions with the Augment CLI
  • Workflow patterns - Sequential workflows, conditional logic, iteration, error handling

Developer Impact

This PR significantly improves the developer experience by:

  • Providing ready-to-run examples for common use cases
  • Demonstrating best practices and workflow patterns
  • Including comprehensive documentation with code templates
  • Making it easier to understand and adopt the Python SDK

🤖 This description was generated automatically. Please react with 👍 if it's helpful or 👎 if it needs improvement.

@tulga-bytes tulga-bytes self-assigned this Dec 1, 2025
@tulga-bytes tulga-bytes merged commit d3f5faa into main Dec 1, 2025
2 checks passed
@tulga-bytes tulga-bytes deleted the python-sdk-docs branch December 1, 2025 21:28
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. Found several critical bugs that will cause runtime errors.


🤖 Automated review complete. Please react with 👍 or 👎 on the individual review comments to provide feedback on their usefulness.



def main():
a = Agent(workspace_root=Path.cwd())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Undefined name Agent

The code uses Agent but the import statement imports Auggie. This will cause a NameError at runtime.

# Current code:
a = Agent(workspace_root=Path.cwd())

# Should be:
a = Auggie(workspace_root=Path.cwd())

5. If criteria not met after max rounds, raises AugmentVerificationError
"""

from auggie_sdk import Agent, AugmentVerificationError
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Undefined name Agent

The import statement attempts to import Agent which doesn't exist in auggie_sdk. Based on other examples in this PR, it should be Auggie.

# Current code:
from auggie_sdk import Agent, AugmentVerificationError

# Should be:
from auggie_sdk import Auggie, AugmentVerificationError

def main():
"""Demonstrate success criteria usage."""

agent = Auggie()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Undefined name Agent

This will cause a NameError because Agent was not imported (and doesn't exist). Should use Auggie instead.

# Current code:
agent = Auggie()

# This is actually correct! But the import on line 16 is wrong.

Note: The instantiation is correct, but the import statement on line 16 needs to be fixed.

class SimpleListener(AgentEventListener):
"""Simple listener that prints agent responses."""

def on_agent_message_chunk(self, text: str):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Method name inconsistency

This example uses on_agent_message_chunk() but event_listener_demo.py in the same PR uses on_agent_message() for the AgentEventListener interface. The method names should be consistent across all examples.

Based on event_listener_demo.py lines 34 and 46, it appears the interface supports both:

  • on_agent_message_chunk(text) - for streaming chunks
  • on_agent_message(message) - for complete message

Please verify this is the correct method name for the AgentEventListener interface.

def on_agent_message(self, text: str) -> None:
print(text, end="", flush=True)

def on_tool_call_start(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Method name inconsistency

This example uses on_tool_call_start() but event_listener_demo.py (line 54) uses on_tool_call() for the same interface. The method names should match the actual AgentEventListener interface.

Please verify which is the correct method name and ensure consistency across all examples.

) -> None:
print(f"\n 🔧 Using tool: {title}", flush=True)

def on_tool_call_update(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Method name inconsistency

This example uses on_tool_call_update() but event_listener_demo.py (line 84) uses on_tool_response() for the same interface. The method names should match the actual AgentEventListener interface.

Please verify which is the correct method name and ensure consistency across all examples.

"""Called when the agent sends a message chunk."""
print(f"[AGENT MESSAGE] {text}", end="", flush=True)

def on_tool_call_start(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Method name inconsistency

This example uses on_tool_call_start() but event_listener_demo.py uses on_tool_call(). These examples should use consistent method names that match the actual AgentEventListener interface.

Please verify the correct method name and update all examples to use it consistently.

print(f" Kind: {kind}")
print(f" Status: {status}")

def on_tool_call_update(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: Method name inconsistency

This example uses on_tool_call_update() but event_listener_demo.py uses on_tool_response(). These examples should use consistent method names that match the actual AgentEventListener interface.

Please verify the correct method name and update all examples to use it consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants