MCPcopy Create free account
hub / github.com/vercel/examples / create_ide_agent

Function create_ide_agent

python/vibe-coding-ide/backend/src/agent/agent.py:47–83  ·  view source on GitHub ↗

Factory to construct the IDE Agent with an optional model override. If model is provided, attempt to set it on the Agent. If the underlying Agent class does not accept a model parameter, gracefully ignore it.

(model: str | None = None, oidc_token: str | None = None)

Source from the content-addressed store, hash-verified

45
46
47def create_ide_agent(model: str | None = None, oidc_token: str | None = None) -> Agent:
48 """Factory to construct the IDE Agent with an optional model override.
49
50 If model is provided, attempt to set it on the Agent. If the underlying
51 Agent class does not accept a model parameter, gracefully ignore it.
52 """
53 base_kwargs = {
54 "name": "IDE Agent",
55 "instructions": instructions,
56 "tools": [
57 think,
58 # fs ops
59 edit_code,
60 create_file,
61 delete_file,
62 rename_file,
63 create_folder,
64 delete_folder,
65 rename_folder,
66 # sandbox controls
67 sandbox_create,
68 sandbox_stop,
69 sandbox_run,
70 sandbox_set_env,
71 sandbox_show_preview,
72 ],
73 }
74 os.environ["VERCEL_AI_GATEWAY_API_KEY"] = os.getenv("VERCEL_AI_GATEWAY_API_KEY") or os.getenv("AI_GATEWAY_API_KEY", "")
75 os.environ["VERCEL_OIDC_TOKEN"] = oidc_token or os.getenv("VERCEL_OIDC_TOKEN", "")
76
77 if model:
78 try:
79 formatted_model = f"litellm/vercel_ai_gateway/{model}"
80 return Agent(**base_kwargs, model=formatted_model)
81 except TypeError:
82 return Agent(**base_kwargs)
83 return Agent(**base_kwargs)
84
85
86async def run_agent_flow(

Callers 2

run_agent_flowFunction · 0.85
resume_agent_flowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected