Migrate Gemini Interactions to Kitaru
What this skill does
Use this skill to inspect existing Gemini Interactions / Google GenAI code and
move the safe outer interaction boundary to Kitaru's kitaru.adapters.gemini
surfaces.
The output should be conservative:
- A source pattern inventory.
- A migration plan that classifies each important pattern as
direct,
approximate, or absent.
- Migrated or proposed code using
KitaruGeminiInteractionsRunner,
GeminiInteractionRequest, GeminiInteractionResult, and capture policy.
- A
MIGRATION_REPORT.md section or file that names replay, polling,
requires_action, hosted-tool, Antigravity, environment, region, credential,
and privacy risks.
Use the user-facing name Gemini Interactions. Treat Antigravity as an
important managed-agent/preset use case, not as the primary adapter identity.
Mental model: Google owns the hosted runtime; Kitaru records one stable response
Google owns the hosted interaction runtime: model/agent execution, hosted tools,
MCP, web/code execution, Antigravity sandbox/environment internals, background
jobs, and server-side interaction history.
Kitaru records one stable Gemini Interactions response with
checkpoint_strategy="interaction". Stable means completed or
requires_action.
Concrete story: the app sends an interaction request. Google may think, browse,
call hosted tools, use an Antigravity environment, or ask for a local function
result. Kitaru cannot see all of that internal work. Kitaru records the stable
response that comes back. If the response says requires_action, the work
returns to your Kitaru flow: run the local tool or ask a human, then send a later
function_result request.
When to use this skill
Use it when the user asks to:
- replace
client.interactions.create(...) with
KitaruGeminiInteractionsRunner.run/run_sync(...);
- migrate
client.interactions.get(...) polling to GeminiInteractionRequest.poll(...);
- preserve
previous_interaction_id with GeminiInteractionRequest.resume(...);
- migrate function-result turns with
GeminiInteractionRequest.function_result(...);
- handle
requires_action at Kitaru flow scope;
- review
background, store, steps, output_text, hosted tools, MCP,
Google Search, code execution, web tools, Antigravity, managed agents, Vertex,
API keys, regions, environments, or cache_identity;
- produce a migration report for Gemini Interactions code.
When not to use this skill
Do not use it to:
- migrate classic
generateContent code unless the user is explicitly moving it
to Gemini Interactions first;
- claim Kitaru can checkpoint Google-owned hosted tools, MCP, web/code
execution, background internals, or Antigravity sandbox steps;
- hide
requires_action work inside the provider-owned interaction instead of
returning it to Kitaru flow scope;
- treat in-progress/background jobs as successful checkpoint outputs;
- make Antigravity look like the core adapter identity.
The three mapping types
Classify each source pattern before editing:
direct: Kitaru has a close adapter surface for the same outer behavior.
Example: client.interactions.create(model=..., input=...) becomes
runner.run_sync(GeminiInteractionRequest.start(input, model=...)).
approximate: The migration is possible, but replay, polling, state,
environment, capture, or hosted-tool behavior differs. Example: hosted tool
steps remain Google-owned and are captured only as response summaries/artifacts.
absent: There is no safe automatic migration. Example: a plan to replay each
Antigravity file operation as a Kitaru checkpoint.
Unsupported patterns must not be silently approximated. Add a concrete
# TODO(migration): ... comment near proposed code, list it in the report, and
explain the redesign needed.
Migration workflow
- Inspect source first. Find
genai.Client, client.interactions.create,
get, previous_interaction_id, background, store, function calls,
function results, status checks, Antigravity/managed agents, environments,
Vertex/API-key configuration, and existing Kitaru decorators.
- Classify every pattern. Use
references/concept-map.md and
references/gaps-and-flags.md. Count direct, approximate, high-risk, and
blocked items.
- Choose Kitaru boundaries. Use only
checkpoint_strategy="interaction".
One stable Gemini Interactions response becomes one Kitaru checkpoint.
- Present the plan before generating code when the migration is more than a
tiny entrypoint replacement. Name hosted runtime limits, polling behavior,
and privacy capture decisions before editing.
- Draft migrated code. Replace raw interactions entrypoints with
KitaruGeminiInteractionsRunner plus GeminiInteractionRequest. Add status
handling for completed, requires_action, and non-stable statuses.
- Produce
MIGRATION_REPORT.md. Include the inventory, chosen boundary,
classifications, flags, behavior differences, and verification plan.
- Verify behavior. Prefer static/import checks. If API-key/Vertex access is
unavailable, say the check was static only.
Pattern detection checklist
Look for:
from google import genai, genai.Client(...), client.interactions.create,
client.interactions.get, or Interaction objects.
model=..., agent=..., environment=..., tools=...,
system_instruction=..., generation_config=..., agent_config=...,
response_format=..., or response_mime_type=....
previous_interaction_id, interaction.id, interaction_id, background,
store, poll, webhooks, or retry loops.
status, requires_action, function_call, function_result, call_id,
steps, output_text, and manual local tool execution.
- Antigravity agent IDs/presets, managed agents, remote environments, sandbox
files, and environment IDs.
- API-key vs Vertex/ADC setup, project, region/location, and client factories.
- Raw interaction payload capture, request manifests, logs, prompts, tool args,
generated files, or user data.
- Existing
@kitaru.flow or @kitaru.checkpoint wrappers.
Boundary decision rules
- Keep Gemini Interactions as the hosted runtime.
- Use
KitaruGeminiInteractionsRunner(name=..., checkpoint_strategy="interaction").
- Use
GeminiInteractionRequest.start(...) for new interactions.
- Use
GeminiInteractionRequest.resume(...) for previous_interaction_id turns.
- Use
GeminiInteractionRequest.function_result(...) to answer a prior
requires_action function call.
- Use
GeminiInteractionRequest.poll(interaction_id=...) to fetch an existing
background interaction. Do not create duplicate jobs to check progress.
- Preserve the
model= vs agent= distinction. Set exactly one.
- Use
.antigravity(...) for Antigravity managed-agent requests when that preset
fits, but report that Antigravity internals remain Google-owned.
- Add
cache_identity when the same logical request might run under different
projects, regions, credentials, clients, or environment configuration.
- Treat statuses other than
completed and requires_action as not safely
checkpointable final outputs.
Gemini Interactions migration quick guide
Minimal model interaction:
import kitaru
from kitaru.adapters.gemini import (
GeminiInteractionRequest,
KitaruGeminiInteractionsRunner,
)
runner = KitaruGeminiInteractionsRunner(name="gemini_writer")
@kitaru.flow
def write_summary(topic: str) -> str:
result = runner.run_sync(
GeminiInteractionRequest.start(
f"Write a short summary of {topic}.",
model="gemini-3.5-flash",
)
)
if result.status != "completed":
raise RuntimeError(f"Expected completed interaction, got {result.status!r}")
return result.output_text or ""
For full examples, load references/code-patterns.md.
Gap handling rules
When a pattern is unsafe or unsupported:
- Do not silently approximate it.
- Add a concrete
# TODO(migration): ... comment near the code if producing
code.
- Add a report entry with severity
LOW, MEDIUM, HIGH, or BLOCKER.
- Explain the bad outcome the flag prevents. Example: "creating a new
background interaction while polling would start duplicate provider work."
- Propose the smallest safe redesign.
Report requirements
Every non-trivial migration must include or draft MIGRATION_REPORT.md with:
- source files reviewed and changed/proposed;
- classification totals;
- source pattern inventory;
- chosen Kitaru interaction boundary;
- direct translations;
- approximate translations and caveats;
- flagged items with severity and required action;
- Gemini-specific notes for stable statuses,
requires_action, function
results, polling/background jobs, model vs agent targets, Antigravity,
environments, Vertex/API-key/region/client configuration, cache_identity,
capture/privacy policy, and hosted tools;
- verification plan and whether execution was actually run.
Use references/report-template.md when a full report is needed.
Anti-patterns
Avoid these:
- Using any checkpoint strategy except
"interaction".
- Treating
in_progress, failed, cancelled, incomplete, or
budget_exceeded as successful checkpoint outputs.
- Creating a new background interaction when the source meant to poll an
existing
interaction_id.
- Claiming Kitaru can replay hosted tools, MCP, web/code execution, or
Antigravity sandbox internals as granular checkpoints.
- Hiding local function-result work inside provider-owned flow instead of
returning it to Kitaru flow scope.
- Mixing
model= and agent= in one request.
- Omitting
cache_identity when project/region/credential/client differences
change the meaning of the cached request.
- Saving raw prompts/provider payloads without an explicit privacy decision.
References
Load only the reference file needed for the current task:
references/concept-map.md — source-to-target mapping table and
classification guidance.
references/code-patterns.md — import-complete migration examples.
references/gaps-and-flags.md — severity definitions, upstream assumptions,
and must-flag patterns.
references/report-template.md — Gemini Interactions-specific migration
report template.
Kitaru source references:
- Kitaru Gemini Interactions adapter docs:
kitaru/docs/content/docs/adapters/gemini-interactions.mdx
- Adapter exports:
kitaru/src/kitaru/adapters/gemini/__init__.py
- Adapter example:
kitaru/examples/integrations/gemini_interactions_agent/README.md
Source: zenml-io/kitaru-skills — distributed by TomeVault.
1---2name: zenml-io-kitaru-skills-kitaru-gemini-interactions-migration3description: Migrate Gemini Interactions to Kitaru4---56# Migrate Gemini Interactions to Kitaru78## What this skill does910Use this skill to inspect existing Gemini Interactions / Google GenAI code and11move the safe outer interaction boundary to Kitaru's `kitaru.adapters.gemini`12surfaces.1314The output should be conservative:15161. A source pattern inventory.172. A migration plan that classifies each important pattern as `direct`,18 `approximate`, or `absent`.193. Migrated or proposed code using `KitaruGeminiInteractionsRunner`,20 `GeminiInteractionRequest`, `GeminiInteractionResult`, and capture policy.214. A `MIGRATION_REPORT.md` section or file that names replay, polling,22 `requires_action`, hosted-tool, Antigravity, environment, region, credential,23 and privacy risks.2425Use the user-facing name **Gemini Interactions**. Treat Antigravity as an26important managed-agent/preset use case, not as the primary adapter identity.2728## Mental model: Google owns the hosted runtime; Kitaru records one stable response2930Google owns the hosted interaction runtime: model/agent execution, hosted tools,31MCP, web/code execution, Antigravity sandbox/environment internals, background32jobs, and server-side interaction history.3334Kitaru records one stable Gemini Interactions response with35`checkpoint_strategy="interaction"`. Stable means `completed` or36`requires_action`.3738Concrete story: the app sends an interaction request. Google may think, browse,39call hosted tools, use an Antigravity environment, or ask for a local function40result. Kitaru cannot see all of that internal work. Kitaru records the stable41response that comes back. If the response says `requires_action`, the work42returns to your Kitaru flow: run the local tool or ask a human, then send a later43`function_result` request.4445## When to use this skill4647Use it when the user asks to:4849- replace `client.interactions.create(...)` with50 `KitaruGeminiInteractionsRunner.run/run_sync(...)`;51- migrate `client.interactions.get(...)` polling to `GeminiInteractionRequest.poll(...)`;52- preserve `previous_interaction_id` with `GeminiInteractionRequest.resume(...)`;53- migrate function-result turns with `GeminiInteractionRequest.function_result(...)`;54- handle `requires_action` at Kitaru flow scope;55- review `background`, `store`, `steps`, `output_text`, hosted tools, MCP,56 Google Search, code execution, web tools, Antigravity, managed agents, Vertex,57 API keys, regions, environments, or `cache_identity`;58- produce a migration report for Gemini Interactions code.5960## When not to use this skill6162Do not use it to:6364- migrate classic `generateContent` code unless the user is explicitly moving it65 to Gemini Interactions first;66- claim Kitaru can checkpoint Google-owned hosted tools, MCP, web/code67 execution, background internals, or Antigravity sandbox steps;68- hide `requires_action` work inside the provider-owned interaction instead of69 returning it to Kitaru flow scope;70- treat in-progress/background jobs as successful checkpoint outputs;71- make Antigravity look like the core adapter identity.7273## The three mapping types7475Classify each source pattern before editing:7677- `direct`: Kitaru has a close adapter surface for the same outer behavior.78 Example: `client.interactions.create(model=..., input=...)` becomes79 `runner.run_sync(GeminiInteractionRequest.start(input, model=...))`.80- `approximate`: The migration is possible, but replay, polling, state,81 environment, capture, or hosted-tool behavior differs. Example: hosted tool82 steps remain Google-owned and are captured only as response summaries/artifacts.83- `absent`: There is no safe automatic migration. Example: a plan to replay each84 Antigravity file operation as a Kitaru checkpoint.8586Unsupported patterns must not be silently approximated. Add a concrete87`# TODO(migration): ...` comment near proposed code, list it in the report, and88explain the redesign needed.8990## Migration workflow91921. **Inspect source first.** Find `genai.Client`, `client.interactions.create`,93 `get`, `previous_interaction_id`, `background`, `store`, function calls,94 function results, status checks, Antigravity/managed agents, environments,95 Vertex/API-key configuration, and existing Kitaru decorators.962. **Classify every pattern.** Use `references/concept-map.md` and97 `references/gaps-and-flags.md`. Count direct, approximate, high-risk, and98 blocked items.993. **Choose Kitaru boundaries.** Use only `checkpoint_strategy="interaction"`.100 One stable Gemini Interactions response becomes one Kitaru checkpoint.1014. **Present the plan before generating code** when the migration is more than a102 tiny entrypoint replacement. Name hosted runtime limits, polling behavior,103 and privacy capture decisions before editing.1045. **Draft migrated code.** Replace raw interactions entrypoints with105 `KitaruGeminiInteractionsRunner` plus `GeminiInteractionRequest`. Add status106 handling for `completed`, `requires_action`, and non-stable statuses.1076. **Produce `MIGRATION_REPORT.md`.** Include the inventory, chosen boundary,108 classifications, flags, behavior differences, and verification plan.1097. **Verify behavior.** Prefer static/import checks. If API-key/Vertex access is110 unavailable, say the check was static only.111112## Pattern detection checklist113114Look for:115116- `from google import genai`, `genai.Client(...)`, `client.interactions.create`,117 `client.interactions.get`, or `Interaction` objects.118- `model=...`, `agent=...`, `environment=...`, `tools=...`,119 `system_instruction=...`, `generation_config=...`, `agent_config=...`,120 `response_format=...`, or `response_mime_type=...`.121- `previous_interaction_id`, `interaction.id`, `interaction_id`, `background`,122 `store`, `poll`, webhooks, or retry loops.123- `status`, `requires_action`, `function_call`, `function_result`, `call_id`,124 `steps`, `output_text`, and manual local tool execution.125- Antigravity agent IDs/presets, managed agents, remote environments, sandbox126 files, and environment IDs.127- API-key vs Vertex/ADC setup, project, region/location, and client factories.128- Raw interaction payload capture, request manifests, logs, prompts, tool args,129 generated files, or user data.130- Existing `@kitaru.flow` or `@kitaru.checkpoint` wrappers.131132## Boundary decision rules133134- Keep Gemini Interactions as the hosted runtime.135- Use `KitaruGeminiInteractionsRunner(name=..., checkpoint_strategy="interaction")`.136- Use `GeminiInteractionRequest.start(...)` for new interactions.137- Use `GeminiInteractionRequest.resume(...)` for `previous_interaction_id` turns.138- Use `GeminiInteractionRequest.function_result(...)` to answer a prior139 `requires_action` function call.140- Use `GeminiInteractionRequest.poll(interaction_id=...)` to fetch an existing141 background interaction. Do not create duplicate jobs to check progress.142- Preserve the `model=` vs `agent=` distinction. Set exactly one.143- Use `.antigravity(...)` for Antigravity managed-agent requests when that preset144 fits, but report that Antigravity internals remain Google-owned.145- Add `cache_identity` when the same logical request might run under different146 projects, regions, credentials, clients, or environment configuration.147- Treat statuses other than `completed` and `requires_action` as not safely148 checkpointable final outputs.149150## Gemini Interactions migration quick guide151152Minimal model interaction:153154```python155import kitaru156from kitaru.adapters.gemini import (157 GeminiInteractionRequest,158 KitaruGeminiInteractionsRunner,159)160161runner = KitaruGeminiInteractionsRunner(name="gemini_writer")162163@kitaru.flow164def write_summary(topic: str) -> str:165 result = runner.run_sync(166 GeminiInteractionRequest.start(167 f"Write a short summary of {topic}.",168 model="gemini-3.5-flash",169 )170 )171 if result.status != "completed":172 raise RuntimeError(f"Expected completed interaction, got {result.status!r}")173 return result.output_text or ""174```175176For full examples, load `references/code-patterns.md`.177178## Gap handling rules179180When a pattern is unsafe or unsupported:1811821. Do not silently approximate it.1832. Add a concrete `# TODO(migration): ...` comment near the code if producing184 code.1853. Add a report entry with severity `LOW`, `MEDIUM`, `HIGH`, or `BLOCKER`.1864. Explain the bad outcome the flag prevents. Example: "creating a new187 background interaction while polling would start duplicate provider work."1885. Propose the smallest safe redesign.189190## Report requirements191192Every non-trivial migration must include or draft `MIGRATION_REPORT.md` with:193194- source files reviewed and changed/proposed;195- classification totals;196- source pattern inventory;197- chosen Kitaru interaction boundary;198- direct translations;199- approximate translations and caveats;200- flagged items with severity and required action;201- Gemini-specific notes for stable statuses, `requires_action`, function202 results, polling/background jobs, model vs agent targets, Antigravity,203 environments, Vertex/API-key/region/client configuration, `cache_identity`,204 capture/privacy policy, and hosted tools;205- verification plan and whether execution was actually run.206207Use `references/report-template.md` when a full report is needed.208209## Anti-patterns210211Avoid these:212213- Using any checkpoint strategy except `"interaction"`.214- Treating `in_progress`, `failed`, `cancelled`, `incomplete`, or215 `budget_exceeded` as successful checkpoint outputs.216- Creating a new background interaction when the source meant to poll an217 existing `interaction_id`.218- Claiming Kitaru can replay hosted tools, MCP, web/code execution, or219 Antigravity sandbox internals as granular checkpoints.220- Hiding local function-result work inside provider-owned flow instead of221 returning it to Kitaru flow scope.222- Mixing `model=` and `agent=` in one request.223- Omitting `cache_identity` when project/region/credential/client differences224 change the meaning of the cached request.225- Saving raw prompts/provider payloads without an explicit privacy decision.226227## References228229Load only the reference file needed for the current task:230231- `references/concept-map.md` — source-to-target mapping table and232 classification guidance.233- `references/code-patterns.md` — import-complete migration examples.234- `references/gaps-and-flags.md` — severity definitions, upstream assumptions,235 and must-flag patterns.236- `references/report-template.md` — Gemini Interactions-specific migration237 report template.238239Kitaru source references:240241- Kitaru Gemini Interactions adapter docs:242 `kitaru/docs/content/docs/adapters/gemini-interactions.mdx`243- Adapter exports:244 `kitaru/src/kitaru/adapters/gemini/__init__.py`245- Adapter example:246 `kitaru/examples/integrations/gemini_interactions_agent/README.md`247248---249> Source: [zenml-io/kitaru-skills](https://github.com/zenml-io/kitaru-skills) — distributed by [TomeVault](https://tomevault.io).250<!-- tomevault:4.0:skill_md:2026-06-16 -->