antigravity library
The Native Dart SDK for Google Antigravity.
Classes
- Agent
- A high-level agent coordinator for the Google Antigravity SDK.
- AgentConfig
- Configuration schema for setting up an Agent in the Google Antigravity SDK.
-
AgentConfigCopyWith<
$R, $In extends AgentConfig, $Out> - AgentConfigMapper
- ArgumentsHook
- AskQuestionEntry
- AskQuestionHook
- Hook that prompts the user to answer questions asked by the agent.
- AskQuestionInteractionSpec
- AskQuestionOption
- Audio
- BinaryDiscovery
- A utility to search for the pre-existing system binary dynamically within the Google Antigravity SDK.
- BuiltinSlashCommandNameMapper
- BuiltinToolsMapper
- CapabilitiesConfig
- General agent capability configuration.
-
CapabilitiesConfigCopyWith<
$R, $In extends CapabilitiesConfig, $Out> - CapabilitiesConfigMapper
- ChatResponse
- Connection
- A live session with an agent backend in the Google Antigravity SDK.
- ConnectionStrategy
- Abstract strategy for establishing a Connection in the Google Antigravity SDK.
- Conversation
- Manages a high-level stateful interaction between a user and an agent in the Google Antigravity SDK.
- CustomSystemInstructions
- Completely replaces system instructions.
-
CustomSystemInstructionsCopyWith<
$R, $In extends CustomSystemInstructions, $Out> - CustomSystemInstructionsMapper
-
DecideHook<
T> - Read-only, blocking hook for policy decisions.
- Document
- FileChange
- A single filesystem change detected by a file-watching trigger.
-
FunctionDecideHook<
T> - Helper class to adapt functions into DecideHooks.
-
FunctionInspectHook<
T> - Helper class to adapt functions into InspectHooks.
-
FunctionTransformHook<
T, R> - Helper class to adapt functions into TransformHooks.
- GeminiAPIEndpoint
- Endpoint for the Gemini Developer API.
-
GeminiAPIEndpointCopyWith<
$R, $In extends GeminiAPIEndpoint, $Out> - GeminiAPIEndpointMapper
- GeminiModelOptions
- Gemini-specific model options.
-
GeminiModelOptionsCopyWith<
$R, $In extends GeminiModelOptions, $Out> - GeminiModelOptionsMapper
- GenerateImageResult
-
Structured result from a
generate_imagetool execution. - HandshakeReader
- Helper class to read handshake payload statefully.
- HarnessDownloader
-
A utility to dynamically download the official precompiled
localharnessbinary from PyPI wheels matching the host CPU architecture and OS. - Hook
- Base interface for all Hooks in the Google Antigravity SDK.
- HookContext
- Base context for hooks to share state within the Google Antigravity SDK.
- HookMapper
- Mapper helper to map Hook objects for serialization.
- HookResult
- HookRunner
- Coordinates registration and dispatch of lifecycle hooks.
- Image
-
InspectHook<
T> - Read-only, non-blocking hook for observability.
- LocalAgentConfig
- Configuration for the local harness backend.
-
LocalAgentConfigCopyWith<
$R, $In extends LocalAgentConfig, $Out> - LocalAgentConfigMapper
- LocalConnection
- Live session connection to the local harness.
- LocalConnectionStrategy
- Strategy for establishing a LocalConnection to a Go-based localharness binary.
- McpBridge
- Facilitates connecting to external Model Context Protocol (MCP) servers and exposes their tools to the Google Antigravity SDK.
- McpServerConfig
- Abstract base for all MCP server configurations.
-
McpServerConfigCopyWith<
$R, $In extends McpServerConfig, $Out> - McpServerConfigMapper
- McpStdioServer
-
McpStdioServerCopyWith<
$R, $In extends McpStdioServer, $Out> - McpStdioServerMapper
- McpStreamableHttpServer
-
McpStreamableHttpServerCopyWith<
$R, $In extends McpStreamableHttpServer, $Out> - McpStreamableHttpServerMapper
- McpTool
- A tool discovered from an MCP server, wrapped in the SDK's Tool interface.
- MediaContent
- ModelEndpoint
- Base class for model endpoint authentication & routing.
-
ModelEndpointCopyWith<
$R, $In extends ModelEndpoint, $Out> - ModelEndpointMapper
- ModelTarget
- Configuration for a single model.
-
ModelTargetCopyWith<
$R, $In extends ModelTarget, $Out> - ModelTargetMapper
- ModelTypeMapper
- OnCompactionHook
- Invoked when a conversation context compaction event occurs.
- OnInteractionHook
- Invoked when the agent needs user interaction/questions answered.
- OnSessionEndHook
- Invoked when the agent session ends.
- OnSessionStartHook
- Invoked when the agent session starts.
- OnToolErrorHook
- Invoked when a tool fails, allowing recovery or transformation of the exception.
- OperationContext
- Context scoped to a single operation (e.g. a tool call) in the Google Antigravity SDK.
- Policy
- A single tool call policy rule in the Google Antigravity SDK.
- PolicyDecideHook
- A security policy decision hook in the Google Antigravity SDK.
- PolicyMapper
- Mapper helper to map Policy objects for serialization.
- PostToolCallHook
- Invoked after a tool call completes successfully.
- PostTurnHook
- Invoked after a conversation turn successfully completes.
- PreToolCallDecideHook
- Invoked before a tool call is executed to decide if it is allowed.
- PreTurnHook
- Invoked before a conversation turn starts.
- QuestionHookResult
- QuestionResponse
- SearchWebResult
-
Structured result from a
search_webtool execution. - SessionContext
- Context scoped to an entire agent session in the Google Antigravity SDK.
- SlashCommand
-
SlashCommandCopyWith<
$R, $In extends SlashCommand, $Out> - SlashCommandMapper
- Spinner
- A lightweight terminal spinner for async processing feedback.
- Step
-
StepCopyWith<
$R, $In extends Step, $Out> - StepMapper
- StepSourceMapper
- StepStatusMapper
- StepTargetMapper
- StepTypeMapper
- StreamChunk
- SubagentCapabilities
- Capabilities configuration for subagents.
-
SubagentCapabilitiesCopyWith<
$R, $In extends SubagentCapabilities, $Out> - SubagentCapabilitiesMapper
- SubagentConfig
- Configuration for a static subagent.
-
SubagentConfigCopyWith<
$R, $In extends SubagentConfig, $Out> - SubagentConfigMapper
- SystemInstructions
- Sealed representation of system instructions.
-
SystemInstructionsCopyWith<
$R, $In extends SystemInstructions, $Out> - SystemInstructionSection
-
SystemInstructionSectionCopyWith<
$R, $In extends SystemInstructionSection, $Out> - SystemInstructionSectionMapper
- SystemInstructionsMapper
- TemplatedSystemInstructions
- Appends sections to default system instructions.
-
TemplatedSystemInstructionsCopyWith<
$R, $In extends TemplatedSystemInstructions, $Out> - TemplatedSystemInstructionsMapper
- Text
- ThinkingLevelMapper
- Thought
- Tool
- Represents a custom tool that can be executed by an agent in the Google Antigravity SDK.
- ToolCall
-
ToolCallCopyWith<
$R, $In extends ToolCall, $Out> - ToolCallMapper
- ToolConfirmationHook
- Hook that prompts the user for confirmation before executing a tool.
- ToolContext
- Conversation-aware context for custom tools.
- ToolMapper
- Mapper helper to map Tool objects for serialization.
- ToolResult
-
ToolResultCopyWith<
$R, $In extends ToolResult, $Out> - ToolResultMapper
- ToolRunner
- Registry and executor for custom tools in the Google Antigravity SDK.
-
TransformHook<
T, R> - Modifying, blocking hook for data transformation.
- TriggerContext
- Execution handle and context provided to every background trigger at startup in the Google Antigravity SDK.
- TriggerMapper
- Mapper helper to map Trigger objects for serialization.
- TriggerRunner
- Manages registration, startup, and shutdown of background triggers in the Google Antigravity SDK.
- TurnContext
- Context scoped to a single interaction turn in the Google Antigravity SDK.
- UnmappedHook
- UsageMetadata
-
UsageMetadataCopyWith<
$R, $In extends UsageMetadata, $Out> - UsageMetadataMapper
- VertexEndpoint
- Endpoint for the Vertex AI backend.
-
VertexEndpointCopyWith<
$R, $In extends VertexEndpoint, $Out> - VertexEndpointMapper
- Video
Enums
- BuiltinSlashCommandName
- BuiltinTools
- Identifiers for common connection-provided builtin tools.
- Decision
- Outcomes that a policy can produce in the Google Antigravity SDK.
- FileChangeKind
- Kind of filesystem change detected by a file-watching trigger.
- ModelType
- Discriminator for model purpose.
- StepSource
- StepStatus
- StepTarget
- StepType
- ThinkingLevel
- Thinking level for Gemini models that support extended thinking.
Mixins
- AgentConfigMappable
- CapabilitiesConfigMappable
- CustomSystemInstructionsMappable
- GeminiAPIEndpointMappable
- GeminiModelOptionsMappable
- LocalAgentConfigMappable
- McpServerConfigMappable
- McpStdioServerMappable
- McpStreamableHttpServerMappable
- ModelEndpointMappable
- ModelTargetMappable
- SlashCommandMappable
- StepMappable
- SubagentCapabilitiesMappable
- SubagentConfigMappable
- SystemInstructionSectionMappable
- SystemInstructionsMappable
- TemplatedSystemInstructionsMappable
- ToolCallMappable
- ToolResultMappable
- UsageMetadataMappable
- VertexEndpointMappable
Extensions
- BuiltinSlashCommandNameMapperExtension on BuiltinSlashCommandName
- BuiltinToolsMapperExtension on BuiltinTools
-
CapabilitiesConfigValueCopy
on ObjectCopyWith<
$R, CapabilitiesConfig, $Out> -
CustomSystemInstructionsValueCopy
on ObjectCopyWith<
$R, CustomSystemInstructions, $Out> -
GeminiAPIEndpointValueCopy
on ObjectCopyWith<
$R, GeminiAPIEndpoint, $Out> -
GeminiModelOptionsValueCopy
on ObjectCopyWith<
$R, GeminiModelOptions, $Out> -
LocalAgentConfigValueCopy
on ObjectCopyWith<
$R, LocalAgentConfig, $Out> -
McpStdioServerValueCopy
on ObjectCopyWith<
$R, McpStdioServer, $Out> -
McpStreamableHttpServerValueCopy
on ObjectCopyWith<
$R, McpStreamableHttpServer, $Out> -
ModelTargetValueCopy
on ObjectCopyWith<
$R, ModelTarget, $Out> - ModelTypeMapperExtension on ModelType
-
SlashCommandValueCopy
on ObjectCopyWith<
$R, SlashCommand, $Out> - StepSourceMapperExtension on StepSource
- StepStatusMapperExtension on StepStatus
- StepTargetMapperExtension on StepTarget
- StepTypeMapperExtension on StepType
-
StepValueCopy
on ObjectCopyWith<
$R, Step, $Out> -
SubagentCapabilitiesValueCopy
on ObjectCopyWith<
$R, SubagentCapabilities, $Out> -
SubagentConfigValueCopy
on ObjectCopyWith<
$R, SubagentConfig, $Out> -
SystemInstructionSectionValueCopy
on ObjectCopyWith<
$R, SystemInstructionSection, $Out> -
TemplatedSystemInstructionsValueCopy
on ObjectCopyWith<
$R, TemplatedSystemInstructions, $Out> - ThinkingLevelMapperExtension on ThinkingLevel
-
ToolCallValueCopy
on ObjectCopyWith<
$R, ToolCall, $Out> -
ToolResultValueCopy
on ObjectCopyWith<
$R, ToolResult, $Out> -
UsageMetadataValueCopy
on ObjectCopyWith<
$R, UsageMetadata, $Out> -
VertexEndpointValueCopy
on ObjectCopyWith<
$R, VertexEndpoint, $Out>
Constants
- defaultImageGenerationModel → const String
- defaultModel → const String
-
supportedAudioMimes
→ const Set<
String> -
supportedDocumentMimes
→ const Set<
String> -
supportedImageMimes
→ const Set<
String> -
supportedVideoMimes
→ const Set<
String>
Properties
- defaultAppDataDir → String
-
Default local app data directory location.
no setter
Functions
-
allow(
dynamic tool, {List< String> ? mcpTools, FutureOr<bool> when(ToolCall toolCall)?, String name = ''}) → dynamic - Creates an APPROVE policy.
-
allowAll(
) → Policy - Creates a policy that approves all tool calls without confirmation.
-
askUser(
dynamic tool, {List< String> ? mcpTools, required FutureOr<bool> handler(ToolCall toolCall), FutureOr<bool> when(ToolCall toolCall)?, String name = ''}) → dynamic - Creates an ASK_USER policy.
-
askUserHandler(
ToolCall tc) → Future< bool> - A policy handler that prompts the user for confirmation before executing a tool.
-
asyncInput(
String prompt) → Future< String> - Helper to read input asynchronously from standard input.
-
confirmRunCommand(
{FutureOr< bool> handler(ToolCall toolCall)?}) → List<Policy> - Denies or asks confirmation for running commands, allowing everything else.
-
deny(
dynamic tool, {List< String> ? mcpTools, FutureOr<bool> when(ToolCall toolCall)?, String name = ''}) → dynamic - Creates a DENY policy.
-
denyAll(
) → Policy - Creates a policy that denies all tool calls.
-
enforce(
List policies, {List< McpServerConfig> ? mcpServers}) → PreToolCallDecideHook - Compiles list of Policies into a high-performance PreToolCallDecideHook.
-
every(
Duration interval, FutureOr< void> callback(TriggerContext context)) → Trigger - Helper factory that creates a trigger running a callback on a fixed interval.
-
flattenPolicies(
List policies) → List< Policy> -
isPathInWorkspace(
String targetPath, String workspacePath) → bool -
Returns true if
targetPathcanonicalizes strictly withinworkspacePath. -
onFileChange(
String path, FutureOr< void> callback(TriggerContext context, List<FileChange> changes)) → Trigger - Helper factory that creates a trigger watching for filesystem changes at the specified path.
-
runInteractiveLoop(
AgentConfig config, {Agent agentFactory(AgentConfig config)?}) → Future< void> - Runs an interactive CLI loop for debugging and development.
-
safeDefaults(
FutureOr< bool> handler(ToolCall toolCall)) → List<Policy> - Creates a list of safe default policies (allowing read-only, asking for everything else).
-
workspace(
String workspacePath) → Policy - Creates a policy to allow tools only within a specific workspace.
-
workspaceOnly(
List< String> workspaces) → List<Policy> - Restricts file manipulation tools to specific workspace directories.
Typedefs
- ContentPrimitive = dynamic
- Union representation of dynamic prompt inputs.
-
ToolHandler
= FutureOr Function(Map<
String, dynamic> arguments, ToolContext? context) - Signature for a custom tool execution callback in the Google Antigravity SDK.
-
Trigger
= FutureOr<
void> Function(TriggerContext context) - A Trigger is any function that accepts a TriggerContext and runs asynchronously.
Exceptions / Errors
- AntigravityBinaryNotFoundException
- Exception thrown when the pre-existing system binary is not found at any search path in the Google Antigravity SDK.
- AntigravityCancelledException
- Exception thrown when an active turn is cancelled programmatically.
- AntigravityConnectionException
- Base connection exception for Google Antigravity SDK.
- AntigravityExecutionException
- Exception thrown when the agent execution encounters a terminal error.
- AntigravityValidationException
- Validation exception at the SDK boundary.