# Publish and call a pro-code agent Every pro-code agent is published with an Ontology binding and an agent API name. Once published, the agent's function is callable from both [Workshop](../../workshop/overview/index.md) and the [Ontology SDK (OSDK)](../../ontology-sdk/overview/index.md) with no additional configuration. ## Ontology binding An Ontology binding associates your pro-code agent with a specific Ontology. The binding determines which Ontology resources the agent can access through its [scoped permissions](../scoped-permissions/index.md). To ensure every pro-code agent is bound to an Ontology, the agent configuration page includes a required **Ontology** selector. Select the Ontology your agent will read from and write to before you publish. ## Agent API name Each pro-code agent is published with an agent API name that identifies the agent's function when it is called from Workshop or OSDK. The agent API name is derived from the repository name, and you can edit it in the **Agent API name** field on the agent configuration page. ## Publish a pro-code agent When you publish an agent, Foundry registers it with its Ontology binding and agent API name and exposes it as a function. After publishing, no further configuration is required to call the agent. ## Trigger a pro-code agent An agent function runs asynchronously and is not subject to the synchronous function execution limit of five minutes. ### Trigger an agent from Automate (recommended) We recommend triggering an agent from [Automate](../../automate/overview/index.md). Configure an automation with a [function effect](../../automate/effect-function/index.md) that points at your agent's function. The agent runs as the user that triggered the automation, or as the service user backing the automation. ### Trigger an agent from Workshop, Ontology SDK, or Ontology actions You can also invoke an agent function wherever asynchronous functions are callable, including [Workshop](../../workshop/overview/index.md), the [Ontology SDK](../../ontology-sdk/overview/index.md), and Ontology actions. Note the following when calling an agent function directly: * **The function returns no value:** An agent function returns `Void`, so it cannot be called as a query function. To invoke it from Workshop, the Ontology SDK, or Ontology actions, call it as a function effect or wrap it in a [TypeScript Ontology edit function](../../functions/typescript-v2-ontology-edits/index.md) that invokes the agent. * **Consume results through the Ontology:** Because the function does not return a value, have your agent write its transcripts or results to Ontology objects, then read those objects to consume the output. This pattern also applies when grading agent output with [AIP Evals](../../aip-evals/overview/index.md). * **Streaming and batch invocation are not supported.** ## Pass arguments to a pro-code agent Pro-code agents accept [arguments](../agent-templates/index.md#agent-arguments) defined in the `AgentArguments` schema in `agent/index.ts`. When you trigger a pro-code agent, provide a JSON object with keys that match your `AgentArguments` schema. For Ontology objects, pass primary key values rather than whole objects, and re-fetch the objects inside your agent through the [Ontology SDK](../../ontology-sdk/overview/index.md) or [Ontology MCP](../../ontology-mcp/overview/index.md). To run a pro-code agent locally during development, provide arguments through the template's `start` command using `--json-args` for inline JSON or `--json-args-file` for a JSON file: ```bash npm run start -- --json-args '{ "additionalAgentContext": { "type": "string", "string": "some context" } }' ``` ## Next steps * [Build and publish your first pro-code agent in Foundry.](../create-agent/index.md)