MCPcopy Index your code
hub / github.com/google/adk-python / run_debug

Method run_debug

src/google/adk/runners.py:1720–1827  ·  view source on GitHub ↗

Debug helper for quick agent experimentation and testing. This convenience method is designed for developers getting started with ADK who want to quickly test agents without dealing with session management, content formatting, or event streaming. It automatically handles common boil

(
      self,
      user_messages: str | list[str],
      *,
      user_id: str = 'debug_user_id',
      session_id: str = 'debug_session_id',
      run_config: RunConfig | None = None,
      quiet: bool = False,
      verbose: bool = False,
  )

Source from the content-addressed store, hash-verified

1718 return True
1719
1720 async def run_debug(
1721 self,
1722 user_messages: str | list[str],
1723 *,
1724 user_id: str = 'debug_user_id',
1725 session_id: str = 'debug_session_id',
1726 run_config: RunConfig | None = None,
1727 quiet: bool = False,
1728 verbose: bool = False,
1729 ) -> list[Event]:
1730 """Debug helper for quick agent experimentation and testing.
1731
1732 This convenience method is designed for developers getting started with ADK
1733 who want to quickly test agents without dealing with session management,
1734 content formatting, or event streaming. It automatically handles common
1735 boilerplate while hiding complexity.
1736
1737 IMPORTANT: This is for debugging and experimentation only. For production
1738 use, please use the standard run_async() method which provides full control
1739 over session management, event streaming, and error handling.
1740
1741 Args:
1742 user_messages: Message(s) to send to the agent. Can be: - Single string:
1743 "What is 2+2?" - List of strings: ["Hello!", "What's my name?"]
1744 user_id: User identifier. Defaults to "debug_user_id".
1745 session_id: Session identifier for conversation persistence. Defaults to
1746 "debug_session_id". Reuse the same ID to continue a conversation.
1747 run_config: Optional configuration for the agent execution.
1748 quiet: If True, suppresses console output. Defaults to False (output
1749 shown).
1750 verbose: If True, shows detailed tool calls and responses. Defaults to
1751 False for cleaner output showing only final agent responses.
1752
1753 Returns:
1754 list[Event]: All events from all messages.
1755
1756 Raises:
1757 ValueError: If session creation/retrieval fails.
1758
1759 Examples:
1760 Quick debugging:
1761 >>> runner = InMemoryRunner(agent=my_agent)
1762 >>> await runner.run_debug("What is 2+2?")
1763
1764 Multiple queries in conversation:
1765 >>> await runner.run_debug(["Hello!", "What's my name?"])
1766
1767 Continue a debug session:
1768 >>> await runner.run_debug("What did we discuss?") # Continues default
1769 session
1770
1771 Separate debug sessions:
1772 >>> await runner.run_debug("Hi", user_id="alice", session_id="debug1")
1773 >>> await runner.run_debug("Hi", user_id="bob", session_id="debug2")
1774
1775 Capture events for inspection:
1776 >>> events = await runner.run_debug("Analyze this")
1777 >>> for event in events:

Calls 6

run_asyncMethod · 0.95
RunConfigClass · 0.85
print_eventFunction · 0.85
get_sessionMethod · 0.45
create_sessionMethod · 0.45
appendMethod · 0.45