OpenAI SDK
1. Install the CLI
npm install -g swytchcodeirm https://cli.swytchcode.com/install.ps1 | iexcurl -fsSL https://cli.swytchcode.com/install.sh | shUse swy as a shorter alias for swytchcode.
2. Install the packages
npm install @swytchcode/runtime @openai/agents dotenvpip install swytchcode-runtime openai-agents python-dotenv3. Initialize Swytchcode and fetch a toolkit
swy initswy get githubswy init creates .swytchcode/ and tooling.json for the project. swy get github downloads the GitHub integration bundle - the schemas that tools.get reads from in a later step.
4. List available methods
swy list methodsThis lists every method from the integrations you’ve downloaded, so you can see what the GitHub bundle exposes before you load tools in the SDK.
5. Enable a tool and connect GitHub
swy add <canonical_id>swy auth connect githubCopy a canonical ID from swy list methods. For example:
swy add github.issues.createswy add writes that method into tooling.json so the SDK can execute it. swy auth connect github opens a browser so you can authorize GitHub.
6. Create the agent tools
import 'dotenv/config';import { Swytchcode } from '@swytchcode/runtime';import { OpenAIAgentsProvider } from '@swytchcode/runtime/providers/openai-agents';
const swx = new Swytchcode(new OpenAIAgentsProvider());
const tools = await swx.tools.get({ toolkits: ['github'] });import osfrom dotenv import load_dotenvfrom swytchcode_runtime import Swytchcodefrom swytchcode_runtime.providers.openai_agents import OpenAIAgentsProvider
load_dotenv()
swx = Swytchcode(provider=OpenAIAgentsProvider())tools = swx.tools.get(toolkits=["github"])
print(f"Loaded {len(tools)} tools")7. Run the agent
import { Agent, run } from '@openai/agents';
const agent = new Agent({ name: 'Assistant', instructions: 'You are a helpful assistant.', tools,});
const result = await run(agent, 'List my open GitHub issues and summarize them.');
console.log(result.finalOutput);from agents import Agent, Runner
agent = Agent( name="Assistant", instructions="You are a helpful assistant.", tools=tools,)
result = Runner.run_sync(agent, "List my open GitHub issues and summarize them.")
print(result.final_output)8. Run the file
Save the example as main.js or main.py, then run the matching command:
node main.jspython main.pyThe runtime maps the agent’s tool calls to the Swytchcode execution layer.