# Get started with the Agent SDK This guide describes how to create a TypeScript agent in a Code Repository, publish the agent, and run a session with the agent in Agent Manager. ## Create an agent repository Navigate to a project of your choice and create a new agent by selecting **+ New > Agent > Build in code**. ![The TypeScript Agent creation form shows repository and agent names, model selection, and optional ontology binding.](../../../assets/94b00aea209695c402da5bcc58ff602a3dd961fb474545ea62402c56073c0969.webp) You must provide names for both the code repository where the agent definition lives and the published agent itself. Binding your agent to an Ontology is optional but allows you to use your agent in code through the Ontology and Platform SDK. Agent API names must be unique within an Ontology. ## Write an agent The code repository comes bootstrapped with a sample agent that is a good place to get started. For an Anthropic model, its definition under `typescript-functions/src/agents/myAgent.ts` looks like this excerpt: ```typescript export default defineAgent({ // publishing metadata locator: Aliases.custom("myAgent"), apiName: "myNewAgent", // Present when the agent is bound to an Ontology. // basic configuration model: anthropic({ modelRid: Aliases.model("model").rid, modelSettings: { max_tokens: 4096 }, }), tools: () => [WeatherTool], // advanced configuration agentStateSchema: AgentStateSchema, createSessionArgsSchema: z.object({}), createSession: () => ({ agentState: {} }), contextItemDefinitions: [WeatherResult], }); ``` The generated file imports the APIs and defines `AgentStateSchema`, `WeatherResult`, and `WeatherTool` above this definition. The model constructor and alias reflect the model selected during setup. You should also see a new Agent resource created in the selected Compass folder that corresponds to this agent. It currently has no versions published. ## Commit and publish Commit your changes in your code repository. To view your agent's checks, open the **Checks** tab at the top of the page. Here, after making a commit, you should see a running check. ![The repository Checks tab shows a running check and completed checks.](../../../assets/4973f6772e6d13308649d403864b0ca0abce4cd36fea5d21435121dbb1300a67.webp) After committing your work, go to the **Tags** tab to publish your agent. Here, you can select a semantic version that your agent will be published as. ![The Tag and release dialog offers patch, minor, major, and custom version options.](../../../assets/eaa962756d98a3f5662304e45e79d8b13da2676f05ff5971b19c9737f5915c33.webp) Once your agent has successfully been published, you can open it in Agent Manager. ## Run a session Open the published agent in [Agent Manager](../../aip/agent-stack/index.md#observe-and-interact-with-agents), start a session, and send a question. Inspect the response and the session's messages, events, and context items. ## Next steps * You can learn how to [customize an agent](../customize-agent/index.md) to enable your agent to do useful work. * Read [advanced customization](../advanced-customization/index.md) to dive deeper into how the Agent SDK allows you to deeply customize your agent.